Remove entity arms - bad idea

This commit is contained in:
2024-02-07 11:02:06 +01:00
parent 32caeeb995
commit 28ee6da17b
7 changed files with 1 additions and 123 deletions

View File

@@ -236,35 +236,6 @@ void entityFollowPath(ecs_iter_t *it) {
}
}
static void entityUpdateArm(ecs_entity_t armEntity, Position pos, Velocity vel,
Rotation rot, Orientation orient) {
if (!armEntity) return;
const Arm arm = *ecs_get(ECS, armEntity, Arm);
f32 time = fmod(GetTime() * 2.0f, 2.0f);
if (time > 1.0f) time = 2.0f - time;
f32 velLen = Clamp(Vector2Length(vel), 0, 4.0f) * time;
Vector2 v = {arm.extended, velLen};
v = Vector2Rotate(v, orient + arm.offset);
v = Vector2Add(v, pos);
ecs_set_ptr(ECS, armEntity, Position, &v);
}
void entityUpdateArms(ecs_iter_t *it) {
Position *position = ecs_field(it, Position, 1);
Velocity *velocity = ecs_field(it, Velocity, 2);
Rotation *rotation = ecs_field(it, Rotation, 3);
Orientation *orientation = ecs_field(it, Orientation, 4);
Arms *arms = ecs_field(it, Arms, 5);
for (i32 i = 0; i < it->count; i++) {
entityUpdateArm(arms[i].primary, position[i], velocity[i],
rotation[i], orientation[i]);
entityUpdateArm(arms[i].secondary, position[i], velocity[i],
rotation[i], orientation[i]);
}
}
void renderColliders(ecs_iter_t *it) {
Position *pos = ecs_field(it, Position, 1);
HitBox *hitbox = ecs_field(it, HitBox , 2);
@@ -287,16 +258,6 @@ void renderOrientationDirection(ecs_iter_t *it) {
}
}
void renderArmPosition(ecs_iter_t *it) {
Position *pos = ecs_field(it, Position, 1);
Arm *arm = ecs_field(it, Arm, 2);
for (i32 i = 0; i < it->count; i++) {
DrawCircle(pos[i].x, pos[i].y, 1.5f, ORANGE);
}
}
void renderDebugPath(ecs_iter_t *it) {
Path *path = ecs_field(it, Path, 1);