1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-05-20 22:01:56 +00:00

Difficulty changes Quote NPC and original graphics sprites

This commit is contained in:
dawnDus 2022-02-28 21:45:43 -05:00
parent 7a580fdf44
commit 4055fef911
No known key found for this signature in database
GPG key ID: 972AABDE81848F21
4 changed files with 34 additions and 12 deletions

View file

@ -436,7 +436,7 @@ impl Menu {
)?;
// Difficulty
if state.constants.is_cs_plus && !state.settings.original_textures {
if state.constants.is_cs_plus {
let difficulty = GameDifficulty::from_primitive(save.difficulty);
let batch = state.texture_set.get_or_load_batch(ctx, &state.constants, "MyChar")?;

View file

@ -2573,7 +2573,14 @@ impl NPC {
}
}
let quote_offset = if self.spritesheet_id == 16 {
state.get_skinsheet_offset() * state.tile_size.as_int() as u16 * 2
} else {
0
};
self.anim_rect = state.constants.npc.n355_quote_and_curly_on_balrog[self.anim_num as usize];
self.anim_rect.top += quote_offset;
self.anim_rect.bottom += quote_offset;
Ok(())
}

View file

@ -8,7 +8,11 @@ use crate::rng::RNG;
use crate::shared_game_state::SharedGameState;
impl NPC {
pub fn tick_n111_quote_teleport_out(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
pub fn tick_n111_quote_teleport_out(
&mut self,
state: &mut SharedGameState,
players: [&mut Player; 2],
) -> GameResult {
match self.action_num {
0 => {
self.action_num = 1;
@ -61,7 +65,8 @@ impl NPC {
let dir_offset = if self.direction == Direction::Left { 0 } else { 2 };
self.anim_rect = state.constants.npc.n111_quote_teleport_out[self.anim_num as usize + dir_offset];
let offset = players[state.textscript_vm.executor_player.index()].get_texture_offset();
let offset = players[state.textscript_vm.executor_player.index()].get_texture_offset()
+ (state.get_skinsheet_offset() * state.tile_size.as_int() as u16 * 2);
self.anim_rect.top += offset;
self.anim_rect.bottom += offset;
@ -76,7 +81,11 @@ impl NPC {
Ok(())
}
pub fn tick_n112_quote_teleport_in(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
pub fn tick_n112_quote_teleport_in(
&mut self,
state: &mut SharedGameState,
players: [&mut Player; 2],
) -> GameResult {
match self.action_num {
0 => {
self.action_num = 1;
@ -118,7 +127,8 @@ impl NPC {
let dir_offset = if self.direction == Direction::Left { 0 } else { 2 };
self.anim_rect = state.constants.npc.n111_quote_teleport_out[self.anim_num as usize + dir_offset];
let offset = players[state.textscript_vm.executor_player.index()].get_texture_offset();
let offset = players[state.textscript_vm.executor_player.index()].get_texture_offset()
+ (state.get_skinsheet_offset() * state.tile_size.as_int() as u16 * 2);
self.anim_rect.top += offset;
self.anim_rect.bottom += offset;
@ -133,7 +143,12 @@ impl NPC {
Ok(())
}
pub(crate) fn tick_n150_quote(&mut self, state: &mut SharedGameState, players: [&mut Player; 2], npc_list: &NPCList) -> GameResult {
pub(crate) fn tick_n150_quote(
&mut self,
state: &mut SharedGameState,
players: [&mut Player; 2],
npc_list: &NPCList,
) -> GameResult {
match self.action_num {
0 => {
self.action_num = 1;
@ -144,11 +159,10 @@ impl NPC {
self.x = player.x;
self.y = player.y;
self.direction = Direction::from_int(self.tsc_direction.saturating_sub(10) as usize)
.unwrap_or(Direction::Left);
self.direction =
Direction::from_int(self.tsc_direction.saturating_sub(10) as usize).unwrap_or(Direction::Left);
} else {
self.direction = Direction::from_int(self.tsc_direction as usize)
.unwrap_or(Direction::Left);
self.direction = Direction::from_int(self.tsc_direction as usize).unwrap_or(Direction::Left);
}
}
2 => {
@ -280,7 +294,8 @@ impl NPC {
self.anim_rect.bottom = self.anim_rect.top + self.action_counter / 4;
}
let offset = players[state.textscript_vm.executor_player.index()].get_texture_offset();
let offset = players[state.textscript_vm.executor_player.index()].get_texture_offset()
+ (state.get_skinsheet_offset() * state.tile_size.as_int() as u16 * 2);
self.anim_rect.top += offset;
self.anim_rect.bottom += offset;

View file

@ -608,7 +608,7 @@ impl SharedGameState {
}
pub fn get_skinsheet_offset(&self) -> u16 {
if !self.constants.is_cs_plus || self.settings.original_textures {
if !self.constants.is_cs_plus {
return 0;
}