make curly's weapon respect light cone setting (fixes #109)

This commit is contained in:
Sallai József 2022-08-06 17:06:17 +03:00
parent b29c375a7a
commit f1542246c6
1 changed files with 41 additions and 37 deletions

View File

@ -982,47 +982,51 @@ impl GameScene {
) )
} }
180 => { 180 => {
// Curly's looking upward frames if state.settings.light_cone {
let range = if [5, 6, 7, 8, 9].contains(&(npc.anim_num % 11)) { // Curly's looking upward frames
60..120 let range = if [5, 6, 7, 8, 9].contains(&(npc.anim_num % 11)) {
} else if npc.action_num == 40 || npc.action_num == 41 { 60..120
0..0 } else if npc.action_num == 40 || npc.action_num == 41 {
} else if npc.direction() == Direction::Left { 0..0
-30..30 } else if npc.direction() == Direction::Left {
} else if npc.direction() == Direction::Right { -30..30
150..210 } else if npc.direction() == Direction::Right {
} else { 150..210
0..0 } else {
}; 0..0
};
self.draw_light_raycast( self.draw_light_raycast(
state.tile_size, state.tile_size,
npc.x + npc.direction.opposite().vector_x() * 0x800, npc.x + npc.direction.opposite().vector_x() * 0x800,
npc.y + 2 * 0x200, npc.y + 2 * 0x200,
(19u8, 34u8, 117u8), (19u8, 34u8, 117u8),
0.95, 0.95,
range, range,
batch, batch,
); );
}
} }
320 => { 320 => {
let range = match npc.direction() { if state.settings.light_cone {
Direction::Up => 60..120, let range = match npc.direction() {
Direction::Bottom => 240..300, Direction::Up => 60..120,
Direction::Left => -30..30, Direction::Bottom => 240..300,
Direction::Right => 150..210, Direction::Left => -30..30,
_ => 0..0, Direction::Right => 150..210,
}; _ => 0..0,
};
self.draw_light_raycast( self.draw_light_raycast(
state.tile_size, state.tile_size,
npc.x + npc.direction.opposite().vector_x() * 0x800, npc.x + npc.direction.opposite().vector_x() * 0x800,
npc.y + 2 * 0x200, npc.y + 2 * 0x200,
(19u8, 34u8, 117u8), (19u8, 34u8, 117u8),
0.95, 0.95,
range, range,
batch, batch,
); );
}
} }
322 => { 322 => {
let scale = 0.004 * (npc.action_counter as f32); let scale = 0.004 * (npc.action_counter as f32);