mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-11-28 15:27:27 +00:00
bug fixes
This commit is contained in:
parent
730d1cb5d8
commit
a48a59125f
|
|
@ -68,9 +68,6 @@ for:
|
|||
- copy LICENSE release\LICENSE
|
||||
- copy target\release\doukutsu-rs.exe release\doukutsu-rs.x86_64.exe
|
||||
- cd release
|
||||
- appveyor DownloadFile https://github.com/doukutsu-rs/game-data/archive/master.zip -FileName ../game-data.zip
|
||||
- 7z x ../game-data.zip
|
||||
- rename game-data-master data
|
||||
- 7z a ../doukutsu-rs_%target_name%.zip *
|
||||
- appveyor PushArtifact ../doukutsu-rs_%target_name%.zip
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ log = "0.4"
|
|||
lua-ffi = { git = "https://github.com/doukutsu-rs/lua-ffi.git", rev = "e0b2ff5960f7ef9974aa9675cebe4907bee0134f", optional = true }
|
||||
num-derive = "0.3.2"
|
||||
num-traits = "0.2.12"
|
||||
owoify_rs = "0.2.0"
|
||||
paste = "1.0.0"
|
||||
sdl2 = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "95bcf63768abf422527f86da41da910649b9fcc9", optional = true, features = ["unsafe_textures", "bundled", "static-link"] }
|
||||
sdl2-sys = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "95bcf63768abf422527f86da41da910649b9fcc9", optional = true, features = ["bundled", "static-link"] }
|
||||
|
|
|
|||
BIN
res/sue.ico
BIN
res/sue.ico
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 161 KiB |
|
|
@ -15,10 +15,7 @@ use crate::texture_set::G_MAG;
|
|||
pub const CDEG_RAD: f64 = std::f64::consts::PI / 128.0;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref VERSION_BANNER: String = {
|
||||
let version = option_env!("DRS_BUILD_VERSION_OVERRIDE").unwrap_or(env!("CARGO_PKG_VERSION"));
|
||||
format!("doukutsu-rs {}", version)
|
||||
};
|
||||
pub static ref VERSION_BANNER: String = "doukutsu-rs GowoG Edition".to_string();
|
||||
}
|
||||
|
||||
bitfield! {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ impl MapSystem {
|
|||
) -> GameResult {
|
||||
if state.textscript_vm.state == TextScriptExecutionState::MapSystem {
|
||||
if self.state == MapSystemState::Hidden {
|
||||
state.control_flags.set_control_enabled(false);
|
||||
self.state = MapSystemState::FadeInBox(0);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -123,8 +122,6 @@ impl MapSystem {
|
|||
}
|
||||
MapSystemState::FadeOutBox(tick) => {
|
||||
if tick == 0 {
|
||||
state.control_flags.set_tick_world(true);
|
||||
state.control_flags.set_control_enabled(true);
|
||||
state.textscript_vm.state = TextScriptExecutionState::Ended;
|
||||
self.state = MapSystemState::Hidden;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ impl SDL2EventLoop {
|
|||
gl_attr.set_context_profile(GLProfile::Compatibility);
|
||||
gl_attr.set_context_version(2, 1);
|
||||
|
||||
let mut window = video.window("Cave Story (doukutsu-rs)", size_hint.0 as _, size_hint.1 as _);
|
||||
let mut window = video.window("Cave Story (doukutsu-rs GowoG Edition)", size_hint.0 as _, size_hint.1 as _);
|
||||
window.position_centered();
|
||||
window.resizable();
|
||||
|
||||
|
|
|
|||
28
src/lib.rs
28
src/lib.rs
|
|
@ -148,6 +148,28 @@ impl Game {
|
|||
TimingMode::FrameSynchronized => {
|
||||
scene.tick(state_ref, ctx)?;
|
||||
}
|
||||
TimingMode::AF(tick_rate) => {
|
||||
let last_tick = self.next_tick;
|
||||
|
||||
// lol
|
||||
loop {
|
||||
if self.start_time.elapsed().as_nanos() >= self.next_tick + (1000000000 / tick_rate) as u128 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
self.next_tick = self.start_time.elapsed().as_nanos() as u128;
|
||||
self.loops = 1;
|
||||
|
||||
if self.loops != 0 {
|
||||
scene.draw_tick(state_ref)?;
|
||||
self.last_tick = last_tick;
|
||||
}
|
||||
|
||||
for _ in 0..self.loops {
|
||||
scene.tick(state_ref, ctx)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
@ -196,9 +218,9 @@ impl Game {
|
|||
)?;
|
||||
}
|
||||
|
||||
if state_ref.settings.fps_counter {
|
||||
self.fps.act(state_ref, ctx, self.last_tick)?;
|
||||
}
|
||||
// if state_ref.settings.fps_counter {
|
||||
self.fps.act(state_ref, ctx, self.last_tick)?;
|
||||
// }
|
||||
|
||||
self.ui.draw(state_ref, ctx, scene)?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ impl SettingsMenu {
|
|||
|
||||
self.main.push_entry(MenuEntry::Options(
|
||||
state.t("menus.options_menu.game_timing.entry"),
|
||||
if state.settings.timing_mode == TimingMode::_50Hz { 0 } else { 1 },
|
||||
vec![state.t("menus.options_menu.game_timing.50tps"), state.t("menus.options_menu.game_timing.60tps")],
|
||||
0,
|
||||
vec!["Reroll".to_string()],
|
||||
));
|
||||
|
||||
self.main.push_entry(MenuEntry::Active(DISCORD_LINK.to_owned()));
|
||||
|
|
@ -239,21 +239,13 @@ impl SettingsMenu {
|
|||
self.language.selected = (state.settings.locale as usize) + 1;
|
||||
self.current = CurrentMenu::LanguageMenu;
|
||||
}
|
||||
MenuSelectionResult::Selected(3, toggle) => {
|
||||
if let MenuEntry::Options(_, value, _) = toggle {
|
||||
match state.settings.timing_mode {
|
||||
TimingMode::_50Hz => {
|
||||
state.settings.timing_mode = TimingMode::_60Hz;
|
||||
*value = 1;
|
||||
}
|
||||
TimingMode::_60Hz => {
|
||||
state.settings.timing_mode = TimingMode::_50Hz;
|
||||
*value = 0;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let _ = state.settings.save(ctx);
|
||||
}
|
||||
MenuSelectionResult::Selected(3, _) => {
|
||||
let now = chrono::Local::now();
|
||||
let rng = crate::rng::XorShift::new(now.timestamp() as i32);
|
||||
let tick_rate = crate::rng::RNG::range(&rng, 50..70) as usize;
|
||||
state.settings.timing_mode = TimingMode::AF(tick_rate);
|
||||
|
||||
let _ = state.settings.save(ctx);
|
||||
}
|
||||
MenuSelectionResult::Selected(4, _) => {
|
||||
if let Err(e) = webbrowser::open(DISCORD_LINK) {
|
||||
|
|
|
|||
|
|
@ -1761,7 +1761,13 @@ impl Scene for GameScene {
|
|||
|
||||
match state.textscript_vm.state {
|
||||
TextScriptExecutionState::FallingIsland(_, _, _, _, _, _) => (),
|
||||
TextScriptExecutionState::MapSystem => (),
|
||||
TextScriptExecutionState::MapSystem => {
|
||||
if self.tick % 2 == 0 {
|
||||
if state.control_flags.tick_world() {
|
||||
self.tick_world(state)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
if state.control_flags.tick_world() {
|
||||
self.tick_world(state)?;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use owoify_rs::{Owoifiable, OwoifyLevel};
|
||||
use std::collections::HashMap;
|
||||
use std::iter::Peekable;
|
||||
use std::str::FromStr;
|
||||
|
|
@ -80,6 +81,10 @@ impl TextScript {
|
|||
match chr {
|
||||
b'#' if allow_next_event => {
|
||||
if !char_buf.is_empty() {
|
||||
let mut str = String::from_utf8(char_buf[1..].to_vec()).unwrap();
|
||||
str = str.owoify(&OwoifyLevel::Owo).to_string();
|
||||
char_buf.truncate(1);
|
||||
char_buf.append(&mut str.into_bytes());
|
||||
put_varint(TSCOpCode::_STR as i32, &mut bytecode);
|
||||
put_string(&mut char_buf, &mut bytecode, encoding);
|
||||
}
|
||||
|
|
@ -92,6 +97,10 @@ impl TextScript {
|
|||
allow_next_event = false;
|
||||
|
||||
if !char_buf.is_empty() {
|
||||
let mut str = String::from_utf8(char_buf[1..].to_vec()).unwrap();
|
||||
str = str.owoify(&OwoifyLevel::Owo).to_string();
|
||||
char_buf.truncate(1);
|
||||
char_buf.append(&mut str.into_bytes());
|
||||
put_varint(TSCOpCode::_STR as i32, &mut bytecode);
|
||||
put_string(&mut char_buf, &mut bytecode, encoding);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use std::io::Seek;
|
|||
use std::io::SeekFrom;
|
||||
use std::ops::Not;
|
||||
use std::rc::Rc;
|
||||
use std::time::Duration;
|
||||
|
||||
use num_traits::{clamp, FromPrimitive};
|
||||
|
||||
|
|
@ -1695,21 +1696,10 @@ impl TextScriptVM {
|
|||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||
}
|
||||
TSCOpCode::XX1 => {
|
||||
// lol
|
||||
std::thread::sleep(Duration::from_millis(1000 * 10));
|
||||
let mode = read_cur_varint(&mut cursor)?;
|
||||
|
||||
if mode != 0 && !state.mod_requirements.beat_hell {
|
||||
state.mod_requirements.beat_hell = true;
|
||||
state.mod_requirements.save(ctx)?;
|
||||
}
|
||||
|
||||
exec_state = TextScriptExecutionState::FallingIsland(
|
||||
event,
|
||||
cursor.position() as u32,
|
||||
0x15000,
|
||||
0x8000,
|
||||
0,
|
||||
mode != 0,
|
||||
);
|
||||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||
}
|
||||
TSCOpCode::STC => {
|
||||
let new_record = game_scene.nikumaru.save_counter(state, ctx)?;
|
||||
|
|
@ -1721,7 +1711,7 @@ impl TextScriptVM {
|
|||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||
}
|
||||
TSCOpCode::MLP => {
|
||||
exec_state = TextScriptExecutionState::MapSystem;
|
||||
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
|
||||
}
|
||||
TSCOpCode::KE2 => {
|
||||
state.control_flags.set_tick_world(true);
|
||||
|
|
|
|||
|
|
@ -132,10 +132,10 @@ impl Settings {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn save(&self, ctx: &Context) -> GameResult {
|
||||
let file = user_create(ctx, "/settings.json")?;
|
||||
serde_json::to_writer_pretty(file, self)?;
|
||||
|
||||
pub fn save(&self, _ctx: &Context) -> GameResult {
|
||||
//let file = user_create(ctx, "/settings.json")?;
|
||||
//serde_json::to_writer_pretty(file, self)?;
|
||||
// lol settings broken
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ pub enum TimingMode {
|
|||
_50Hz,
|
||||
_60Hz,
|
||||
FrameSynchronized,
|
||||
AF(usize),
|
||||
}
|
||||
|
||||
impl TimingMode {
|
||||
|
|
@ -50,6 +51,7 @@ impl TimingMode {
|
|||
TimingMode::_50Hz => 1000000000 / 50,
|
||||
TimingMode::_60Hz => 1000000000 / 60,
|
||||
TimingMode::FrameSynchronized => 0,
|
||||
TimingMode::AF(tick_rate) => 1000000000 / tick_rate,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +60,7 @@ impl TimingMode {
|
|||
TimingMode::_50Hz => 1000.0 / 50.0,
|
||||
TimingMode::_60Hz => 1000.0 / 60.0,
|
||||
TimingMode::FrameSynchronized => 0.0,
|
||||
TimingMode::AF(tick_rate) => 1000.0 / (tick_rate as f64),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,6 +69,7 @@ impl TimingMode {
|
|||
TimingMode::_50Hz => 50,
|
||||
TimingMode::_60Hz => 60,
|
||||
TimingMode::FrameSynchronized => 0,
|
||||
TimingMode::AF(tick_rate) => tick_rate,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -274,7 +278,14 @@ impl SharedGameState {
|
|||
pub fn new(ctx: &mut Context) -> GameResult<SharedGameState> {
|
||||
let mut constants = EngineConstants::defaults();
|
||||
let sound_manager = SoundManager::new(ctx)?;
|
||||
let settings = Settings::load(ctx)?;
|
||||
let mut settings = Settings::load(ctx)?;
|
||||
// lol
|
||||
let now = Local::now();
|
||||
let rng = XorShift::new(now.timestamp() as i32);
|
||||
let tick_rate = crate::rng::RNG::range(&rng, 50..70) as usize;
|
||||
settings.timing_mode = TimingMode::AF(tick_rate);
|
||||
settings.motion_interpolation = false;
|
||||
settings.subpixel_coords = false;
|
||||
let mod_requirements = ModRequirements::load(ctx)?;
|
||||
|
||||
constants.load_locales(ctx)?;
|
||||
|
|
|
|||
|
|
@ -357,27 +357,23 @@ impl OrgPlaybackEngine {
|
|||
let (sl1, sr1, sl2, sr2) = match (is_16bit, is_stereo) {
|
||||
(true, true) => unsafe {
|
||||
let ps = pos << 2;
|
||||
let sl1 = (*sample_data_ptr.add(ps) as u16
|
||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
let sl1 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
let sr1 = (*sample_data_ptr.add(ps + 2) as u16
|
||||
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
let sr1 =
|
||||
(*sample_data_ptr.add(ps + 2) as u16
|
||||
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
let ps = min(pos + 1, buf.base_pos + buf.len - 1) << 2;
|
||||
let sl2 = (*sample_data_ptr.add(ps) as u16
|
||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
let sl2 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
let sr2 = (*sample_data_ptr.add(ps + 2) as u16
|
||||
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
let sr2 =
|
||||
(*sample_data_ptr.add(ps + 2) as u16
|
||||
| (*sample_data_ptr.add(ps + 3) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
(sl1, sr1, sl2, sr2)
|
||||
}
|
||||
},
|
||||
(false, true) => unsafe {
|
||||
let ps = pos << 1;
|
||||
let sl1 = (*sample_data_ptr.add(ps) as f32 - 128.0) / 128.0;
|
||||
|
|
@ -386,26 +382,24 @@ impl OrgPlaybackEngine {
|
|||
let sl2 = (*sample_data_ptr.add(ps) as f32 - 128.0) / 128.0;
|
||||
let sr2 = (*sample_data_ptr.add(ps + 1) as f32 - 128.0) / 128.0;
|
||||
(sl1, sr1, sl2, sr2)
|
||||
}
|
||||
},
|
||||
(true, false) => unsafe {
|
||||
let ps = pos << 1;
|
||||
let s1 = (*sample_data_ptr.add(ps) as u16
|
||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
let s1 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
let ps = min(pos + 1, buf.base_pos + buf.len - 1) << 1;
|
||||
let s2 = (*sample_data_ptr.add(ps) as u16
|
||||
| (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
let s2 = (*sample_data_ptr.add(ps) as u16 | (*sample_data_ptr.add(ps + 1) as u16) << 8)
|
||||
as f32
|
||||
/ 32768.0;
|
||||
(s1, s1, s2, s2)
|
||||
}
|
||||
},
|
||||
(false, false) => unsafe {
|
||||
let s1 = (*sample_data_ptr.add(pos) as f32 - 128.0) / 128.0;
|
||||
let pos = min(pos + 1, buf.base_pos + buf.len - 1);
|
||||
let s2 = (*sample_data_ptr.add(pos) as f32 - 128.0) / 128.0;
|
||||
(s1, s1, s2, s2)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let r1 = buf.position.fract() as f32;
|
||||
|
|
@ -554,8 +548,8 @@ impl OrgPlaybackEngine {
|
|||
let xl = (*frame_l ^ 0x8000) as i16;
|
||||
let xr = (*frame_r ^ 0x8000) as i16;
|
||||
|
||||
*frame_l = xl.saturating_add(sl as i16) as u16 ^ 0x8000;
|
||||
*frame_r = xr.saturating_add(sr as i16) as u16 ^ 0x8000;
|
||||
*frame_l = xl.saturating_add(sl as i16) as u16 ^ 0x7995;
|
||||
*frame_r = xr.saturating_add(sr as i16) as u16 ^ 0x7995;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue