|
1 |
| -using System; |
| 1 | +using RomUtilities; |
| 2 | +using System; |
2 | 3 | using System.Collections.Generic;
|
3 | 4 | using System.Linq;
|
4 |
| -using RomUtilities; |
5 | 5 |
|
6 | 6 | namespace FF1Lib
|
7 | 7 | {
|
@@ -143,6 +143,8 @@ private enum FF1Class
|
143 | 143 | */
|
144 | 144 | 0x80,0x40,0x20,0x10,0x08,0x04,0x02};
|
145 | 145 |
|
| 146 | + private readonly List<FF1Class> DefaultChoices = Enumerable.Range(0, 6).Select(x => (FF1Class)x).ToList(); |
| 147 | + |
146 | 148 | void updateCharacterFromOptions(int slotNumber, bool forced, IList<FF1Class> options, MT19337 rng)
|
147 | 149 | {
|
148 | 150 | const int lut_PtyGenBuf = 0x784AA; // offset for party generation buffer LUT
|
@@ -170,14 +172,14 @@ void updateCharacterFromOptions(int slotNumber, bool forced, IList<FF1Class> opt
|
170 | 172 | if (!options.Any()) return;
|
171 | 173 |
|
172 | 174 | byte allowedFlags = 0b0000_0000;
|
173 |
| - foreach(FF1Class option in options) |
| 175 | + foreach (FF1Class option in options) |
174 | 176 | {
|
175 | 177 | allowedFlags |= AllowedClassBitmasks[(int)option];
|
176 | 178 | }
|
177 | 179 |
|
178 | 180 | // set default member
|
179 |
| - byte defaultclass = (byte)options.PickRandom(rng); |
180 |
| - Data[lut_PtyGenBuf + i * 0x10] = defaultclass == 6 ? (byte)0xFF : defaultclass; |
| 181 | + var defaultclass = (forced || !DefaultChoices.SequenceEqual(options)) ? (int)options.PickRandom(rng) : slotNumber - 1; |
| 182 | + Data[lut_PtyGenBuf + i * 0x10] = defaultclass == 6 ? (byte)0xFF : (byte)defaultclass; |
181 | 183 |
|
182 | 184 | // set allowed classes
|
183 | 185 | Data[lut_AllowedClasses + i] = allowedFlags;
|
@@ -329,7 +331,7 @@ public void EnableSpeedHacks()
|
329 | 331 | MoveNpc(MapId.Elfland, 0, 0x27, 0x18, inRoom: false, stationary: true); // Efland Entrance Elf
|
330 | 332 | MoveNpc(MapId.Onrac, 13, 0x29, 0x1B, inRoom: false, stationary: true); // Onrac Guy
|
331 | 333 | MoveNpc(MapId.Lefein, 3, 0x21, 0x07, inRoom: false, stationary: true); // Lefein Guy
|
332 |
| - //MoveNpc(MapId.Waterfall, 1, 0x0C, 0x34, inRoom: false, stationary: false); // OoB Bat! |
| 334 | + //MoveNpc(MapId.Waterfall, 1, 0x0C, 0x34, inRoom: false, stationary: false); // OoB Bat! |
333 | 335 | MoveNpc(MapId.EarthCaveB3, 10, 0x09, 0x0B, inRoom: true, stationary: false); // Earth Cave Bat B3
|
334 | 336 | MoveNpc(MapId.EarthCaveB3, 7, 0x0B, 0x0B, inRoom: true, stationary: false); // Earth Cave Bat B3
|
335 | 337 | MoveNpc(MapId.EarthCaveB3, 8, 0x0A, 0x0C, inRoom: true, stationary: false); // Earth Cave Bat B3
|
@@ -524,7 +526,7 @@ public void NoDanMode()
|
524 | 526 | // Instead of looping through the 'check to see if characters are alive' thing, just set it to 4 and then remove the loop.
|
525 | 527 | // EA EA EA EA EA EA (sports)
|
526 | 528 | Put(0x2DEC6, Blob.FromHex("A204A004EAEAEAEAEAEAEAEAEAEAEAEAEA"));
|
527 |
| - |
| 529 | + |
528 | 530 | }
|
529 | 531 |
|
530 | 532 | public void ShuffleWeaponPermissions(MT19337 rng)
|
|
0 commit comments