The source project of this merge request has been removed.
Expose VFX and visual functions from k_kart.c to Lua
Summary
This MR adds exposes nearly all VFX functions from the k_kart.c file for Lua to use. It also fixes K_SpawnSparkleTrail crashing if used in a non-player mobj, and adds an INLEVEL check to K_DoInstashield.
The functions exposed are:
int K_GetPlayerDontDrawFlag(player_t player)void K_KartPainEnergyFling(player_t player)void K_SpawnDashDustRelease(player_t player)void K_SpawnDriftBoostClip(player_t player)void K_SpawnDriftBoostClipSpark(mobj_t clip)void K_SpawnNormalSpeedLines(player_t player)void K_SpawnGardenTopSpeedLines(player_t player)void K_SpawnInvincibilitySpeedLines(mobj_t mobj)void K_SpawnBumpEffect(mobj_t mobj)void K_SpawnLandMineExplosion(mobj_t mobj, skincolornum_t color, tic_t delay)void K_MineFlashScreen(mobj_t source)void K_SpawnDraftDust(mobj_t mobj)void K_SpawnMagicianParticles(mobj_t mobj, INT32 spread)void K_Squish(mobj_t mobj)int K_DriftSparkColor(player_t player, INT32 charge)int K_StairJankFlip(INT32 value)void K_SpawnDriftBoostExplosion(player_t player, UINT8 stage)void K_SpawnDriftElectricSparks(player_t player, skincolornum_t color, boolean shockwave)void K_SpawnWaterRunParticles(mobj_t mobj)int K_GetInvincibilityItemFrame()int K_GetOrbinautItemFrame(UINT8 count)void K_UpdateMobjItemOverlay(mobj_t part, SINT8 itemType, UINT8 itemCount)
Testing
Demonstration:
Testing environment: ringracers_visualFunctionsLua.exe -console -skipintro -warp RR_TESTRUN +addfile vfxfuncs.lua
I used a script, vfxfuncs.lua, to test all functions. Namely:
-
dontdrawflag: testsK_GetPlayerDontDrawFlagby printing each display player's DONTDRAW flag. -
painenergyfling: runsK_KartPainEnergyFlingon the player. -
dashdustrelease: runsK_SpawnDashDustReleaseon the player. -
driftboostclip: runsK_SpawnDriftBoostClipon the player. -
driftboostclipspark: runsK_SpawnDriftBoostClipSparkon the player's mobj. -
normalspeedlines: runsK_SpawnNormalSpeedLineson the player. -
gardentopspeedlines: runsK_SpawnGardenTopSpeedLineson the player. -
invincibilityspeedlines: runsK_SpawnInvincibilitySpeedLineson the player's mobj. -
bump: runsK_SpawnBumpEffecton the player's mobj. -
spawnlandmineexplosion [delay]: runsK_SpawnLandMineExplosionon the player. Optionally, a value can be set to change the explosion delay, defaults to 0. -
mineflash: runsK_MineFlashScreenon the player's mobj. -
draftdust: runsK_SpawnDraftDuston the player's mobj. -
magiparticles [spread]: runsK_SpawnMagicianParticleson the player's mobj. Optionally, a value can be set to change the spread of the particles, defaults to 5. -
squishier: runsK_Squishon the player, as well as making the player squisher-looking. Run the command again to disable it. -
wobble: runsK_StairJankFlipon the player's sprite offsets every tic. Run the command again to disable it. -
dbexplosion [stage]: runsK_SpawnDriftBoostExplosionon the player. Optionally, a value can be set to change the drift boost stage, from 0 to 4. Defaults to 0. -
electricsparks [stage] [shockwave]: runsK_SpawnDriftElectricSparkson the player. Optionally, a value can be set to change the color of the sparks, and a boolean can be set (true, false) to enable the shockwave effect. Defaults to 1 and false respectively. -
waterrunparticles: runsK_SpawnWaterRunParticleson the player's mobj. -
orbinautitemframe [value]: prints the value fromK_GetOrbinautItemFramedepending on the input given, defaults to 1. -
updatemobjitemoverlay [itemtype] [itemcount]: runsK_UpdateMobjItemOverlayon the player, giving the player flags based on the values given. Defaults to 0 and 0 respectively. - In addition, the HUD displays values related to
K_DriftSparkColorandK_GetInvincibilityItemFramerespectively.
Changelog:
- Lua: Fixed
K_SpawnSparkleTrailcrashing when it is used on a non-player mobj. - Lua: Added INLEVEL check to
K_DoInstashield. - Lua: Exposed
int K_GetPlayerDontDrawFlag(player_t player) - Lua: Exposed
void K_KartPainEnergyFling(player_t player) - Lua: Exposed
void K_SpawnDashDustRelease(player_t player) - Lua: Exposed
void K_SpawnDriftBoostClip(player_t player) - Lua: Exposed
void K_SpawnDriftBoostClipSpark(mobj_t clip) - Lua: Exposed
void K_SpawnNormalSpeedLines(player_t player) - Lua: Exposed
void K_SpawnGardenTopSpeedLines(player_t player) - Lua: Exposed
void K_SpawnInvincibilitySpeedLines(mobj_t mobj) - Lua: Exposed
void K_SpawnBumpEffect(mobj_t mobj) - Lua: Exposed
void K_SpawnLandMineExplosion(mobj_t mobj, skincolornum_t color, tic_t delay) - Lua: Exposed
void K_MineFlashScreen(mobj_t source) - Lua: Exposed
void K_SpawnDraftDust(mobj_t mobj) - Lua: Exposed
void K_SpawnMagicianParticles(mobj_t mobj, INT32 spread) - Lua: Exposed
void K_Squish(mobj_t mobj) - Lua: Exposed
int K_DriftSparkColor(player_t player, INT32 charge) - Lua: Exposed
int K_StairJankFlip(INT32 value) - Lua: Exposed
void K_SpawnDriftBoostExplosion(player_t player, UINT8 stage) - Lua: Exposed
void K_SpawnDriftElectricSparks(player_t player, skincolornum_t color, boolean shockwave) - Lua: Exposed
void K_SpawnWaterRunParticles(mobj_t mobj) - Lua: Exposed
int K_GetInvincibilityItemFrame() - Lua: Exposed
int K_GetOrbinautItemFrame(UINT8 count) - Lua: Exposed
void K_UpdateMobjItemOverlay(mobj_t part, SINT8 itemType, UINT8 itemCount)