Compare commits
No commits in common. "18c0fafc5a4039fb36432fb9d7448b7a12cff71f" and "35c6676e9545be25e8956b2b369d0d47fefee2a8" have entirely different histories.
18c0fafc5a
...
35c6676e95
2
TODO.md
2
TODO.md
|
@ -16,8 +16,10 @@
|
|||
- GPU limits? (texture size, texture number, particle/sprite limits)
|
||||
- Particles when a ship is damaged (events)
|
||||
- Sticky radar
|
||||
- Clean up world and objects
|
||||
- Fix gun points
|
||||
- Arbitrary size resource names
|
||||
- How does a player control a ship (also fix behaviors)
|
||||
|
||||
|
||||
----------------------------------
|
||||
|
|
|
@ -10,7 +10,7 @@ pub const ZOOM_MAX: f32 = 2000.0;
|
|||
|
||||
/// Z-axis range for starfield stars
|
||||
/// 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
|
||||
/// This does not affect scale.
|
||||
pub const STARFIELD_Z_MAX: f32 = 200.0;
|
||||
|
|
|
@ -45,7 +45,10 @@ impl Game {
|
|||
//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(
|
||||
&ct,
|
||||
content::ShipHandle { index: 0 },
|
||||
|
@ -64,10 +67,6 @@ impl Game {
|
|||
&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(
|
||||
&ct,
|
||||
content::ShipHandle { index: 0 },
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use content::{GunPoint, OutfitHandle, OutfitSpace, SpriteHandle};
|
||||
use content::{GunPoint, OutfitHandle, OutfitSpace};
|
||||
use galactica_content as content;
|
||||
|
||||
/// Possible outcomes when adding an outfit
|
||||
|
@ -98,12 +98,6 @@ impl OutfitSet {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -137,17 +131,6 @@ impl OutfitSet {
|
|||
|
||||
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
|
||||
|
|
|
@ -22,7 +22,7 @@ impl GPUState {
|
|||
s: &ShipWorldObject,
|
||||
) {
|
||||
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_rot = util::rigidbody_rotation(r);
|
||||
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;
|
||||
|
||||
let flare = ship.get_outfits().get_flare_sprite(state.content);
|
||||
if s.get_controls().thrust && flare.is_some() && !ship.is_dead() {
|
||||
for engine_point in &ship_cnt.engines {
|
||||
/*
|
||||
// Draw engine flares if necessary
|
||||
//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.global_uniform.object_buffer,
|
||||
ObjectData::SIZE * self.vertex_buffers.object_counter as u64,
|
||||
bytemuck::cast_slice(&[ObjectData {
|
||||
xpos: engine_point.pos.x,
|
||||
ypos: engine_point.pos.y - engine_point.size / 2.0,
|
||||
xpos: f.pos.x,
|
||||
ypos: f.pos.y - f.size / 2.0,
|
||||
zpos: 1.0,
|
||||
angle: 0.0,
|
||||
size: engine_point.size,
|
||||
size: f.size,
|
||||
parent: idx as u32,
|
||||
is_child: 1,
|
||||
_padding: Default::default(),
|
||||
|
@ -115,13 +122,14 @@ impl GPUState {
|
|||
&self.vertex_buffers.object.instances,
|
||||
ObjectInstance::SIZE * self.vertex_buffers.object_counter,
|
||||
bytemuck::cast_slice(&[ObjectInstance {
|
||||
sprite_index: flare.unwrap().get_index(),
|
||||
sprite_index: flare.get_index(),
|
||||
object_index: self.vertex_buffers.object_counter as u32,
|
||||
}]),
|
||||
);
|
||||
self.vertex_buffers.object_counter += 1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
pub(super) fn world_push_projectile(
|
||||
|
|
|
@ -304,10 +304,3 @@ impl ShipWorldObject {
|
|||
//}
|
||||
}
|
||||
}
|
||||
|
||||
impl ShipWorldObject {
|
||||
/// Get this ship's control state
|
||||
pub fn get_controls(&self) -> &ShipControls {
|
||||
&self.controls
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue