The current URL is datacrystal.tcrf.net.
Medarot 3/Notes: Difference between revisions
Blaziken257 (talk | contribs) No edit summary |
Blaziken257 (talk | contribs) (→RNG) |
||
Line 283: | Line 283: | ||
The RNG function is located at 0xC53D in ROM. | The RNG function is located at 0xC53D in ROM. | ||
==== Seed calculation ==== | |||
First, the game takes the current value of the frame counter and uses a formula to calculate a new 16-bit number, which is later added to the seeds. | |||
F = (Frame counter * 256) + ((int(((<span class="explain" title="Swaps the nibbles in the 8-bit value (ex. 9D becomes D9).">Swap nibbles(Frame counter)</span> + 1) mod 256) / 2) + 135) mod 256) | |||
Next, the game calculates a number based on the current value of the two seeds. This formula is simpler: | |||
S = Seed 1 * 256 + Seed 2 | |||
To obtain seed 1: | |||
Seed 1<sub>new</sub> = <span class="explain" title="Lower 8 bits of F+S">((F+S) mod 256)</span> | |||
To obtain seed 2: | |||
Seed 2<sub>new</sub> = <span class="explain" title="Upper 8 bits of F+S">(int(((F+S) mod 65536)/256))</span> xor <span class="explain" title="Lower 8 bits of F+S">((F+S) mod 256)</span> | |||
The seeds are then added together (reduced to 8 bits), and this is the randomly generated number. | |||
==== Random encounters ==== | ==== Random encounters ==== |
Latest revision as of 02:45, 31 January 2025
The following article is a Notes Page for Medarot 3.
Map IDs
Currently incomplete
- 0000 = Omikuji Town
- 0001 = Medarot Research Institute (Entrance)
- 0002 = Medarot Research Institute (Room adjacent to entrance, to the north)
- 0003 = Medarot Research Institute (Western room)
- 0004 = Medarot Research Institute (Northernmost room)
- 0005 = Medarot Research Institute (Easternmost room)
- 0006 = Medarot Research Institute (Locked room, NW?)
- 0007 = Ikki's house (bottom floor)
- 0008 = Ikki's house (upstairs bedroom)
- 0009 = Arika's house
- 000A = Kikuhime's house
- 000B = Iwanoi's house
- 000C = Kagamiyama's house
- 000D = Boss's house in overworld, west of park in Omikuji Town
- 000E = House west of Ikki's house
- 000F = House west of Medaropolis
- 0010 = House north of 000F, contains Rubberobo medals
- 0011 = House south of Abandoned Factory
- 0012 = Abandoned Factory
- 0013 = Park in Omikuji Town
- 0014 = First shop (#0)
- 0015 = Select Corp (Omikuji Town branch)
- 0016 = Train, west end of Omikuji Town
- 0017 = Ginjo Elementary School (lobby)
- 0018 = Ginjo Elementary School (1F)
- 0019 = Ginjo Elementary School (2F)
- 001A = Ginjo Elementary School (1F Classroom NW)
- 001B = Ginjo Elementary School (1F Classroom NNW)
- 001C = Ginjo Elementary School (1F Classroom NNE)
- 001D = Ginjo Elementary School (1F Classroom NE)
- 001E = Ginjo Elementary School (1F Classroom SSE)
- 001F = Ginjo Elementary School (1F Classroom SE)
- 0020 = Ginjo Elementary School (2F Classroom NW)
- 0021 = Ginjo Elementary School (2F Classroom NNW)
- 0022 = Ginjo Elementary School (2F Classroom SW)
- 0023 = Ginjo Elementary School (2F Classroom SSW)
- 0024 = Ginjo Elementary School (2F Classroom SSE)
- 0025 = Ginjo Elementary School (2F Classroom SE)
- 0026 = Ginjo Elementary School (1F Classroom SSW)
- 0027 = Ginjo Elementary School (1F Men's Room SW)
- 0028 = Ginjo Elementary School (2F Ladies' Room SE)
- 002A = Medaropolis 1 (NW)
- 002B = Building in Medaropolis 1
- 002C = Building in Medaropolis 1
- 002D = Building in Medaropolis 1
- 002E = Shop in Medaropolis 1 (1F, #1 & Paint Shop)
- 002F = Shop in Medaropolis 1 (2F, Medalink)
- 0030 = Shop in Medaropolis 1 (3F)
- 0031 = Select Corps headquarters
- 0032 = Select Corps headquarters (east entrance, first aid center)
- 0033 = Bunny girl bar
- 0034 = Medaropolis 2 (SW)
- 0035 = Medalo Department Store (Shop #2)
- 0036 = Medalo Department Store (2F)
- 0037 = Building in Medaropolis 2 with Office Worker
- 0038 = Building in Medaropolis 2 (adjacent to empty room)
- 0039 = Empty building in Medaropolis 2
- 003A = Building in Medaropolis 2
- 003B = Medaropolis 3 (NE)
- 003C = Building in Medaropolis 3
- 003D = Building in Medaropolis 3
- 003E = Building in Medaropolis 3
- 003F = Building in Medaropolis 3
- 0040 = Building in Medaropolis 3
- 0041 = Shop in Medaropolis 3 (#3)
- 0042 = Locked building in Medaropolis 3 (Koji's house)
- 0043 = Locked building in Medaropolis 3 (Koji's house 2F)
- 0044 = Karin's house
- 0045 = Hachiro's house
- 0046 = Hachiro's house (2F)
- 0047 = Hanazono Private School (lobby)
- 0048 = Hanazono Private School (gym)
- 0049 = Hanazono Private School (1F)
- 004A = Hanazono Private School (1F men's room NW)
- 004B = Hanazono Private School (1F hallway
- 004C = Hanazono Private School (1F Classroom NE)
- 004D = Hanazono Private School (1F Classroom WNW)
- 004E = Hanazono Private School (1F Classroom SW)
- 004F = Hanazono Private School (1F Classroom ENE)
- 0050 = Hanazono Private School (1F Classroom SSE)
- 0051 = Hanazono Private School (1F Classroom SSW)
- 0052 = Hanazono Private School (2F)
- 0053 = Hanazono Private School (2F Classroom SSE)
- 0054 = Hanazono Private School (2F Classroom WNW)
- 0055 = Hanazono Private School (2F Classroom WSW)
- 0056 = Hanazono Private School (2F Classroom ESE)
- 0057 = Hanazono Private School (2F ladies' room SSW)
- 0058 = Hanazono Private School (2F Staff Room NNW)
- 0059 = Hanazono Private School (2F Office NNE)
- 005A = Hanazono Private School (Medal room)
- 005B = Medaropolis 4 (SE)
- 005C = Building in Medaropolis 4 (adjacent to curry restaurant)
- 005D = Building in Medaropolis 4
- 005E = Building in Medaropolis 4 (with robattle)
- 005F = Building in Medaropolis 4
- 0060 = Medarot Company
- 0061 = Medarot Company (east)
- 0062 = Medarot Company (west)
- 0063 = Restaurant Dom Peri (with curry!)
- 0064 = Risotto Apartments (1F, lobby)
- 0065 = Risotto Apartments (2F, lobby)
- 0066 = Risotto Apartments (1F, west room)
- 0067 = Risotto Apartments (1F, east room)
- 0068 = Risotto Apartments (2F, west room)
- 0069 = Risotto Apartments (2F, east room)
- 006A = Train track in Medaropolis?
- 006B = Train (Start of Chapter 3) / Airplane (Start of Chapter 5)
- 006C = Earth Mall (Underground town)
- 006D = Building in Earth Mall
- 006E = Building in Earth Mall
- 006F = Building in Earth Mall
- 0070 = Building in Earth Mall
- 0071 = Building in Earth Mall
- 0072 = Building in Earth Mall
- 0073 = Building in Earth Mall
- 0075 = Building in Earth Mall
- 0076 = Building in Earth Mall
- 0077 = Shop #4 (Earth Mall)
- 0078 = GeoFront Scientific Laboratory Entrance
- 0079 = GeoFront Scientific Laboratory Floor 1 NW
- 007A = GeoFront Scientific Laboratory Floor 1 NE
- 007B = GeoFront Scientific Laboratory Floor B1
- 007C = GeoFront Scientific Laboratory Floor B1 NW
- 007D = GeoFront Scientific Laboratory Floor B1 NE
- 007E = GeoFront Scientific Laboratory Floor B1 Artificial Farm
- 007F = GeoFront Floor?
- 0080 = GeoFront Floor? NW
- 0084 = GeoFront (Past broken elevator)
- 0085 = Outside of Primity Baby room
- 0086 = Primity Baby room
- 0087 = Geothermal Power Plant
- 0089 = Medarot Dispatch Center
- 008A = Medalympics (GeoDome)
- 008B = Train Station (Earth Mall)
- 008C = Weather Station
- 008D = Tsuchinoe Elementary School (1F lobby)
- 008E = Tsuchinoe Elementary School (1F WNW)
- 008F = Tsuchinoe Elementary School (1F NNW)
- 0090 = Tsuchinoe Elementary School (1F NNE)
- 0091 = Tsuchinoe Elementary School (1F ENE)
- 0092 = Tsuchinoe Elementary School (1F Far W)
- 0093 = Tsuchinoe Elementary School (1F W)
- 0094 = Tsuchinoe Elementary School (1F E)
- 0095 = Tsuchinoe Elementary School (1F Far E)
- 0096 = Tsuchinoe Elementary School (1F SW)
- 0097 = Tsuchinoe Elementary School (1F mens' room)
- 0098 = Tsuchinoe Elementary School (1F ladies' room)
- 0099 = Tsuchinoe Elementary School (1F SE)
- 009A = Under-Shell (West)
- 009B = Under-Shell (East)
- 009C = Under-Shell (Bubble, underwater)
- 009D = Under-Shell (Under-Bed Forest)
- 009E = Under-Shell (Subaru cutscene?)
- 009F = Under-Shell (Marine Express)
- 00A0 = Under-Shell (Bubble Lobby)
- 00A1 = Under-Shell (house)
- 00A2 = Under-Shell (house)
- 00A3 = Under-Shell (house)
- 00A4 = Under-Shell (house)
- 00A5 = Under-Shell (house)
- 00A6 = Under-Shell (house)
- 00A7 = Under-Shell (house)
- 00A8 = Under-Shell (house)
- 00A9 = Under-Shell (house)
- 00AA = Under-Shell (house)
- 00AB = Under-Shell (house)
- 00AC = Under-Shell (Medarotter 1F - Shop #5 and Paint Shop)
- 00AD = Under-Shell (Medarotter Building 2F - Medalink)
- 00AE = Under-Shell (Medarotter Building 3F)
- 00AF = Under-Shell shop (#6)
- 00C9 = Area outside of Nimosaku's house???
- 00CB = Nimosaku's house??? (Post Medalympics)
- 00CC = Nimosaku's house 2F??? (Post Medalympics)
- 008B = Mermaid room
- 00B0 = Under-Shell - Merman/Mermaid Academy Lobby
- 00BC = Mermaid - Principal's office
- 00B1 = Mermaid Academy - Main Hall
- 00C9 = Heaven's Gate (??)
- 00CD = Heaven's Gate (??)
- 00DB = Heaven's Gate (1F - Entrance)
- 00DC = Heaven's Gate (Shop #7)
- 00DD = Heaven's Gate (Elevator)
- 00DE = Heaven's Gate (2F - Office 1)
- 00DF = Heaven's Gate (2F - N Room)
- 00E0 = Heaven's Gate (2F - W Room)
- 00E1 = Heaven's Gate (2F - E Room)
- 00E2 = Heaven's Gate (2F - S Room - Select Corps)
- 00E3 = Heaven's Gate (3F - Aero Hotel 1)
- 00E4 = Heaven's Gate (3F - N Room)
- 00E5 = Heaven's Gate (3F - NW Room - Kikuhime)
- 00E6 = Heaven's Gate (3F - SW Room - Iwanoi/Spyke)
- 00E7 = Heaven's Gate (3F - NE Room - Kagamiyama)
- 00E8 = Heaven's Gate (3F - SE Room)
- 00E9 = Heaven's Gate (4F - Aero Hotel 2)
- 00EA = Heaven's Gate (4F - N Room)
- 00EB = Heaven's Gate (4F - NW - Ikki's room)
- 00EC = Heaven's Gate (4F - SW - Arika's room)
- 00ED = Heaven's Gate (4F - NE)
- 00EE = Heaven's Gate (4F - SE - Karin's room)
- 00EF = Heaven's Gate (5F - Office 2)
- 0103 = Heaven's Gate (9F - Sky Park)
- 010B = Heaven's Gate (Lobby?)
- 0135 = Select Corps (Earth Mall)
- 0138 = Medaroplis Cutscene?
- 013B = Under-Shell (Main / Night / Post-Subaru)
Game states
- 00 - Boot-up
- 01 - Opening credits
- 02 - Title screen
- 03 - Test Mode (Select+Start on title screen)
- 04 - Just after title screen
- 05 - Post-title menu
- 06 - Game Over
- 07 - Shop
- 08 - Finished battle (lose?), dialog, main map
- 09 - Pause menu
- 0A - Medawatch
- 0B - Items
- 0D - Parts
- 0C - Save
- 0E - Medals
- 0F - Pre-battle - Medarot selection
- 10 - Robattle - select move
- 12 - Auto Battle Plan
- 13, 14 - About to attack in robattle
- 1A - Robattle animation
- 20 - Boat Mini-game
- 21 - Frogger Mini-game
- 22 - Paint Shop
- 23 - Cutscene?
- 24 - Cutscene - Medarot explanation
- 25 - Cutscene?
- 26 - Train
- 27 - Chapter
- 28 - Robattle animation -- bug appears from center
- 29 - Medapedia
- 2A - Credits
- 2B - Medachange
- 2C - Resets to title screen
- 2E - Map
- 2D - Intro screen
- 2F - Naming screen
- 30 - VRAM viewer
- 31 - Debug menu
SRAM
The format is very similar to Telefang and Medarot 4/5.
Save file header
An ASCII string exists in 0:A000-A00F
. This is used to determine if a save file is present. Like other Medarot games (but unlike Telefang), the string is the same in both Kabuto and Kuwagata versions:
MEDAROT3 \x00
(Note that \x00
denotes a null byte with value 00
)
This string is compared against ROM offset 15:4106-4115
in both versions to determine if a save file is present. If the string is not present, the game assumes that the cartridge is brand new (or has its battery freshly replaced) and initializes the save by copying the string from the aforementioned ROM offset and initializes the save by filling the checksum region (see below) to 00
.
Checksum
After the title screen, the game runs a checksum, adding up each byte from 0:A000-BFEF
. The result is a 16-bit number. This is compared to a 16-bit, big endian integer at 0:BFFE-BFFF
. If this doesn't match, a save file corruption message will appear afterwards. Once the player presses A to leave this screen, the file is erased.
Medarot 4, 5, and Telefang also compute the checksum the same way and have the same SRAM addresses.
Save file bit
At 0:BFFD
in SRAM, this value is 00
if a save file is not present, and 01
if it is.
RNG
In Medarot 3, random events rely on a random number generator. The randomizer is identical to the one in Telefang, except for different RAM addresses. It is generated using the following variables:
- The frame counter, located at 0xC460 in RAM. This is an 8-bit number, and it increments by 1 for every frame that passes (1 frame = 1/60 second). However, it temporarily freezes in certain situations, such as when voice samples are played. The frame counter makes random actions frame dependent.
- Seed 1, located at 0xC460 in RAM. This value is also an 8-bit number, and it changes every time a random event occurs, and its value depends on the current value of the frame counter, as well as the current values of both seeds.
- Seed 2, located at 0xC4BD in RAM. This 8-bit value functions similarly to Seed 1, although it influences the randomly generated number more than Seed 1.
- Seed sum, the 8-bit sum of the two seeds, located at 0xC4A0 in RAM. This is the randomly generated number, most directly used to determine random events.
The RNG function is located at 0xC53D in ROM.
Seed calculation
First, the game takes the current value of the frame counter and uses a formula to calculate a new 16-bit number, which is later added to the seeds.
F = (Frame counter * 256) + ((int(((Swap nibbles(Frame counter) + 1) mod 256) / 2) + 135) mod 256)
Next, the game calculates a number based on the current value of the two seeds. This formula is simpler:
S = Seed 1 * 256 + Seed 2
To obtain seed 1:
Seed 1new = ((F+S) mod 256)
To obtain seed 2:
Seed 2new = (int(((F+S) mod 65536)/256)) xor ((F+S) mod 256)
The seeds are then added together (reduced to 8 bits), and this is the randomly generated number.
Random encounters
TODO: This at least applies for Heaven's Gate, possibly for other locations too.
- The player is guaranteed to walk 0x16 (22) steps without a random battle (Counter at C53D).
- After this, each time the player takes a step, the RNG is invoked (RAM address C4A0), and in this case, it forces a value from 0x00 to 0x1F. If the value is 0x1F, a random encounter starts (so there is a 1/32 chance for each step).
- After 0x2E (46) steps, a random encounter is guaranteed.
- If you save and soft reset, the step counter is reset to 0. Therefore, saving and soft resetting repeatedly can avoid random counters, useful in places where the Mini-Wheel can't be used!
Collapse Internal Data for Medarot 3
| |
---|---|