mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-12-08 05:05:40 +00:00
Improve background colors
Background color is now set inside of engine_constants/mod.rs, and can be changed on a port-to-port basis, including intro background color.
This commit is contained in:
parent
2f73066d12
commit
13e09e8679
|
|
@ -42,7 +42,7 @@ impl GameEntity<()> for Credits {
|
|||
|
||||
fn draw(&self, state: &mut SharedGameState, ctx: &mut Context, _frame: &Frame) -> GameResult {
|
||||
let rect = Rect::new(0, 0, (state.screen_size.0 / 2.0) as _, state.screen_size.1 as _);
|
||||
graphics::draw_rect(ctx, rect, Color::from_rgb(0, 0, 32))?;
|
||||
graphics::draw_rect(ctx, rect, state.constants.background_color)?;
|
||||
|
||||
if state.textscript_vm.illustration_state != IllustrationState::Hidden {
|
||||
let x = match state.textscript_vm.illustration_state {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ impl GameEntity<()> for FallingIsland {
|
|||
(80.0 * state.scale) as _,
|
||||
);
|
||||
|
||||
graphics::clear(ctx, Color::from_rgb(0, 0, 32));
|
||||
graphics::clear(ctx, state.constants.intro_background_color);
|
||||
graphics::set_clip_rect(ctx, Some(clip_rect))?;
|
||||
|
||||
static RECT_BG: Rect<u16> = Rect { left: 0, top: 0, right: 160, bottom: 80 };
|
||||
|
|
|
|||
|
|
@ -265,6 +265,8 @@ pub struct EngineConstants {
|
|||
pub textscript: TextScriptConsts,
|
||||
pub title: TitleConsts,
|
||||
pub inventory_dim_color: Color,
|
||||
pub background_color: Color,
|
||||
pub intro_background_color: Color,
|
||||
pub font_path: String,
|
||||
pub font_space_offset: f32,
|
||||
pub soundtracks: Vec<ExtraSoundtrack>,
|
||||
|
|
@ -1506,6 +1508,8 @@ impl EngineConstants {
|
|||
],
|
||||
},
|
||||
inventory_dim_color: Color::from_rgba(0, 0, 0, 0),
|
||||
background_color: Color::from_rgb(0, 0, 32),
|
||||
intro_background_color: Color::from_rgb(0, 0, 0),
|
||||
font_path: "csfont.fnt".to_owned(),
|
||||
font_space_offset: 0.0,
|
||||
soundtracks: vec![
|
||||
|
|
@ -1682,6 +1686,7 @@ impl EngineConstants {
|
|||
self.tex_sizes.insert("uimusic".to_owned(), (192, 144));
|
||||
self.title.logo_rect = Rect { left: 0, top: 0, right: 214, bottom: 62 };
|
||||
self.inventory_dim_color = Color::from_rgba(0, 0, 32, 150);
|
||||
self.intro_background_color = Color::from_rgb(0, 0, 32);
|
||||
self.textscript.encoding = TextScriptEncoding::UTF8;
|
||||
self.textscript.encrypted = false;
|
||||
self.textscript.animated_face_pics = true;
|
||||
|
|
|
|||
|
|
@ -509,10 +509,8 @@ impl SharedGameState {
|
|||
|
||||
pub fn reload_stage_table(&mut self, ctx: &mut Context) -> GameResult {
|
||||
let stages = StageData::load_stage_table(
|
||||
self,
|
||||
ctx,
|
||||
&self.constants.base_paths,
|
||||
self.constants.is_switch,
|
||||
self.constants.stage_encoding,
|
||||
)?;
|
||||
self.stages = stages;
|
||||
Ok(())
|
||||
|
|
@ -654,7 +652,7 @@ impl SharedGameState {
|
|||
}
|
||||
|
||||
let mut next_scene = GameScene::new(self, ctx, start_stage_id)?;
|
||||
next_scene.stage.data.background_color = Color::from_rgb(0, 0, 0);
|
||||
next_scene.stage.data.background_color = self.constants.intro_background_color;
|
||||
next_scene.player1.cond.set_hidden(true);
|
||||
let (pos_x, pos_y) = self.constants.game.intro_player_pos;
|
||||
next_scene.player1.x = pos_x as i32 * next_scene.stage.map.tile_size.as_int() * 0x200;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use crate::framework::error::{GameError, GameResult};
|
|||
use crate::framework::filesystem;
|
||||
use crate::game::map::{Map, NPCData};
|
||||
use crate::game::scripting::tsc::text_script::{TextScript, TextScriptEncoding};
|
||||
use crate::game::SharedGameState;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||
pub struct NpcType {
|
||||
|
|
@ -251,11 +252,14 @@ fn from_csplus_stagetbl(s: &[u8], is_switch: bool, encoding: Option<TextScriptEn
|
|||
|
||||
impl StageData {
|
||||
pub fn load_stage_table(
|
||||
state: &SharedGameState,
|
||||
ctx: &mut Context,
|
||||
roots: &Vec<String>,
|
||||
is_switch: bool,
|
||||
encoding: Option<TextScriptEncoding>,
|
||||
) -> GameResult<Vec<Self>> {
|
||||
|
||||
let roots = &state.constants.base_paths;
|
||||
let is_switch = state.constants.is_switch;
|
||||
let encoding = state.constants.stage_encoding;
|
||||
|
||||
let stage_tbl_path = "/stage.tbl";
|
||||
let stage_sect_path = "/stage.sect";
|
||||
let mrmap_bin_path = "/mrmap.bin";
|
||||
|
|
@ -314,7 +318,7 @@ impl StageData {
|
|||
pxpack_data: None,
|
||||
background: Background::new(&background),
|
||||
background_type: BackgroundType::from(bg_type),
|
||||
background_color: Color::from_rgb(0, 0, 32),
|
||||
background_color: state.constants.background_color,
|
||||
npc1: NpcType::new(&npc1),
|
||||
npc2: NpcType::new(&npc2),
|
||||
};
|
||||
|
|
@ -379,7 +383,7 @@ impl StageData {
|
|||
pxpack_data: None,
|
||||
background: Background::new(&background),
|
||||
background_type: BackgroundType::from(bg_type),
|
||||
background_color: Color::from_rgb(0, 0, 32),
|
||||
background_color: state.constants.background_color,
|
||||
npc1: NpcType::new(&npc1),
|
||||
npc2: NpcType::new(&npc2),
|
||||
};
|
||||
|
|
@ -438,7 +442,7 @@ impl StageData {
|
|||
pxpack_data: None,
|
||||
background: Background::new(&background),
|
||||
background_type: BackgroundType::from(bg_type),
|
||||
background_color: Color::from_rgb(0, 0, 32),
|
||||
background_color: state.constants.background_color,
|
||||
npc1: NpcType::new(&npc1),
|
||||
npc2: NpcType::new(&npc2),
|
||||
};
|
||||
|
|
@ -495,7 +499,7 @@ impl StageData {
|
|||
pxpack_data: None,
|
||||
background: Background::new(NXENGINE_BACKDROPS.get(bg_id).unwrap_or(&"0")),
|
||||
background_type: BackgroundType::from(bg_type),
|
||||
background_color: Color::from_rgb(0, 0, 32),
|
||||
background_color: state.constants.background_color,
|
||||
npc1: NpcType::new(NXENGINE_NPCS.get(npc1).unwrap_or(&"0")),
|
||||
npc2: NpcType::new(NXENGINE_NPCS.get(npc2).unwrap_or(&"0")),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2221,7 +2221,7 @@ impl Scene for GameScene {
|
|||
((10.0 + line_height) * state.scale) as isize,
|
||||
);
|
||||
|
||||
draw_rect(ctx, rect, Color::from_rgb(0, 0, 32))?;
|
||||
draw_rect(ctx, rect, state.constants.background_color)?;
|
||||
|
||||
rect.right = rect.left + (w * state.scale) as isize;
|
||||
draw_rect(ctx, rect, Color::from_rgb(128, 128, 160))?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue