Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old pre-task-system code #359

Merged
merged 32 commits into from
Feb 26, 2023
Merged

Remove old pre-task-system code #359

merged 32 commits into from
Feb 26, 2023

Conversation

Akaricchi
Copy link
Member

Now that all stages have been finally ported, we have quite a bit of dead code to get rid of.

@StarWitch
Copy link
Member

image

It's so beautiful.

@StarWitch
Copy link
Member

StarWitch commented Feb 24, 2023

Currently, the only deprecation warnings I get while compiling have to do with move_towards and its wrapper.

./src/stages/stage6/nonspells/boss_nonspell_6.c:135:15: warning: '_move_towards_nargs2' is deprecated: Use move_towards(velocity, target, attraction) or move_from_towards(origin, target, attraction) instead [-Wdeprecated-declarations]

Some other random things:

  • src/util/glm.h -- glm_ease_apply appears unused
  • STAGE3D_DEFAULT_ASPECT is only used in stage1 and might be easily removable

Nothing specific to the task system, though. Looking good.

@@ -520,16 +520,15 @@ static void credits_finish(void *arg) {
}

static void credits_process(void) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably this could be a task too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but that can be refactored later. Credits code isn't great in general. I took the path of least resistance here for now.

@@ -364,7 +309,7 @@ float enemy_get_hurt_radius(Enemy *enemy) {

static bool should_auto_kill(Enemy *enemy) {
return
(enemy->hp <= 0 && enemy->hp != _internal_ENEMY_IMMUNE) ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this no longer needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used anymore. The same effect can be achieved by adding EFLAG_NO_AUTOKILL to enemy->flags. EFLAGS_GHOST is a set of flags that generally matches the old behavior of ENEMY_IMMUNE.

}

void laserline_set_ab(Laser *l, cmplx a, cmplx b) {
l->pos = a;
l->args[0] = (b - a) * 0.005;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait what was going on here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See create_laserline_ab:

Laser *create_laserline_ab(cmplx a, cmplx b, float width, float charge, float dur, const Color *clr) {
	float lt = 200;
	cmplx m = (b - a) / lt;
	Laser *l = create_laser(a, 200, dur, clr, las_linear, m, 0, 0, 0);
	INVOKE_TASK(laser_charge,
		.laser = ENT_BOX(l),
		.charge_delay = charge,
		.target_width = width,
	);
	return l;
}

200 was chosen somewhat arbitrarily (by you) for the lifetime parameter here a long time ago, and 0.005 is the reciprocal of it. I made the laserline_set_ab function a little more general by taking the actual lifetime into account rather than hardcoding it.

Also, now that you brought it to my attention, I noticed that I forgot to replace one instance of 200 with lt in create_laserline_ab.

@StarWitch StarWitch self-requested a review February 25, 2023 16:57
@Akaricchi Akaricchi merged commit ff4212e into master Feb 26, 2023
@Akaricchi Akaricchi deleted the cleanup branch August 30, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants