Skip to content

Commit

Permalink
avm2: Replace culling panic messages with stub messages
Browse files Browse the repository at this point in the history
A stub message is good enough.
  • Loading branch information
sleepycatcoding authored and torokati44 committed Oct 20, 2023
1 parent 9758bf8 commit c87ac6f
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions core/src/avm2/globals/flash/display/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ fn draw_triangles_internal<'gc>(
let indices = &mut indices.iter();

while let Some(triangle) = next_triangle(&vertices, indices, activation)? {
draw_triangle_internal(triangle, drawing, culling);
draw_triangle_internal(activation, triangle, drawing, culling);
}
} else {
let mut vertices = vertices.iter();
Expand Down Expand Up @@ -1037,14 +1037,19 @@ fn draw_triangles_internal<'gc>(
}

while let Some(triangle) = next_triangle(&mut vertices, activation)? {
draw_triangle_internal(triangle, drawing, culling);
draw_triangle_internal(activation, triangle, drawing, culling);
}
}

Ok(())
}

fn draw_triangle_internal((a, b, c): Triangle, drawing: &mut Drawing, culling: TriangleCulling) {
fn draw_triangle_internal(
activation: &mut Activation<'_, '_>,
(a, b, c): Triangle,
drawing: &mut Drawing,
culling: TriangleCulling,
) {
match culling {
TriangleCulling::None => {
drawing.draw_command(DrawCommand::MoveTo(a));
Expand All @@ -1054,10 +1059,20 @@ fn draw_triangle_internal((a, b, c): Triangle, drawing: &mut Drawing, culling: T
drawing.draw_command(DrawCommand::LineTo(a));
}
TriangleCulling::Positive => {
panic!("Positive culling not implemented")
avm2_stub_method!(
activation,
"flash.display.Graphics",
"drawTriangles",
"with positive culling"
);
}
TriangleCulling::Negative => {
panic!("Negative culling not implemented")
avm2_stub_method!(
activation,
"flash.display.Graphics",
"drawTriangles",
"with negative culling"
);
}
}
}
Expand Down Expand Up @@ -1427,22 +1442,8 @@ fn handle_graphics_triangle_path<'gc>(

let indices = &mut indices.iter();

while let Some((a, b, c)) = next_triangle(&vertices, indices, activation)? {
match culling {
TriangleCulling::None => {
drawing.draw_command(DrawCommand::MoveTo(a));

drawing.draw_command(DrawCommand::LineTo(b));
drawing.draw_command(DrawCommand::LineTo(c));
drawing.draw_command(DrawCommand::LineTo(a));
}
TriangleCulling::Positive => {
panic!("Positive culling not implemented")
}
TriangleCulling::Negative => {
panic!("Negative culling not implemented")
}
}
while let Some(triangle) = next_triangle(&vertices, indices, activation)? {
draw_triangle_internal(activation, triangle, drawing, culling);
}
} else {
panic!("Indices is not a vector");
Expand Down

0 comments on commit c87ac6f

Please sign in to comment.