void ResourceRoutines()
{
ResType[] resTypes =
{
ResType.Invalid,
ResType.Invalid,
ResType.Costume,
ResType.Room,
ResType.Invalid,
ResType.Script,
ResType.Sound
};
int resid = GetVarOrDirectByte(OpCodeParameter.Param1);
int opcode = ReadByte();
ResType type = ResType.Invalid;
if (0 <= (opcode >> 4) && (opcode >> 4) < resTypes.Length)
type = resTypes[opcode >> 4];
if ((opcode & 0x0f) == 0 || type == ResType.Invalid)
return;
// HACK V2 Maniac Mansion tries to load an invalid sound resource in demo script.
if (Game.GameId == GameId.Maniac && Game.Version == 2 && Slots[CurrentScript].Number == 9 && type == ResType.Sound && resid == 1)
return;
if ((opcode & 0x0f) == 1)
{
switch (type)
{
case ResType.Room:
ResourceManager.LoadRoom(resid);
break;
case ResType.Script:
ResourceManager.LoadScript(resid);
break;
case ResType.Costume:
ResourceManager.LoadCostume(resid);
break;
case ResType.Sound:
ResourceManager.LoadSound(Sound.MusicType, resid);
break;
}
}
else
{
// TODO: vs lock/unlock
// if (opcode & 1)
// _res.lock(type, resid);
// else
// _res.unlock(type, resid);
}
}