mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-01-10 13:07:17 +00:00
add <SMP
This commit is contained in:
parent
8d0ad30e09
commit
8050beed56
10
src/stage.rs
10
src/stage.rs
|
@ -454,7 +454,15 @@ impl Stage {
|
|||
Ok(npc_data)
|
||||
}
|
||||
|
||||
/// Returns true if smoke should be emitted
|
||||
pub fn tile_at(&self, x: usize, y: usize) -> u8 {
|
||||
if let Some(&tile) = self.map.tiles.get(y * self.map.width + x) {
|
||||
tile
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
/// Changes map tile. Returns true if smoke should be emitted
|
||||
pub fn change_tile(&mut self, x: usize, y: usize, tile_type: u8) -> bool {
|
||||
if let Some(ptr) = self.map.tiles.get_mut(y * self.map.width + x) {
|
||||
if *ptr != tile_type {
|
||||
|
|
|
@ -891,6 +891,15 @@ impl TextScriptVM {
|
|||
|
||||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||
}
|
||||
OpCode::SMP => {
|
||||
let pos_x = read_cur_varint(&mut cursor)? as usize;
|
||||
let pos_y = read_cur_varint(&mut cursor)? as usize;
|
||||
|
||||
let tile_type = game_scene.stage.tile_at(pos_x, pos_y);
|
||||
game_scene.stage.change_tile(pos_x, pos_y, tile_type.wrapping_sub(1));
|
||||
|
||||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||
}
|
||||
OpCode::CMP => {
|
||||
let pos_x = read_cur_varint(&mut cursor)? as usize;
|
||||
let pos_y = read_cur_varint(&mut cursor)? as usize;
|
||||
|
@ -1387,7 +1396,7 @@ impl TextScriptVM {
|
|||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||
}
|
||||
// Two operand codes
|
||||
OpCode::SKJ | OpCode::SMP => {
|
||||
OpCode::SKJ => {
|
||||
let par_a = read_cur_varint(&mut cursor)?;
|
||||
let par_b = read_cur_varint(&mut cursor)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue