Skip to content

MagicFlare refactors#292

Open
bsxf-47 wants to merge 122 commits into
arx:masterfrom
bsxf-47:interactive
Open

MagicFlare refactors#292
bsxf-47 wants to merge 122 commits into
arx:masterfrom
bsxf-47:interactive

Conversation

@bsxf-47
Copy link
Copy Markdown
Contributor

@bsxf-47 bsxf-47 commented Oct 5, 2023

Attempted to put the whole module into a more readable shape. Kept the C style array for speed and the header functions so that there isn't yet another global object floating about.

@bsxf-47 bsxf-47 force-pushed the interactive branch 5 times, most recently from 73578ff to 97060bb Compare October 7, 2023 16:56
@bsxf-47 bsxf-47 marked this pull request as ready for review October 7, 2023 21:27
Comment thread src/graphics/particle/MagicFlare.cpp Outdated
z += FLARELINESTEP;
if(!io) {
z = long(z * g_sizeRatio.y);
z *= long(g_sizeRatio.y);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks wrong, long(g_sizeRatio.y) is going to change abruptly from 1 (height 480 - 959) to 2 (height 960 to 1439) to 3 (1440p+) etc. instead of scaling the y offset smoothly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad. Removed.

Comment thread src/graphics/particle/MagicFlare.cpp Outdated
z += FLARELINESTEP;
if(!io) {
z = long(z * g_sizeRatio.y);
z *= long(g_sizeRatio.y);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same, I don't think the change of rounding from after to before the multiplication is wanted here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad. Removed.

Comment thread src/graphics/particle/MagicFlare.cpp Outdated
void MagicFlareContainer::removeAll() {

for(size_t i = 0; i < g_magicFlaresMax; i++) {
MagicFlare& flare = g_magicFlares[i];
Copy link
Copy Markdown
Member

@dscharrer dscharrer Oct 28, 2023

Choose a reason for hiding this comment

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

This should be MagicFlare & flare

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 80d6021.

Comment thread src/graphics/particle/MagicFlare.cpp Outdated
RenderMaterial mat;
mat.setBlendType(RenderMaterial::Additive);

EERIE_LIGHT* light = lightHandleGet(torchLightHandle);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be EERIE_LIGHT * light

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 80d6021.

Comment thread src/graphics/particle/MagicFlare.cpp Outdated
}

long MagicFlareCountNonFlagged() {
long MagicFlareCountWithoutIO() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IO → Entity would be even better

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed.

Comment thread src/graphics/particle/MagicFlare.cpp Outdated
long count = 0;
for(size_t i = 0; i < m_magicFlaresMax; i++) {
if(g_magicFlares[i].exist && !g_magicFlares[i].hasIO) {
if(g_magicFlares[i].exist && !g_magicFlares[i].io) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Intentional? .io is cleared when the entity is destructed, .hasIO is not. Not sure if this actually matters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I know it was like this in the original code, but I removed member variable altogether in a later commit.

Comment thread src/scene/Light.cpp Outdated

if(EERIE_LIGHT * light = lightHandleGet(handle)) {
light->m_exists = false;
if(light) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is redundant, the first if already checks the same.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probably a brain fart. Removed.

Comment thread src/graphics/particle/MagicFlare.cpp Outdated
if(flare.exist) {
removeFlare(flare);
}
removeFlare(flare);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Worried that his might still call io->flarecount-- for already-cleared flares. Perhaps the io member should also be reset in MagicFlare::clear()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The flare is made to completely reset in a later commit.

Comment thread src/graphics/particle/MagicFlare.cpp Outdated
, size(0.f)
, io(nullptr)
, bDrawBitmap(false)
{ }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are redundant if already initialized to the same values in-line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True. Removed.

@bsxf-47
Copy link
Copy Markdown
Contributor Author

bsxf-47 commented Jan 28, 2024

Sorry this took me a few months to get back to. All of the pointed out issues should be sorted now.

@bsxf-47 bsxf-47 requested a review from dscharrer February 15, 2024 21:05
@dscharrer dscharrer force-pushed the master branch 5 times, most recently from 391b7f7 to 3d8a7e6 Compare May 30, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants