NeonKnightOA / oagamepack

OpenArena GPL gamepack
GNU General Public License v2.0
2 stars 1 forks source link

Problem with spawnflags in trigger_hurt (and more?) #7

Closed The-Gig closed 4 years ago

The-Gig commented 4 years ago

When some weeks ago I created the deadly pit of a space map, I noticed that the killing trigger was not working exactly as expected. It turned out that the trigger_hurt spawnflags in the editor do not represent the correct values: "silent" is 4 (not 2); "no_protection" is 8 (not 4); "slow" is 16 (not 8). "start_off" is correct (1).

An odd thing is that I thought such stuff was extracted from the game code, so I don't know how it's possible that is wrong. Is maybe there a bug in the script (either in the gamecode -> csv script, and/or in the csv->ent/def script), which does not correctly manage the case of "unused" bits inside a bitfield (trigger_hurt does never use value "2")? If that's the case, then there might be more entities with their spawnflags messed up!

From current entities.def: /*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF x SILENT NO_PROTECTION SLOW from "classic" entities.def: /*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF - SILENT NO_PROTECTION SLOW

From current entities.ent: <flag key="NO_PROTECTION" name="Ignore powerup protection" bit="2">Player is hurt regardless of powerup protection.</flag> <flag key="SILENT" name="Silent trigger" bit="1">Supresses playing the sizzling sound.</flag> <flag key="SLOW" name="Damage per second" bit="3">Damage rate changes to once per second instead of server frame.</flag> <flag key="START_OFF" name="Starts off" bit="0">Requires toggling for damage infliction.</flag> from "classic" entities.ent: <flag key="START_OFF" name="Start Disabled" bit="0">needs to be triggered (toggle) for damage</flag> <flag key="SILENT" name="Silent" bit="2">supresses the sizzling sound while player is being hurt.</flag> <flag key="NO_PROTECTION" name="No Powerup Protection" bit="3">player will be hurt regardless of protection (see Notes).</flag> <flag key="SLOW" name="Damage Once Per Second" bit="4">changes the damage rate to once per second.</flag>

And from https://github.com/OpenArena/gamecode/blob/master/code/game/g_trigger.c : /*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF - SILENT NO_PROTECTION SLOW

From current entities.csv trigger_hurt /*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF x SILENT NO_PROTECTION SLOW

Maybe that "-" becoming "x" is the cause of the issue... but how could it happen? @sago007 any idea?

Giving a quick and manual look into entities.csv, I noticed some other "x" in "QUAKED" field for the following entities:

The-Gig commented 4 years ago

It looks to me like there might be two strange things involved. First one might be in the gamecode -> csv script, which is that "-" becoming "x" for no apparent reason (maybe the script tries to avoid special characters?). Second one might be in the csv -> ent/def script, where maybe I would have expected a placeholder spawnflag named "x" might have been created instead of just "skipping" it, which would have mitigated the problem caused by the first issue. In other words, how does the script know that "x" is NOT a real spawnflag of that entity? Maybe this is due to the fact that fake "x" spawnflag does not have any description?

NeonKnightOA commented 4 years ago

Fixed in #8

The-Gig commented 4 years ago

Thank you! So, you added an "X" placeholder description? Good, but what does "nan" stand for? "Unused" might have been clearer?

The-Gig commented 4 years ago

Uhm... now I think the real error was in spawnflag_text.csv, right? So you fixed the issue by changing "SILENT","SILENT",1,"Silent trigger","Supresses playing the sizzling sound." into "SILENT","SILENT","2","Silent trigger","Supresses playing the sizzling sound." etc. So, now I wonder... is the new "X" placeholder description necessary, then? Or it might have been omitted? BTW, the line in spawnflag_text.csv specifies the bit of the X, which is true for all the entities currently involved... but light and lightjunior also have a second "x", which is on another bit.

NeonKnightOA commented 4 years ago

Description? There's something wrong then.

NeonKnightOA commented 4 years ago

Fixed in #9 .