game/objects: Merge har_tick() if statements
@@ -1306,12 +1306,10 @@ void har_tick(object *obj) {
}
// Reset air_attacked when not in the air to prevent HAR from freezing
- if (!object_is_airborne(obj)) {
- if(h->air_attacked) {
+ if (!object_is_airborne(obj) && h->air_attacked) {
har_event_air_attack_done(h);
h->air_attacked = 0;
}
- }
if ((h->state == STATE_DONE)
&& player_is_last_frame(obj)
@@ -1397,8 +1395,7 @@ void har_tick(object *obj) {
// to show the sprite with animation string that interpolates opacity down
// Mark new object as the owner of the animation, so that the animation gets
// removed when the object is finished.
- if(player_frame_isset(obj, "ub")) {
- if(obj->age % 2 == 0) {
+ if(player_frame_isset(obj, "ub") && obj->age % 2 == 0) {
sprite *nsp = sprite_copy(obj->cur_sprite);
object *nobj = malloc(sizeof(object));
object_create(nobj, obj->gs, object_get_pos(obj), vec2f_create(0,0));
@@ -1411,7 +1408,6 @@ void har_tick(object *obj) {
object_dynamic_tick(nobj);
game_state_add_object(obj->gs, nobj, RENDER_LAYER_BOTTOM, 0, 0);
}
- }
// Network motion replay
int act_pos = obj->age % OBJECT_EVENT_BUFFER_SIZE;
