Compare commits

..

No commits in common. "18c0fafc5a4039fb36432fb9d7448b7a12cff71f" and "35c6676e9545be25e8956b2b369d0d47fefee2a8" have entirely different histories.

6 changed files with 24 additions and 39 deletions

View File

@ -16,8 +16,10 @@
- GPU limits? (texture size, texture number, particle/sprite limits) - GPU limits? (texture size, texture number, particle/sprite limits)
- Particles when a ship is damaged (events) - Particles when a ship is damaged (events)
- Sticky radar - Sticky radar
- Clean up world and objects
- Fix gun points - Fix gun points
- Arbitrary size resource names - Arbitrary size resource names
- How does a player control a ship (also fix behaviors)
---------------------------------- ----------------------------------

View File

@ -10,7 +10,7 @@ pub const ZOOM_MAX: f32 = 2000.0;
/// Z-axis range for starfield stars /// Z-axis range for starfield stars
/// This does not affect scale. /// This does not affect scale.
pub const STARFIELD_Z_MIN: f32 = 75.0; pub const STARFIELD_Z_MIN: f32 = 100.0;
/// Z-axis range for starfield stars /// Z-axis range for starfield stars
/// This does not affect scale. /// This does not affect scale.
pub const STARFIELD_Z_MAX: f32 = 200.0; pub const STARFIELD_Z_MAX: f32 = 200.0;

View File

@ -45,7 +45,10 @@ impl Game {
//o1.add_gun(&ct, content::GunHandle { index: 0 }); //o1.add_gun(&ct, content::GunHandle { index: 0 });
//o1.add_gun(&ct, content::GunHandle { index: 0 }); //o1.add_gun(&ct, content::GunHandle { index: 0 });
print!("{:?}", o1); let mut o1 = OutfitSet::new(ss.space, &[]);
o1.add(&ct.get_outfit(content::OutfitHandle { index: 0 }));
//o1.add_gun(&ct, content::GunHandle { index: 0 });
let player = gamedata.create_ship( let player = gamedata.create_ship(
&ct, &ct,
content::ShipHandle { index: 0 }, content::ShipHandle { index: 0 },
@ -64,10 +67,6 @@ impl Game {
&content::SystemHandle { index: 0 }, &content::SystemHandle { index: 0 },
); );
let mut o1 = OutfitSet::new(ss.space, &[]);
o1.add(&ct.get_outfit(content::OutfitHandle { index: 0 }));
//o1.add_gun(&ct, content::GunHandle { index: 0 });
gamedata.create_ship( gamedata.create_ship(
&ct, &ct,
content::ShipHandle { index: 0 }, content::ShipHandle { index: 0 },

View File

@ -1,6 +1,6 @@
use std::collections::HashMap; use std::collections::HashMap;
use content::{GunPoint, OutfitHandle, OutfitSpace, SpriteHandle}; use content::{GunPoint, OutfitHandle, OutfitSpace};
use galactica_content as content; use galactica_content as content;
/// Possible outcomes when adding an outfit /// Possible outcomes when adding an outfit
@ -98,12 +98,6 @@ impl OutfitSet {
generation: o.shield_generation, generation: o.shield_generation,
}); });
if self.outfits.contains_key(&o.handle) {
*self.outfits.get_mut(&o.handle).unwrap() += 1;
} else {
self.outfits.insert(o.handle, 1);
}
return OutfitAddResult::Ok; return OutfitAddResult::Ok;
} }
@ -137,17 +131,6 @@ impl OutfitSet {
return OutfitRemoveResult::Ok; return OutfitRemoveResult::Ok;
} }
// TODO: pick these better
pub fn get_flare_sprite(&self, ct: &content::Content) -> Option<SpriteHandle> {
for i in self.outfits.keys() {
let c = ct.get_outfit(*i);
if c.engine_flare_sprite.is_some() {
return c.engine_flare_sprite;
}
}
return None;
}
} }
// Simple getters to make sure nobody meddles with our internal state // Simple getters to make sure nobody meddles with our internal state

View File

@ -22,7 +22,7 @@ impl GPUState {
s: &ShipWorldObject, s: &ShipWorldObject,
) { ) {
let r = state.world.get_rigid_body(s.rigid_body).unwrap(); let r = state.world.get_rigid_body(s.rigid_body).unwrap();
let ship = state.data.get_ship(s.data_handle).unwrap(); let ship = state.data.get_ship(s.data_handle);
let ship_pos = util::rigidbody_position(&r); let ship_pos = util::rigidbody_position(&r);
let ship_rot = util::rigidbody_rotation(r); let ship_rot = util::rigidbody_rotation(r);
let ship_ang = -ship_rot.angle(Vector2 { x: 0.0, y: 1.0 }); // TODO: inconsistent angles. Fix! let ship_ang = -ship_rot.angle(Vector2 { x: 0.0, y: 1.0 }); // TODO: inconsistent angles. Fix!
@ -85,18 +85,25 @@ impl GPUState {
); );
self.vertex_buffers.object_counter += 1; self.vertex_buffers.object_counter += 1;
let flare = ship.get_outfits().get_flare_sprite(state.content); /*
if s.get_controls().thrust && flare.is_some() && !ship.is_dead() { // Draw engine flares if necessary
for engine_point in &ship_cnt.engines { //if s.controls.thrust && !s.ship.is_dead() {
if s.controls.thrust {
for f in s.ship.outfits.iter_enginepoints() {
let flare = match s.ship.outfits.get_flare_sprite() {
None => continue,
Some(s) => s,
};
self.queue.write_buffer( self.queue.write_buffer(
&self.global_uniform.object_buffer, &self.global_uniform.object_buffer,
ObjectData::SIZE * self.vertex_buffers.object_counter as u64, ObjectData::SIZE * self.vertex_buffers.object_counter as u64,
bytemuck::cast_slice(&[ObjectData { bytemuck::cast_slice(&[ObjectData {
xpos: engine_point.pos.x, xpos: f.pos.x,
ypos: engine_point.pos.y - engine_point.size / 2.0, ypos: f.pos.y - f.size / 2.0,
zpos: 1.0, zpos: 1.0,
angle: 0.0, angle: 0.0,
size: engine_point.size, size: f.size,
parent: idx as u32, parent: idx as u32,
is_child: 1, is_child: 1,
_padding: Default::default(), _padding: Default::default(),
@ -115,13 +122,14 @@ impl GPUState {
&self.vertex_buffers.object.instances, &self.vertex_buffers.object.instances,
ObjectInstance::SIZE * self.vertex_buffers.object_counter, ObjectInstance::SIZE * self.vertex_buffers.object_counter,
bytemuck::cast_slice(&[ObjectInstance { bytemuck::cast_slice(&[ObjectInstance {
sprite_index: flare.unwrap().get_index(), sprite_index: flare.get_index(),
object_index: self.vertex_buffers.object_counter as u32, object_index: self.vertex_buffers.object_counter as u32,
}]), }]),
); );
self.vertex_buffers.object_counter += 1; self.vertex_buffers.object_counter += 1;
} }
} }
*/
} }
pub(super) fn world_push_projectile( pub(super) fn world_push_projectile(

View File

@ -304,10 +304,3 @@ impl ShipWorldObject {
//} //}
} }
} }
impl ShipWorldObject {
/// Get this ship's control state
pub fn get_controls(&self) -> &ShipControls {
&self.controls
}
}