From c6bd949f816849832b90a1713f6d324ce911725a Mon Sep 17 00:00:00 2001 From: Tuomas Virtanen Date: Wed, 9 Apr 2025 18:47:28 +0300 Subject: [PATCH 1/3] Small changes --- src/game/objects/har.c | 11 ----------- src/game/protos/object.c | 2 +- src/game/protos/player.c | 25 ++++++++++++++----------- src/game/protos/player.h | 2 +- src/game/scenes/arena.c | 1 - src/game/scenes/mechlab.c | 5 ----- 6 files changed, 16 insertions(+), 30 deletions(-) diff --git a/src/game/objects/har.c b/src/game/objects/har.c index bb7d8170d..fd999a522 100644 --- a/src/game/objects/har.c +++ b/src/game/objects/har.c @@ -282,7 +282,6 @@ void har_set_ani(object *obj, int animation_id, int repeat) { } object_set_repeat(obj, repeat); object_set_stride(obj, 1); - object_dynamic_tick(obj); // update this so mx/my have correct origins obj->start = obj->pos; h->damage_done = 0; @@ -316,7 +315,6 @@ void har_walk_to(object *obj, int destination) { object_set_repeat(obj, 1); object_set_stride(obj, 1); h->walk_destination = destination; - object_dynamic_tick(obj); // update this so mx/my have correct origins obj->start = obj->pos; } @@ -555,7 +553,6 @@ void har_move(object *obj) { object_set_animation(enemy_obj, &af_get_move(enemy_har->af_data, ANIM_DAMAGE)->ani); object_set_repeat(enemy_obj, 0); object_set_custom_string(enemy_obj, str_c(&move->footer_string)); - object_dynamic_tick(enemy_obj); h->walk_destination = -1; h->walk_done_anim = 0; @@ -877,7 +874,6 @@ void har_take_damage(object *obj, const str *string, float damage, float stun) { object_set_custom_string(obj, str_c(string)); log_debug("HAR %s animation set to %s", har_get_name(h->id), str_c(string)); } - object_dynamic_tick(obj); // XXX hack - if the first frame has the 'k' tag, treat it as some vertical knockback // we can't do this in player.c because it breaks the jaguar leap, which also uses the 'k' tag. @@ -929,7 +925,6 @@ static void har_spawn_oil(object *obj, vec2i pos, int amount, int layer) { object_set_stl(scrap, object_get_stl(obj)); object_set_gravity(scrap, har_sparks_random_gravity(obj)); object_set_layers(scrap, LAYER_SCRAP); - object_dynamic_tick(scrap); scrap_create(scrap); game_state_add_object(obj->gs, scrap, layer, 0, 0); } @@ -972,7 +967,6 @@ void har_spawn_scrap(object *obj, vec2i pos, int amount) { object_set_pal_limit(obj, object_get_pal_limit(obj)); object_set_layers(scrap, LAYER_SCRAP); object_set_group(scrap, GROUP_SCRAP); - object_dynamic_tick(scrap); object_set_shadow(scrap, 1); scrap_create(scrap); game_state_add_object(obj->gs, scrap, RENDER_LAYER_TOP, 0, 0); @@ -995,7 +989,6 @@ void har_block(object *obj, vec2i hit_coord, uint8_t block_stun) { snprintf(stun_str, sizeof(stun_str), "A%d", block_stun); object_set_custom_string(obj, stun_str); object_set_repeat(obj, 0); - object_dynamic_tick(obj); // blocking spark if(h->damage_received) { // don't make another scrape @@ -1011,8 +1004,6 @@ void har_block(object *obj, vec2i hit_coord, uint8_t block_stun) { object_set_repeat(scrape, 0); object_set_gravity(scrape, 0); object_set_layers(scrape, LAYER_SCRAP); - object_dynamic_tick(scrape); - object_dynamic_tick(scrape); game_state_play_sound(obj->gs, 3, 0.7f, 0.5f, 1.0f); game_state_add_object(obj->gs, scrape, RENDER_LAYER_MIDDLE, 0, 0); h->damage_received = 1; @@ -1975,7 +1966,6 @@ void har_tick(object *obj) { object_set_custom_string(nobj, "bs100A1-bf0A15"); object_add_animation_effects(nobj, EFFECT_SHADOW); object_set_direction(nobj, object_get_direction(obj)); - object_dynamic_tick(nobj); game_state_add_object(obj->gs, nobj, RENDER_LAYER_BOTTOM, 0, 0); } } @@ -2306,7 +2296,6 @@ int har_act(object *obj, int act_type) { object_set_animation(enemy_obj, &af_get_move(enemy_har->af_data, ANIM_DAMAGE)->ani); object_set_repeat(enemy_obj, 0); object_set_custom_string(enemy_obj, str_c(&move->footer_string)); - object_dynamic_tick(enemy_obj); } if(h->state == STATE_NONE) { diff --git a/src/game/protos/object.c b/src/game/protos/object.c index 93c79ce62..d81f0716d 100644 --- a/src/game/protos/object.c +++ b/src/game/protos/object.c @@ -240,7 +240,7 @@ void object_dynamic_tick(object *obj) { // Run animation player LAST, so that we have operated what we want on the current tick. if(obj->cur_animation != NULL && obj->halt == 0) { for(int i = 0; i < obj->stride; i++) { - player_run(obj); + player_run(obj, true); } } } diff --git a/src/game/protos/player.c b/src/game/protos/player.c index ea4451542..4fd796233 100644 --- a/src/game/protos/player.c +++ b/src/game/protos/player.c @@ -55,7 +55,6 @@ void player_reload_with_str(object *obj, const char *custom_str) { } // Set player state - player_reset(obj); obj->animation_state.reverse = 0; obj->slide_state.timer = 0; obj->slide_state.vel = vec2f_create(0, 0); @@ -65,6 +64,7 @@ void player_reload_with_str(object *obj, const char *custom_str) { obj->q_counter = 0; obj->q_val = 0; obj->can_hit = 0; + player_reset(obj); } void player_reload(object *obj) { @@ -77,6 +77,7 @@ void player_reset(object *obj) { obj->animation_state.finished = 0; obj->animation_state.previous = -1; obj->animation_state.disable_d = 0; + player_run(obj, false); } int player_frame_isset(const object *obj, const char *tag) { @@ -183,7 +184,7 @@ void player_describe_mp_flags(const sd_script_frame *frame, int mp) { } #endif /* DEBUGMODE */ -void player_run(object *obj) { +void player_run(object *obj, bool tick) { // Some vars for easier life player_animation_state *state = &obj->animation_state; player_sprite_state *rstate = &obj->sprite_state; @@ -198,7 +199,7 @@ void player_run(object *obj) { if(frame == NULL) { if(state->repeat) { player_reset(obj); - frame = sd_script_get_frame_at(&state->parser, state->current_tick); + return; } else { state->finished = 1; if(obj->finish != NULL) { @@ -724,15 +725,17 @@ void player_run(object *obj) { } // Animation ticks - state->previous_tick = state->current_tick; - if(state->reverse) { - state->current_tick--; - } else { - state->current_tick++; - } + if(tick) { + state->previous_tick = state->current_tick; + if(state->reverse) { + state->current_tick--; + } else { + state->current_tick++; + } - // Sprite ticks - rstate->timer++; + // Sprite ticks + rstate->timer++; + } // All done. return; diff --git a/src/game/protos/player.h b/src/game/protos/player.h index 14748a1f1..eb0515649 100644 --- a/src/game/protos/player.h +++ b/src/game/protos/player.h @@ -82,7 +82,7 @@ void player_reload_with_str(object *obj, const char *str); void player_reset(object *obj); int player_frame_isset(const object *obj, const char *tag); int player_frame_get(const object *obj, const char *tag); -void player_run(object *obj); +void player_run(object *obj, bool tick); void player_set_repeat(object *obj, int repeat); int player_get_repeat(const object *obj); void player_next_frame(object *obj); diff --git a/src/game/scenes/arena.c b/src/game/scenes/arena.c index cd48de5ae..edfee6bbf 100644 --- a/src/game/scenes/arena.c +++ b/src/game/scenes/arena.c @@ -1277,7 +1277,6 @@ void arena_dynamic_tick(scene *scene, int paused) { object_set_layers(scrap, LAYER_SCRAP); object_set_shadow(scrap, 1); object_set_group(scrap, GROUP_SCRAP); - object_dynamic_tick(scrap); scrap_create(scrap); game_state_add_object(gs, scrap, RENDER_LAYER_TOP, 0, 0); } diff --git a/src/game/scenes/mechlab.c b/src/game/scenes/mechlab.c index 1aa81789b..0191d2b4b 100644 --- a/src/game/scenes/mechlab.c +++ b/src/game/scenes/mechlab.c @@ -104,7 +104,6 @@ bool mechlab_find_last_player(scene *scene) { object_create(local->mech, scene->gs, vec2i_create(0, 0), vec2f_create(0, 0)); object_set_animation(local->mech, initial_har_ani); object_set_repeat(local->mech, 1); - object_dynamic_tick(local->mech); sd_pilot *old_pilot = game_player_get_pilot(p1); if(&p1->chr->pilot != old_pilot) { game_player_set_pilot(p1, &p1->chr->pilot); @@ -122,7 +121,6 @@ void mechlab_load_har(scene *scene, sd_pilot *pilot) { object_create(local->mech, scene->gs, vec2i_create(0, 0), vec2f_create(0, 0)); object_set_animation(local->mech, initial_har_ani); object_set_repeat(local->mech, 1); - object_dynamic_tick(local->mech); } void mechlab_set_selling(scene *scene, bool selling) { @@ -142,7 +140,6 @@ void mechlab_set_hint(scene *scene, const char *hint) { static void mechlab_mech_finished_cb(object *obj) { player_reset(obj); - player_run(obj); object_set_halt(obj, 1); } @@ -255,7 +252,6 @@ void mechlab_update(scene *scene) { object_create(local->mech, scene->gs, vec2i_create(0, 0), vec2f_create(0, 0)); object_set_animation(local->mech, initial_har_ani); object_set_repeat(local->mech, 1); - object_dynamic_tick(local->mech); } switch(local->dashtype) { // Dashboard with the gauges etc. @@ -440,7 +436,6 @@ void mechlab_select_dashboard(scene *scene, dashboard_type type) { object_create(local->mech, scene->gs, vec2i_create(0, 0), vec2f_create(0, 0)); object_set_animation(local->mech, initial_har_ani); object_set_repeat(local->mech, 1); - object_dynamic_tick(local->mech); gui_frame_set_root(local->dashboard, lab_dash_newplayer_create(scene, &local->nw)); gui_frame_layout(local->dashboard); From baa605ad5c5c5db9c972be66aaa0c533ac20abf9 Mon Sep 17 00:00:00 2001 From: LegendaryBlueShirt Date: Wed, 9 Apr 2025 22:56:17 -0700 Subject: [PATCH 2/3] Fixed some rectests --- rectests/65K6P.REC | Bin 1378 -> 1378 bytes rectests/FLAIL_454P.REC | Bin 1371 -> 1371 bytes rectests/JAG-THROW-LAND.REC | Bin 1483 -> 1469 bytes .../KEEP-WALKING-AFTER-JAG-STANDING-THROW.REC | Bin 1294 -> 1294 bytes rectests/NOVA-1P.REC | Bin 1364 -> 1364 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/rectests/65K6P.REC b/rectests/65K6P.REC index c150af36a131bbd3c05f9e28247a21745b69e396..fd3cbda85d2895e6e53457edd879c9c78f1be797 100644 GIT binary patch delta 50 rcmaFF^@wYO1*=vU0|NsSgF!c#GVFoy`hXM{gNFzMh|e$$EXV)=@+gF_XVGN=Yp2$c{XOl1p1 WPJn>}$Y6l*d;}O|5ImqkU;qHC+gF_XVG5}Fr3?5K@5FSh) fR1T`I38GSffdj~3fbe_-7-SGU1|~KThk*eAadHfr diff --git a/rectests/KEEP-WALKING-AFTER-JAG-STANDING-THROW.REC b/rectests/KEEP-WALKING-AFTER-JAG-STANDING-THROW.REC index 9beab21e6d9275daf7fcb7f37abb70209058f18f..6da4e18426f6d0e7cbe9eabfe39483873f432241 100644 GIT binary patch delta 34 mcmeC<>f_pQjYTYvfq{XG!9#>00LWm-2Vy1$gXYO^Sd;*Le+Iq) delta 34 mcmeC<>f_pQjYTY%fq{XG!9#>00LWm-2Vy1$gQm%ESd;*LUcf3=9lh3_d(S3J4%P9S&rkj|hVbLe4{kp#j930mNJkaNcA~R%rkb ChYJV* delta 83 zcmcb@b%krgCl>dK3=9lh3_d(S3J4%P9S&rkj|hVbLe4{kp#j934#ZpxaNcA~R%rka CmkR;_ From c06872d98c6eee37b12fce8487777479109170ab Mon Sep 17 00:00:00 2001 From: LegendaryBlueShirt Date: Wed, 9 Apr 2025 23:36:40 -0700 Subject: [PATCH 3/3] Fixed some more rectests --- rectests/AIR-HIT.REC | Bin 1462 -> 1462 bytes rectests/ELECTRA-EXROLLTHNDR-WALLBOUNCE.REC | Bin 1343 -> 1343 bytes rectests/POWERPLANT-WALL-SPLAT.REC | Bin 1532 -> 1532 bytes rectests/PROJECTILE-KNOCKBACK.REC | Bin 1322 -> 1322 bytes rectests/SUPERJUMP.REC | Bin 1525 -> 1525 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/rectests/AIR-HIT.REC b/rectests/AIR-HIT.REC index 6d284b18291cd5944c7b57db6e1aee3c5a5f6a2e..dfdf0c5268212c9727cdb00260eb16b2a7ca78fb 100644 GIT binary patch delta 13 UcmdnSy^VW=GAm>EWEIv)03VA4H2?qr delta 13 UcmdnSy^VW=GAm=(WEIv)03U_~Gynhq diff --git a/rectests/ELECTRA-EXROLLTHNDR-WALLBOUNCE.REC b/rectests/ELECTRA-EXROLLTHNDR-WALLBOUNCE.REC index 54f8a1e607c584d7f58ab1a8405d00475cfcfaa6..019fc5edf89db47d89f56afba03a1d2b4e4c5413 100644 GIT binary patch delta 57 rcmdnbwV!JPAFE+10|NsWgNF!12av�mMv<44Ei`SuoxLAcFw_{H+HJ delta 57 rcmdnbwV!JPAFE*s0|NsWgNF!12av#Z513>hebnK0f0AcFw_{4WOx diff --git a/rectests/POWERPLANT-WALL-SPLAT.REC b/rectests/POWERPLANT-WALL-SPLAT.REC index 07eae871c2000727d6959a1d6dece15a5397fec5..22500febd9003e26fddab088fbb316ce48e2a8c0 100644 GIT binary patch delta 19 bcmeyv{fB!)4=ZE(