- It was calling the fallback aiming in the wrong place when it should have been outside the speed check.
- Credit to _mental_ for the base code, but no gotos involved.
Visual C++ will never statically initialize a class instance where a member field has a default value set, so the DEFINE_ACTION_FUNCTION variants without a direct native call need to be handled differently. The easiest way to do this is to leave out the nullptr default and omit the value in the initializer list. For trailing fields this will always get them nulled.
Unlike the other classes, the places where variables from this class were accessed were quite scattered so there isn't much scriptified code. Instead, most of these places are now using the script variable access methods.
This was the last remaining subclass of AActor, meaning that class Actor can now be opened for user-side extensions.
Since these can be changed on the placed light actor they have to be read from there, so this is now a pointer in FDynamicLight, just like the other properties that can be user-changed.
Also did some cleanup on the interface so that external code doesn't need to dereference the lightflags pointer but can use utility functions for all flags.
# Conflicts:
# src/hwrenderer/dynlights/hw_dynlightdata.cpp
# src/swrenderer/line/r_walldraw.cpp
# Conflicts:
# src/g_level.cpp
# src/gl/compatibility/gl_20.cpp
This should be less of a drag on the playsim than having each light a separate actor. A quick check with ZDCMP2 showed that the light processing time was reduced to 1/3rd from 0.5 ms to 0.17 ms per tic.
It's also one native actor class less.
# Conflicts:
# src/g_shared/a_dynlight.cpp
# src/g_shared/a_dynlight.h
# src/hwrenderer/dynlights/hw_dynlightdata.cpp
# src/hwrenderer/dynlights/hw_dynlightdata.h
# src/hwrenderer/scene/hw_renderhacks.cpp
# src/namedef.h
# src/scripting/thingdef_data.cpp
# src/swrenderer/line/r_walldraw.cpp
# Conflicts:
# src/d_main.cpp
# src/g_levellocals.h
# src/g_shared/a_dynlight.cpp
# src/g_shared/a_dynlight.h
# src/gl/dynlights/gl_dynlight.h
# src/gl/dynlights/gl_dynlight1.cpp
# src/gl/scene/gl_spritelight.cpp
# src/gl/scene/gl_walls.cpp
# src/hwrenderer/dynlights/hw_shadowmap.cpp
# src/hwrenderer/dynlights/hw_shadowmap.h
# src/hwrenderer/scene/hw_flats.cpp
# src/p_setup.cpp
Actors get initialized from their defaults so anything done in the constructor or some explicit member initialization will be overwritten.
They must use their properties for setting up configurable fields and do the rest in BeginPlay.
Only the class definition itself remains and needs to be taken care of.
# Conflicts:
# src/g_statusbar/sbarinfo_commands.cpp
# src/hu_scores.cpp
# src/scripting/thingdef_data.cpp
# Conflicts:
# src/actorinlines.h
# src/hu_scores.cpp
This was the only code using the ViewBob member variable.
This also moves the range check for this variable to its application, because a badly behaved mod can just as easily change it at run time instead of just setting an absurdly large value in the class definition.
backtrace functions are not present in all libc implementations. Cmake has
module to add external libraries into build if needed so use it to fix build on
Unix systems without backtrace in libc.
ReadString allocates a buffer, so saving it in a local variable and then forgetting it will not free the buffer afterward.
(This should probably be refactored to use some safer methods to read the string than this old-school method...)
Since actors are being spawned before the renderer gets set up this needs to fully initialize the list before spawning the actors, then take it down again for creating the vertex buffer and then recreate it.
- TriggerPainChance(Name mod, bool forcedPain)
- One exception: PainThrehold is only checked in ReactToDamage, since this function does not require checking damage amount.
- Split off all reactive functionality (pain, infighting, etc) into its own function, ReactToDamage.
- Refactored all DamageMobj's damage <= 0 values.
- Any unconditional cancellations now return -1. ReactToDamage will not be called if values < 0.
- All pain/wound/target changing allowances return 0.
NOFRICTION disables all friction effects on the thing it's set on
(including the speed cap from water/crouching), and NOFRICTIONBOUNCE
disables the "bounce off walls on an icy floor" effect on the thing
it's set on.
This did no longer sort sprites in the same position reliably since the feature to render sprites which only partially are inside a sector was added.
With this, sprites in the same position are no longer guaranteed to be added to the render list in sequence.
Fixed by adding an 'order' field to AActor which gets incremented with each spawned actor and reset when a new level is started.
The software renderer will also need a variation of this fix but its data no longer has access to the defining actor when being sorted, so a bit more work is needed here.
# Conflicts:
# src/hwrenderer/scene/hw_drawlist.cpp
# src/hwrenderer/scene/hw_sprites.cpp
Changed to use 32 bit and also fixed the random number call which was using the byte value variant of the access operator, effectively limiting the number of choices to 256.
The mod which prompted me to add this is "The Chosen" which is a Dehacked-based TC and repurposes many original actors for something entirely different.
The stock lights are not usable for this and would make it impossible to add a GAMEINFO lump to it because then there is no way to disable loading of lights in the startup screen.
Making callstack resolving operational will require a little bit more effort
src/scripting/vm/jit_runtime.cpp:900:31: error: use of undeclared identifier 'frames'
src/scripting/vm/jit_runtime.cpp:903:23: error: use of undeclared identifier 'cnt'