Merge pull request #73 from jantlo/issue_59_reset_exhaust_plume_states

reseting the ship exhaust plumes when going back to main menu.
This commit is contained in:
Dominic Szablewski 2023-09-09 13:00:40 +02:00 committed by GitHub
commit e915913f6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View file

@ -515,6 +515,8 @@ static void objects_unpack_imp(Object **dest_array, int len, Object *src) {
void main_menu_init(void) {
g.is_attract_mode = false;
ships_reset_exhaust_plumes();
main_menu = mem_bump(sizeof(menu_t));
background = image_get_texture("wipeout/textures/wipeout1.tim");

View file

@ -143,6 +143,11 @@ void ships_update(void) {
}
}
void ships_reset_exhaust_plumes(void) {
for (int i = 0; i < len(g.ships); i++) {
ship_reset_exhaust_plume(&g.ships[i]);
}
}
void ships_draw(void) {
@ -389,6 +394,17 @@ void ship_init_exhaust_plume(ship_t *self) {
}
}
void ship_reset_exhaust_plume(ship_t* self)
{
for (int i = 0; i < 3; i++) {
if (self->exhaust_plume[i].v != NULL) {
self->exhaust_plume[i].v->z = self->exhaust_plume[i].initial.z;
self->exhaust_plume[i].v->x = self->exhaust_plume[i].initial.x;
self->exhaust_plume[i].v->y = self->exhaust_plume[i].initial.y;
}
}
}
void ship_draw(ship_t *self) {
object_draw(self->model, &self->mat);
@ -1001,6 +1017,3 @@ void ship_collide_with_ship(ship_t *self, ship_t *other) {
flags_add(self->flags, SHIP_COLL);
flags_add(other->flags, SHIP_COLL);
}

View file

@ -150,9 +150,11 @@ void ships_load(void);
void ships_init(section_t *section);
void ships_draw(void);
void ships_update(void);
void ships_reset_exhaust_plumes(void);
void ship_init(ship_t *self, section_t *section, int pilot, int position);
void ship_init_exhaust_plume(ship_t *self);
void ship_reset_exhaust_plume(ship_t *self);
void ship_draw(ship_t *self);
void ship_draw_shadow(ship_t *self);
void ship_update(ship_t *self);