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

namcos21: Some cleanup & modernization #12566

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

FlykeSpice
Copy link
Contributor

@FlykeSpice FlykeSpice commented Jul 11, 2024

  • namcos21_3d.cpp: Removed some duplicated code, modernized it a bit to current MAME standards
  • namco21*.cpp: Tidied them up a bit, removed some unnecessary identations and added better formatting.

@angelosa angelosa added the Modernization For PRs doing code cleanups, chore label Jul 11, 2024
@FlykeSpice
Copy link
Contributor Author

FlykeSpice commented Jul 12, 2024

You know what? Why not touch all the namcos21_* in a single PR, should get things moving more swiftly

@FlykeSpice FlykeSpice marked this pull request as draft July 12, 2024 01:35
@FlykeSpice FlykeSpice changed the title namcos21_3d.cpp: Some cleanup & modernization namcos21: Some cleanup & modernization Jul 12, 2024
@angelosa
Copy link
Member

What do you mean?

@FlykeSpice FlykeSpice marked this pull request as ready for review July 12, 2024 16:02
@FlykeSpice
Copy link
Contributor Author

FlykeSpice commented Jul 12, 2024

What do you mean?

Eventually I would need to cleanup the others namcos21*.cpp source files aswell. So I thought why not do it in a single PR?

Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

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

There are a lot of changes here, but I’m not sure on the quality of it.

On just a quick read of the code, I noticed you’d broken a fairly simple bubble sort of three items. There may be other stuff that’s broken that I haven’t noticed.

You haven’t been particularly consistent with reformatting. There are some if statements that you’ve reformatted to if (condition) style, while others where you’ve changed the line still use if( condition ) or other styles. Similarly, you’ve added spaces around binary operators in some places but not others.

A lot of the places you’ve added blank lines aren’t separating logical blocks of code, and hence don’t aid readability.

src/mame/namco/namcos21.cpp Outdated Show resolved Hide resolved
src/mame/namco/namcos21.cpp Outdated Show resolved Hide resolved
src/mame/namco/namcos21.cpp Outdated Show resolved Hide resolved
src/mame/namco/namcos21_3d.cpp Outdated Show resolved Hide resolved
Comment on lines -152 to 150
for (;;)
{
if (v0->y > v1->y)
{
SWAP(n21_vertex, v0, v1);
}
else if (v1->y > v2->y)
{
SWAP(n21_vertex, v1, v2);
}
else
{
break;
}
std::swap(v0, v1);

if (v1->y > v2->y)
std::swap(v1, v2);

if (v0->y > v1->y)
std::swap(v0, v1);
}
Copy link
Member

Choose a reason for hiding this comment

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

You’ve broken this – consider what happens if you get (3 2 1). The first swap makes it (3 1 2), and the second swap makes it (1 3 2). You need three comparisons to bubble sort three items.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you really proof read it? There are three comparisons.

src/mame/namco/namcos21_3d.cpp Outdated Show resolved Hide resolved
src/mame/namco/namcos21_3d.cpp Outdated Show resolved Hide resolved
src/mame/namco/namcos21_dsp.cpp Outdated Show resolved Hide resolved
@FlykeSpice
Copy link
Contributor Author

....hello?

@FlykeSpice FlykeSpice requested a review from cuavas August 26, 2024 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Modernization For PRs doing code cleanups, chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants