mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-21 21:22:44 +00:00
no more april fools
This commit is contained in:
parent
5f7bae8f4f
commit
beb290dafb
|
@ -172,8 +172,7 @@ impl SDL2EventLoop {
|
|||
gl_attr.set_context_profile(GLProfile::Compatibility);
|
||||
gl_attr.set_context_version(2, 1);
|
||||
|
||||
|
||||
let mut win_builder = video.window("(sr-ustukuod) yrotS evaR", size_hint.0 as _, size_hint.1 as _);
|
||||
let mut win_builder = video.window("Cave Story (doukutsu-rs)", size_hint.0 as _, size_hint.1 as _);
|
||||
win_builder.position_centered();
|
||||
win_builder.resizable();
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ use std::mem;
|
|||
use std::mem::MaybeUninit;
|
||||
use std::ptr::null;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
|
||||
use imgui::{DrawCmd, DrawCmdParams, DrawData, DrawIdx, DrawVert, TextureId, Ui};
|
||||
|
||||
|
@ -22,8 +21,6 @@ use crate::framework::graphics::{BlendMode, VSyncMode};
|
|||
use crate::framework::util::{field_offset, return_param};
|
||||
use crate::game::GAME_SUSPENDED;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
pub struct GLContext {
|
||||
pub gles2_mode: bool,
|
||||
pub is_sdl: bool,
|
||||
|
@ -44,10 +41,6 @@ pub struct OpenGLTexture {
|
|||
context_active: Arc<RefCell<bool>>,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref INSTANT: Instant = Instant::now();
|
||||
}
|
||||
|
||||
impl BackendTexture for OpenGLTexture {
|
||||
fn dimensions(&self) -> (u16, u16) {
|
||||
(self.width, self.height)
|
||||
|
@ -239,9 +232,6 @@ impl BackendTexture for OpenGLTexture {
|
|||
gl.gl.Disable(gl::DEPTH_TEST);
|
||||
|
||||
self.shader.bind_attrib_pointer(gl, self.vbo);
|
||||
|
||||
let t = Instant::now().duration_since(*INSTANT).as_millis() as f32 / 1000.0;
|
||||
gl.gl.Uniform1f(self.shader.time, t);
|
||||
|
||||
gl.gl.BindTexture(gl::TEXTURE_2D, self.texture_id);
|
||||
gl.gl.BufferData(
|
||||
|
@ -669,12 +659,12 @@ impl BackendRenderer for OpenGLRenderer {
|
|||
|
||||
let color = (255, 255, 255, 255);
|
||||
let vertices = [
|
||||
VertexData { position: (0.0, 1.0), uv: (1.0, 0.0), color },
|
||||
VertexData { position: (0.0, 0.0), uv: (1.0, 1.0), color },
|
||||
VertexData { position: (1.0, 0.0), uv: (0.0, 1.0), color },
|
||||
VertexData { position: (0.0, 1.0), uv: (1.0, 0.0), color },
|
||||
VertexData { position: (1.0, 0.0), uv: (0.0, 1.0), color },
|
||||
VertexData { position: (1.0, 1.0), uv: (0.0, 0.0), color },
|
||||
VertexData { position: (0.0, 1.0), uv: (0.0, 0.0), color },
|
||||
VertexData { position: (0.0, 0.0), uv: (0.0, 1.0), color },
|
||||
VertexData { position: (1.0, 0.0), uv: (1.0, 1.0), color },
|
||||
VertexData { position: (0.0, 1.0), uv: (0.0, 0.0), color },
|
||||
VertexData { position: (1.0, 0.0), uv: (1.0, 1.0), color },
|
||||
VertexData { position: (1.0, 1.0), uv: (1.0, 0.0), color },
|
||||
];
|
||||
|
||||
self.draw_arrays_tex_id(
|
||||
|
|
|
@ -1,32 +1,10 @@
|
|||
#version 110
|
||||
|
||||
uniform sampler2D Texture;
|
||||
uniform float Time;
|
||||
varying vec2 Frag_UV;
|
||||
varying vec4 Frag_Color;
|
||||
|
||||
vec3 rgb2hsv(vec3 c)
|
||||
{
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 1.0e-10;
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
vec3 hsv2rgb(vec3 c)
|
||||
{
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);
|
||||
vec3 col = rgb2hsv(gl_FragColor.rgb);
|
||||
col.r += Frag_UV.s + Frag_UV.t + Time * 0.1;
|
||||
gl_FragColor.rgb = hsv2rgb(col);
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ impl SharedGameState {
|
|||
sound_manager.set_sfx_volume(settings.sfx_volume);
|
||||
|
||||
let current_time = Local::now();
|
||||
let more_rust = true;
|
||||
let more_rust = (current_time.month() == 7 && current_time.day() == 7) || settings.more_rust;
|
||||
let seed = chrono::Local::now().timestamp() as i32;
|
||||
|
||||
let discord_rpc_app_id = match option_env!("DISCORD_RPC_APP_ID") {
|
||||
|
|
|
@ -257,7 +257,7 @@ impl BMFont {
|
|||
|
||||
fn draw_text_line(
|
||||
&self,
|
||||
iter: &mut dyn DoubleEndedIterator<Item = char>,
|
||||
iter: &mut dyn Iterator<Item = char>,
|
||||
x: f32,
|
||||
y: f32,
|
||||
scale: f32,
|
||||
|
@ -277,7 +277,7 @@ impl BMFont {
|
|||
let batch = texture_set.get_or_load_batch(ctx, constants, self.pages.get(0).unwrap())?;
|
||||
let mut offset_x = x;
|
||||
|
||||
for chr in iter.rev() {
|
||||
for chr in iter {
|
||||
if let Some(glyph) = self.font.chars.get(&chr) {
|
||||
let rect_map_entry = syms.symbols.iter().find(|(c, _)| *c == chr);
|
||||
|
||||
|
@ -290,10 +290,10 @@ impl BMFont {
|
|||
offset_x += rect.width() as f32;
|
||||
} else {
|
||||
batch.add_rect_scaled_tinted(
|
||||
offset_x + ((glyph.x_advance as f32 + glyph.x_offset as f32) * self.font_scale),
|
||||
offset_x + (glyph.x_offset as f32 * self.font_scale),
|
||||
y + (glyph.y_offset as f32 * self.font_scale),
|
||||
color,
|
||||
self.font_scale * -scale,
|
||||
self.font_scale * scale,
|
||||
self.font_scale * scale,
|
||||
&Rect::new_size(
|
||||
glyph.x as u16,
|
||||
|
@ -339,10 +339,10 @@ impl BMFont {
|
|||
} else {
|
||||
if glyph.page == page {
|
||||
batch.add_rect_scaled_tinted(
|
||||
offset_x + ((glyph.x_advance as f32 + glyph.x_offset as f32) * self.font_scale),
|
||||
offset_x + (glyph.x_offset as f32 * self.font_scale),
|
||||
y + (glyph.y_offset as f32 * self.font_scale),
|
||||
color,
|
||||
self.font_scale * -scale,
|
||||
self.font_scale * scale,
|
||||
self.font_scale * scale,
|
||||
&Rect::new_size(
|
||||
glyph.x as u16,
|
||||
|
|
|
@ -73,8 +73,8 @@ impl PlayerController for GamepadController {
|
|||
|
||||
self.state.set_up(gamepad::is_active(ctx, self.gamepad_id, &button_map.up));
|
||||
self.state.set_down(gamepad::is_active(ctx, self.gamepad_id, &button_map.down));
|
||||
self.state.set_left(gamepad::is_active(ctx, self.gamepad_id, &button_map.right));
|
||||
self.state.set_right(gamepad::is_active(ctx, self.gamepad_id, &button_map.left));
|
||||
self.state.set_left(gamepad::is_active(ctx, self.gamepad_id, &button_map.left));
|
||||
self.state.set_right(gamepad::is_active(ctx, self.gamepad_id, &button_map.right));
|
||||
self.state.set_map(gamepad::is_active(ctx, self.gamepad_id, &button_map.map));
|
||||
self.state.set_inventory(gamepad::is_active(ctx, self.gamepad_id, &button_map.inventory));
|
||||
self.state.set_jump(gamepad::is_active(ctx, self.gamepad_id, &button_map.jump));
|
||||
|
|
|
@ -51,9 +51,9 @@ impl PlayerController for KeyboardController {
|
|||
TargetPlayer::Player2 => &state.settings.player2_key_map,
|
||||
};
|
||||
|
||||
self.state.set_left(keyboard::is_key_pressed(ctx, keymap.right));
|
||||
self.state.set_left(keyboard::is_key_pressed(ctx, keymap.left));
|
||||
self.state.set_up(keyboard::is_key_pressed(ctx, keymap.up));
|
||||
self.state.set_right(keyboard::is_key_pressed(ctx, keymap.left));
|
||||
self.state.set_right(keyboard::is_key_pressed(ctx, keymap.right));
|
||||
self.state.set_down(keyboard::is_key_pressed(ctx, keymap.down));
|
||||
self.state.set_map(keyboard::is_key_pressed(ctx, keymap.map));
|
||||
self.state.set_inventory(keyboard::is_key_pressed(ctx, keymap.inventory));
|
||||
|
|
|
@ -138,7 +138,6 @@ impl GameScene {
|
|||
Rc::new(RefCell::new(textures))
|
||||
};
|
||||
|
||||
let mut player1 = Player::new(state, ctx);
|
||||
let mut player2 = Player::new(state, ctx);
|
||||
|
||||
if state.player2_skin_location.texture_index != 0 {
|
||||
|
@ -152,8 +151,8 @@ impl GameScene {
|
|||
stage,
|
||||
water_params,
|
||||
water_renderer,
|
||||
player1,
|
||||
player2,
|
||||
player1: Player::new(state, ctx),
|
||||
player2: player2,
|
||||
inventory_player1: Inventory::new(),
|
||||
inventory_player2: Inventory::new(),
|
||||
boss_life_bar: BossLifeBar::new(),
|
||||
|
@ -1739,11 +1738,6 @@ impl Scene for GameScene {
|
|||
|
||||
self.pause_menu.init(state, ctx)?;
|
||||
self.whimsical_star.init(&self.player1);
|
||||
|
||||
if state.constants.is_switch && state.constants.player_skin_paths.len() > 1 {
|
||||
self.player1.load_skin(state.constants.player_skin_paths[1].as_str().to_owned(), state, ctx);
|
||||
self.player1.skin.set_skinsheet_offset(2);
|
||||
}
|
||||
|
||||
#[cfg(feature = "discord-rpc")]
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue