PDA

View Full Version : Reflected Magic LWeapon Hitbox Rotated 90 Degrees



ywkls
09-14-2017, 02:33 PM
This is something I noted while I had cheats active with the option to show current hitboxes.

Any lweapon of type reflected magic (the ones in question were generated via script) has a rectangular hitbox that seems to be rotated 90 degrees relative to other lweapons.

Example:

Normal Hitbox-

+-------+
|-------- |
+-------+

Reflected Magic Hitbox-

+----+
|-----|
|-----|
|-----|
+----+

The shape of the hitbox is not being adjusted by this script in any way.
I should also note that the shape of the hitbox seems to vary with other lweapons, though square and horizontal rectangle shown are the most common.

DarkDragon
09-14-2017, 04:46 PM
This in 2.50.x or master?

Tamamo
09-14-2017, 07:12 PM
ASCII art is not the same as Screenshots...

ZoriaRPG
09-15-2017, 06:04 AM
This in 2.50.x or master?

He is using 2.50.2. When I have my system running again, I'll look into this.

ywkls
09-15-2017, 10:07 AM
This in 2.50.x or master?

Sorry I didn't mention that. It is in 2.50.2

Screenshots (the hitbox may be a bit hard to make out, but it is shown).

https://i.imgur.com/KmDlgQj.png

These are all reflected magic type (though their sprites are different).

https://i.imgur.com/ITLWQ8B.png

This is a reflected beam type lweapon (made to look like an arrow).

I would have posted screenshots earlier, but I didn't think that the cheat's alterations (which show the hitbox) would be visible.

Gleeok
09-16-2017, 02:15 AM
Is this a bug or a request?

I don't think the reflected lweapon type has been changed at all since 2.10, though it's certainly possible.

ywkls
09-16-2017, 02:30 AM
Is this a bug or a request?

I don't think the reflected lweapon type has been changed at all since 2.10, though it's certainly possible.

I felt like it was a bug, because I noted the discrepancy between it's appearance and all others.

In the next two screenshots, the left script is making a LW_REFMAGIC while the right is making an LW_REFBEAM. No other changes were made.

https://i.imgur.com/8Jaac1g.pnghttps://i.imgur.com/ITLWQ8B.png

See the difference?

ZoriaRPG
09-17-2017, 06:07 AM
I felt like it was a bug, because I noted the discrepancy between it's appearance and all others.

In the next two screenshots, the left script is making a LW_REFMAGIC while the right is making an LW_REFBEAM. No other changes were made.

https://i.imgur.com/8Jaac1g.pnghttps://i.imgur.com/ITLWQ8B.png

See the difference?


Compare both to their non-reflected counterparts, EW_MAGIC and EW_BEAM.

Those hitboxes look correct, based on the default sprites for each.

ywkls
09-17-2017, 10:20 AM
Compare both to their non-reflected counterparts, EW_MAGIC and EW_BEAM.

Those hitboxes look correct, based on the default sprites for each.

Here are screenshots of lweapon LW_BEAM and LW_MAGIC.

https://i.imgur.com/QmKRN5f.png

The LW_BEAM is hard to make out, but it seems correct to me.

https://i.imgur.com/ZkbTlJO.png

This LW_MAGIC is much easier to see and definitely of a different shape.

ZoriaRPG
09-17-2017, 11:32 AM
Here are screenshots of lweapon LW_BEAM and LW_MAGIC.

https://i.imgur.com/QmKRN5f.png

The LW_BEAM is hard to make out, but it seems correct to me.

https://i.imgur.com/ZkbTlJO.png

This LW_MAGIC is much easier to see and definitely of a different shape.

Compare to EW_MAGIC (Type ID 134) and EW_BEAM (Type ID 132). The reflected weapons (LW) are generated by reflecting EWeapons, so they should have the same hitbox as the EWeapons, as they should inherit the EW properties.

ywkls
09-17-2017, 03:48 PM
Compare to EW_MAGIC (Type ID 134) and EW_BEAM (Type ID 132). The reflected weapons (LW) are generated by reflecting EWeapons, so they should have the same hitbox as the EWeapons, as they should inherit the EW properties.

Whoops. I didn't understand what you meant the first time.

EW_BEAM and EW_MAGIC both seem to share the rotated hitbox properties. At a guess, I'd say that this is either what makes them hurt Link, or is just that LW_REFBEAM and LW_REFMAGIC are basicially generated in the same fashion.

Either way, looks like this may not be a bug after all; just an oddity.

Saffith
09-17-2017, 05:47 PM
That sort of raises another point: weapon hitboxes are set up in the constructor, and weapons created by scripts always start out facing upward. Their hitboxes don't vary depending on their direction like built-in ones would. I don't know what if anything should be done about that. I'm not sure anyone's ever even noticed, let alone complained about it.

ZoriaRPG
09-18-2017, 07:01 AM
That sort of raises another point: weapon hitboxes are set up in the constructor, and weapons created by scripts always start out facing upward. Their hitboxes don't vary depending on their direction like built-in ones would. I don't know what if anything should be done about that. I'm not sure anyone's ever even noticed, let alone complained about it.

That is a very valid point, and we should consider fixing it. Most of the time, users that scritpt weapons are content to correct the hitbox manually, but it would be better to start them with defaults that match their internal counterparts base don direction. This in theory, may affect some scripts, but it can be handled by the script metadata for 2.60. Alternatively, I can just modify CreateLWeaponDx to include this, and leave CreateLWeapon alone.

In fact, that function may already fix this issue, but I doubt it. CreateLWeaponDx() is a new internal function, for the Screen pointer that forwards data from the itemclass information from an item to generate a weapon, as Lwpns.add() normally does. That forwards the sprites and other data values that a weapon uses when added, but I do not think that the hitbox sizing is part of that information as-is. The present arg order is :

CreateLWeaponDx(int type, int parentitem);

This could also be solved at the std.zh level, by adding a function that sets the hitboxes based on constants. That may be the most desirable method, as it does not force the change on anyone. IDK what is best here.


Whoops. I didn't understand what you meant the first time.

EW_BEAM and EW_MAGIC both seem to share the rotated hitbox properties. At a guess, I'd say that this is either what makes them hurt Link, or is just that LW_REFBEAM and LW_REFMAGIC are basicially generated in the same fashion.

Either way, looks like this may not be a bug after all; just an oddity.

Not a problem. When you initially brought this up, I thought that you meant that a script generated reflected weapon had its hitbox rotated from what an internal reflected weapon (i.e, the identical type) has in the engine, but the issue that Saffith raises is quite valid. Script generated weapons do not inherit properly anyway.

Reflected weapons are a bit strange in general though, so your confusion is understandable. The hitboxes are designed to fit around the default sprites, in theory. Some of this is going to be fixed by having weapon editor stuff in the future. In theory, I could make it possible to set these things in 2.54, but I would rather wait to see how this develops, so that I do not make a huge mess out of feature migration, and the need to preserve older stuff. (e.g. Adding weapon hitoffsets to the item editor, then needing to preserve that feature forever.)