Skip to content

Commit dc9b58c

Browse files
committed
Updated Desktop App!
Made default class choices default to vanilla choices.
1 parent 014f1ee commit dc9b58c

File tree

4 files changed

+530
-64
lines changed

4 files changed

+530
-64
lines changed

FF1Lib/Hacks.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System;
1+
using RomUtilities;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
4-
using RomUtilities;
55

66
namespace FF1Lib
77
{
@@ -143,6 +143,8 @@ private enum FF1Class
143143
*/
144144
0x80,0x40,0x20,0x10,0x08,0x04,0x02};
145145

146+
private readonly List<FF1Class> DefaultChoices = Enumerable.Range(0, 6).Select(x => (FF1Class)x).ToList();
147+
146148
void updateCharacterFromOptions(int slotNumber, bool forced, IList<FF1Class> options, MT19337 rng)
147149
{
148150
const int lut_PtyGenBuf = 0x784AA; // offset for party generation buffer LUT
@@ -170,14 +172,14 @@ void updateCharacterFromOptions(int slotNumber, bool forced, IList<FF1Class> opt
170172
if (!options.Any()) return;
171173

172174
byte allowedFlags = 0b0000_0000;
173-
foreach(FF1Class option in options)
175+
foreach (FF1Class option in options)
174176
{
175177
allowedFlags |= AllowedClassBitmasks[(int)option];
176178
}
177179

178180
// 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;
181183

182184
// set allowed classes
183185
Data[lut_AllowedClasses + i] = allowedFlags;
@@ -329,7 +331,7 @@ public void EnableSpeedHacks()
329331
MoveNpc(MapId.Elfland, 0, 0x27, 0x18, inRoom: false, stationary: true); // Efland Entrance Elf
330332
MoveNpc(MapId.Onrac, 13, 0x29, 0x1B, inRoom: false, stationary: true); // Onrac Guy
331333
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!
333335
MoveNpc(MapId.EarthCaveB3, 10, 0x09, 0x0B, inRoom: true, stationary: false); // Earth Cave Bat B3
334336
MoveNpc(MapId.EarthCaveB3, 7, 0x0B, 0x0B, inRoom: true, stationary: false); // Earth Cave Bat B3
335337
MoveNpc(MapId.EarthCaveB3, 8, 0x0A, 0x0C, inRoom: true, stationary: false); // Earth Cave Bat B3
@@ -524,7 +526,7 @@ public void NoDanMode()
524526
// Instead of looping through the 'check to see if characters are alive' thing, just set it to 4 and then remove the loop.
525527
// EA EA EA EA EA EA (sports)
526528
Put(0x2DEC6, Blob.FromHex("A204A004EAEAEAEAEAEAEAEAEAEAEAEAEA"));
527-
529+
528530
}
529531

530532
public void ShuffleWeaponPermissions(MT19337 rng)

0 commit comments

Comments
 (0)