assets loaded by bank id instead of name
This commit is contained in:
@@ -135,7 +135,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
Ok(())
|
||||
}
|
||||
Syscall::GfxSetSprite => {
|
||||
let asset_name = expect_string(args, 0, "asset_name")?;
|
||||
let bank_id = expect_int(args, 0)? as u8;
|
||||
let index = expect_int(args, 1)? as usize;
|
||||
let x = expect_int(args, 2)? as i32;
|
||||
let y = expect_int(args, 3)? as i32;
|
||||
@@ -154,10 +154,6 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
ret.push_int(GfxOpStatus::ArgRangeInvalid as i64);
|
||||
return Ok(());
|
||||
}
|
||||
let Some(bank_id) = hw.assets().find_slot_by_name(&asset_name, BankType::TILES) else {
|
||||
ret.push_int(GfxOpStatus::AssetNotFound as i64);
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
*hw.gfx_mut().sprite_mut(index) = Sprite {
|
||||
tile: Tile { id: tile_id, flip_x: false, flip_y: false, palette_id },
|
||||
@@ -225,7 +221,7 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
Ok(())
|
||||
}
|
||||
Syscall::AudioPlay => {
|
||||
let asset_name = expect_string(args, 0, "asset_name")?;
|
||||
let bank_id = expect_int(args, 0)? as u8;
|
||||
let sample_id_raw = expect_int(args, 1)?;
|
||||
let voice_id_raw = expect_int(args, 2)?;
|
||||
let volume_raw = expect_int(args, 3)?;
|
||||
@@ -252,10 +248,6 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let Some(bank_id) = hw.assets().find_slot_by_name(&asset_name, BankType::SOUNDS) else {
|
||||
ret.push_int(AudioOpStatus::AssetNotFound as i64);
|
||||
return Ok(());
|
||||
};
|
||||
let status = hw.audio_mut().play(
|
||||
bank_id,
|
||||
sample_id_raw as u16,
|
||||
|
||||
Reference in New Issue
Block a user