mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge public master
This commit is contained in:
commit
43b93daaad
7 changed files with 537 additions and 73 deletions
|
|
@ -4575,6 +4575,22 @@ static void K_drawKartAccessibilityIcons(boolean gametypeinfoshown, INT32 fx)
|
|||
}
|
||||
}
|
||||
|
||||
// Adjust for Lua disabling things underneath or to the left of the speedometer.
|
||||
if (!LUA_HudEnabled(hud_rings))
|
||||
{
|
||||
if (r_splitscreen < 2)
|
||||
{
|
||||
fy += 14;
|
||||
}
|
||||
// For 4P race, only check if it's a race.
|
||||
// For 4P battle/capsules, check if it's either prisons or battle, AND check if that element isn't disabled.
|
||||
else if ((gametyperules & GTR_CIRCUIT) == GTR_CIRCUIT ||
|
||||
((battleprisons || (gametyperules & GTR_BUMPERS) == GTR_BUMPERS) && !LUA_HudEnabled(hud_gametypeinfo)))
|
||||
{
|
||||
fx -= 44;
|
||||
}
|
||||
}
|
||||
|
||||
// Kickstart Accel
|
||||
if (stplyr->pflags & PF_KICKSTARTACCEL)
|
||||
{
|
||||
|
|
@ -4701,6 +4717,12 @@ static void K_drawKartSpeedometer(boolean gametypeinfoshown)
|
|||
fy += 9;
|
||||
}
|
||||
|
||||
// Adjust for Lua disabling things underneath the speedometer.
|
||||
if (!LUA_HudEnabled(hud_rings))
|
||||
{
|
||||
fy += 14;
|
||||
}
|
||||
|
||||
using srb2::Draw;
|
||||
Draw(LAPS_X+7, fy+1).flags(V_HUDTRANS|V_SLIDEIN|splitflags).align(Draw::Align::kCenter).width(42).small_sticker();
|
||||
V_DrawScaledPatch(LAPS_X+7, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_facenum[numbers[0]]);
|
||||
|
|
@ -8062,6 +8084,8 @@ void K_drawKartHUD(void)
|
|||
K_drawKartAccessibilityIcons(gametypeinfoshown, 0);
|
||||
}
|
||||
|
||||
if (LUA_HudEnabled(hud_rings))
|
||||
{
|
||||
if (gametyperules & GTR_SPHERES)
|
||||
{
|
||||
K_drawBlueSphereMeter(gametypeinfoshown);
|
||||
|
|
@ -8070,6 +8094,7 @@ void K_drawKartHUD(void)
|
|||
{
|
||||
K_drawRingCounter(gametypeinfoshown);
|
||||
}
|
||||
}
|
||||
|
||||
// This sucks, but we need to draw rings before EXP because 4P amps
|
||||
// are fuckhuge and cover gameplay info if we don't.
|
||||
|
|
|
|||
|
|
@ -6707,7 +6707,7 @@ void K_SpawnSparkleTrail(mobj_t *mo)
|
|||
if (leveltime & 2)
|
||||
index = 1;
|
||||
|
||||
invtime = mo->player->invincibilitytimer/TICRATE+1;
|
||||
invtime = mo->player ? mo->player->invincibilitytimer/TICRATE+1 : 11;
|
||||
|
||||
//CONS_Printf("%d\n", index);
|
||||
|
||||
|
|
@ -6737,7 +6737,7 @@ void K_SpawnSparkleTrail(mobj_t *mo)
|
|||
|
||||
P_SetMobjState(sparkle, K_SparkleTrailStartStates[invanimnum][index]);
|
||||
|
||||
if (mo->player->invincibilitytimer > itemtime+(2*TICRATE))
|
||||
if (mo->player && mo->player->invincibilitytimer > itemtime+(2*TICRATE))
|
||||
{
|
||||
sparkle->color = mo->color;
|
||||
sparkle->colorized = true;
|
||||
|
|
@ -8634,7 +8634,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||
mobj_t *curnext;
|
||||
mobj_t *targ = player->mo;
|
||||
|
||||
if (P_IsObjectOnGround(player->mo) && player->speed > 0)
|
||||
if (P_IsObjectOnGround(player->mo) && player->speed > 0 && player->bananadrag < 255)
|
||||
player->bananadrag++;
|
||||
|
||||
while (cur && !P_MobjWasRemoved(cur))
|
||||
|
|
|
|||
|
|
@ -236,6 +236,9 @@ static const struct {
|
|||
{META_FOLLOWER, "follower_t"},
|
||||
{META_ITEMROULETTE, "itemroulette_t"},
|
||||
{META_ITEMROULETTE_ITEMLIST, "itemroulette_t.itemlist_t"},
|
||||
|
||||
{META_SONICLOOPVARS, "sonicloopvars_t"},
|
||||
{META_SONICLOOPCAMVARS, "sonicloopcamvars_t"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
@ -3554,6 +3557,16 @@ static int lib_kIsPlayerLosing(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kGetPlayerDontDrawFlag(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, K_GetPlayerDontDrawFlag(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kIsPlayerWanted(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
|
@ -3577,6 +3590,18 @@ static int lib_kKartBouncing(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kKartPainEnergyFling(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_KartPainEnergyFling(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int lib_kMatchGenericExtraFlags(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
|
@ -3590,10 +3615,88 @@ static int lib_kMatchGenericExtraFlags(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnDashDustRelease(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_SpawnDashDustRelease(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnDriftBoostClip(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_SpawnDriftBoostClip(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnDriftBoostClipSpark(lua_State *L)
|
||||
{
|
||||
mobj_t *clip = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!clip)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnDriftBoostClipSpark(clip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnNormalSpeedLines(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_SpawnNormalSpeedLines(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnGardenTopSpeedLines(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_SpawnGardenTopSpeedLines(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnInvincibilitySpeedLines(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnInvincibilitySpeedLines(mo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnBumpEffect(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnBumpEffect(mo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kDoInstashield(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_DoInstashield(player);
|
||||
|
|
@ -3689,10 +3792,21 @@ static int lib_kTakeBumpersFromPlayer(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kMineFlashScreen(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
INLEVEL
|
||||
NOHUD
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_MineFlashScreen(source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnMineExplosion(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
UINT8 color = (UINT8)luaL_optinteger(L, 2, SKINCOLOR_KETCHUP);
|
||||
skincolornum_t color = luaL_optinteger(L, 2, SKINCOLOR_KETCHUP);
|
||||
tic_t delay = (tic_t)luaL_optinteger(L, 3, 0);
|
||||
NOHUD
|
||||
if (!source)
|
||||
|
|
@ -3701,6 +3815,30 @@ static int lib_kSpawnMineExplosion(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnLandMineExplosion(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
skincolornum_t color = luaL_optinteger(L, 2, SKINCOLOR_KETCHUP);
|
||||
tic_t delay = (tic_t)luaL_optinteger(L, 3, 0);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnLandMineExplosion(source, color, delay);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kDriftSparkColor(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
INT32 charge = luaL_checkinteger(L, 2);
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, K_DriftSparkColor(player, charge));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kSpawnBoostTrail(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
|
@ -3731,6 +3869,29 @@ static int lib_kSpawnWipeoutTrail(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnDraftDust(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnDraftDust(mo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnMagicianParticles(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
INT32 spread = luaL_optinteger(L, 2, 5);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnMagicianParticles(mo, spread);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kDriftDustHandling(lua_State *L)
|
||||
{
|
||||
mobj_t *spawner = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
|
@ -3741,6 +3902,17 @@ static int lib_kDriftDustHandling(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSquish(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_Squish(mo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kDoSneaker(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
|
@ -3813,6 +3985,39 @@ static int lib_kGetKartDriftSparkValue(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kStairJankFlip(lua_State *L)
|
||||
{
|
||||
INT32 value = luaL_checkinteger(L, 1);
|
||||
INLEVEL
|
||||
lua_pushinteger(L, K_StairJankFlip(value));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kSpawnDriftBoostExplosion(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
UINT8 stage = luaL_checkinteger(L, 2);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_SpawnDriftBoostExplosion(player, stage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnDriftElectricSparks(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
skincolornum_t color = luaL_checkinteger(L, 2);
|
||||
boolean shockwave = lua_optboolean(L, 3);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
K_SpawnDriftElectricSparks(player, color, shockwave);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kKartUpdatePosition(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
|
@ -3883,6 +4088,17 @@ static int lib_kMomentumToFacing(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kSpawnWaterRunParticles(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnWaterRunParticles(mobj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kGetKartSpeed(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
|
@ -3985,6 +4201,32 @@ static int lib_kCapsuleTimeAttackRules(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kGetInvincibilityItemFrame(lua_State *L)
|
||||
{
|
||||
INLEVEL
|
||||
lua_pushinteger(L, K_GetInvincibilityItemFrame());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kGetOrbinautItemFrame(lua_State *L)
|
||||
{
|
||||
UINT8 count = luaL_optinteger(L, 1, 1);
|
||||
lua_pushinteger(L, K_GetOrbinautItemFrame(count));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kUpdateMobjItemOverlay(lua_State *L)
|
||||
{
|
||||
mobj_t *part = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
SINT8 itemType = luaL_optinteger(L, 2, 0);
|
||||
UINT8 itemCount = luaL_optinteger(L, 3, 0);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!part)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_UpdateMobjItemOverlay(part, itemType, itemCount);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_kGetCollideAngle(lua_State *L)
|
||||
{
|
||||
|
|
@ -4778,10 +5020,19 @@ static luaL_Reg lib[] = {
|
|||
{"K_PlayPainSound", lib_kPainSound},
|
||||
{"K_PlayHitEmSound", lib_kHitEmSound},
|
||||
{"K_TryHurtSoundExchange", lib_kTryHurtSoundExchange},
|
||||
{"K_GetPlayerDontDrawFlag", lib_kGetPlayerDontDrawFlag},
|
||||
{"K_IsPlayerLosing",lib_kIsPlayerLosing},
|
||||
{"K_IsPlayerWanted",lib_kIsPlayerWanted},
|
||||
{"K_KartBouncing",lib_kKartBouncing},
|
||||
{"K_KartPainEnergyFling",lib_kKartPainEnergyFling},
|
||||
{"K_MatchGenericExtraFlags",lib_kMatchGenericExtraFlags},
|
||||
{"K_SpawnDashDustRelease",lib_kSpawnDashDustRelease},
|
||||
{"K_SpawnDriftBoostClip",lib_kSpawnDriftBoostClip},
|
||||
{"K_SpawnDriftBoostClipSpark",lib_kSpawnDriftBoostClipSpark},
|
||||
{"K_SpawnNormalSpeedLines",lib_kSpawnNormalSpeedLines},
|
||||
{"K_SpawnGardenTopSpeedLines",lib_kSpawnGardenTopSpeedLines},
|
||||
{"K_SpawnInvincibilitySpeedLines",lib_kSpawnInvincibilitySpeedLines},
|
||||
{"K_SpawnBumpEffect",lib_kSpawnBumpEffect},
|
||||
{"K_DoInstashield",lib_kDoInstashield},
|
||||
{"K_SpawnBattlePoints",lib_kSpawnBattlePoints},
|
||||
{"K_SpinPlayer",lib_kSpinPlayer},
|
||||
|
|
@ -4789,17 +5040,26 @@ static luaL_Reg lib[] = {
|
|||
{"K_StumblePlayer",lib_kStumblePlayer},
|
||||
{"K_ExplodePlayer",lib_kExplodePlayer},
|
||||
{"K_TakeBumpersFromPlayer",lib_kTakeBumpersFromPlayer},
|
||||
{"K_MineFlashScreen",lib_kMineFlashScreen},
|
||||
{"K_SpawnMineExplosion",lib_kSpawnMineExplosion},
|
||||
{"K_SpawnLandMineExplosion",lib_kSpawnLandMineExplosion},
|
||||
{"K_DriftSparkColor",lib_kDriftSparkColor},
|
||||
{"K_SpawnBoostTrail",lib_kSpawnBoostTrail},
|
||||
{"K_SpawnSparkleTrail",lib_kSpawnSparkleTrail},
|
||||
{"K_SpawnWipeoutTrail",lib_kSpawnWipeoutTrail},
|
||||
{"K_SpawnDraftDust",lib_kSpawnDraftDust},
|
||||
{"K_SpawnMagicianParticles",lib_kSpawnMagicianParticles},
|
||||
{"K_DriftDustHandling",lib_kDriftDustHandling},
|
||||
{"K_Squish",lib_kSquish},
|
||||
{"K_DoSneaker",lib_kDoSneaker},
|
||||
{"K_DoPogoSpring",lib_kDoPogoSpring},
|
||||
{"K_KillBananaChain",lib_kKillBananaChain},
|
||||
{"K_RepairOrbitChain",lib_kRepairOrbitChain},
|
||||
{"K_FindJawzTarget",lib_kFindJawzTarget},
|
||||
{"K_GetKartDriftSparkValue",lib_kGetKartDriftSparkValue},
|
||||
{"K_StairJankFlip",lib_kStairJankFlip},
|
||||
{"K_SpawnDriftBoostExplosion",lib_kSpawnDriftBoostExplosion},
|
||||
{"K_SpawnDriftElectricSparks",lib_kSpawnDriftElectricSparks},
|
||||
{"K_KartUpdatePosition",lib_kKartUpdatePosition},
|
||||
{"K_PopPlayerShield",lib_kPopPlayerShield},
|
||||
{"K_DropHnextList",lib_kDropHnextList},
|
||||
|
|
@ -4807,10 +5067,14 @@ static luaL_Reg lib[] = {
|
|||
{"K_StripItems",lib_kStripItems},
|
||||
{"K_StripOther",lib_kStripOther},
|
||||
{"K_MomentumToFacing",lib_kMomentumToFacing},
|
||||
{"K_SpawnWaterRunParticles",lib_kSpawnWaterRunParticles},
|
||||
{"K_GetKartSpeed",lib_kGetKartSpeed},
|
||||
{"K_GetKartAccel",lib_kGetKartAccel},
|
||||
{"K_GetKartFlashing",lib_kGetKartFlashing},
|
||||
{"K_GetItemPatch",lib_kGetItemPatch},
|
||||
{"K_GetInvincibilityItemFrame",lib_kGetInvincibilityItemFrame},
|
||||
{"K_GetOrbinautItemFrame",lib_kGetOrbinautItemFrame},
|
||||
{"K_UpdateMobjItemOverlay",lib_kUpdateMobjItemOverlay},
|
||||
{"K_GetCollideAngle",lib_kGetCollideAngle},
|
||||
{"K_AddHitLag",lib_kAddHitLag},
|
||||
{"K_GetShieldFromItem",lib_kGetShieldFromItem},
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ enum hud {
|
|||
hud_speedometer,
|
||||
hud_freeplay,
|
||||
hud_rankings, // Tab rankings
|
||||
hud_rings, // Rings and Spheres HUD element
|
||||
|
||||
// Intermission
|
||||
hud_intermissiontally,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ static const char *const hud_disable_options[] = {
|
|||
"speedometer",
|
||||
"freeplay",
|
||||
"rankings",
|
||||
"rings",
|
||||
|
||||
"intermissiontally",
|
||||
"intermissionmessages",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ extern lua_State *gL;
|
|||
#define META_ITEMROULETTE "ITEMROULETTE_T"
|
||||
#define META_ITEMROULETTE_ITEMLIST "ITEMROULETTE_T.ITEMLIST"
|
||||
|
||||
#define META_SONICLOOPVARS "SONICLOOPVARS_T*"
|
||||
#define META_SONICLOOPCAMVARS "SONICLOOPCAMVARS_T*"
|
||||
|
||||
boolean luaL_checkboolean(lua_State *L, int narg);
|
||||
|
||||
int LUA_EnumLib(lua_State *L);
|
||||
|
|
|
|||
|
|
@ -757,6 +757,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, playerpingtable[( plr - players )]);
|
||||
else if (fastcmp(field, "publickey"))
|
||||
lua_pushstring(L, GetPrettyRRID(plr->public_key, false));
|
||||
else if (fastcmp(field, "loop"))
|
||||
LUA_PushUserdata(L, &plr->loop, META_SONICLOOPVARS);
|
||||
else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
|
@ -1396,6 +1398,8 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"fovadd"))
|
||||
plr->fovadd = luaL_checkfixed(L, 3);
|
||||
#endif
|
||||
else if (fastcmp(field, "loop"))
|
||||
return NOSET;
|
||||
else {
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||
I_Assert(lua_istable(L, -1));
|
||||
|
|
@ -1601,6 +1605,162 @@ static int respawn_set(lua_State *L)
|
|||
#undef RNOFIELD
|
||||
#undef RUNIMPLEMENTED
|
||||
|
||||
enum sonicloopvars {
|
||||
sonicloopvars_radius = 0,
|
||||
sonicloopvars_revolution,
|
||||
sonicloopvars_min_revolution,
|
||||
sonicloopvars_max_revolution,
|
||||
sonicloopvars_yaw,
|
||||
sonicloopvars_origin_x,
|
||||
sonicloopvars_origin_y,
|
||||
sonicloopvars_origin_z,
|
||||
sonicloopvars_origin_shift_x,
|
||||
sonicloopvars_origin_shift_y,
|
||||
sonicloopvars_shift_x,
|
||||
sonicloopvars_shift_y,
|
||||
sonicloopvars_flip,
|
||||
sonicloopvars_camera,
|
||||
};
|
||||
|
||||
static const char *const sonicloopvars_opt[] = {
|
||||
"radius",
|
||||
"revolution",
|
||||
"min_revolution",
|
||||
"max_revolution",
|
||||
"yaw",
|
||||
"origin_x",
|
||||
"origin_y",
|
||||
"origin_z",
|
||||
"origin_shift_x",
|
||||
"origin_shift_y",
|
||||
"shift_x",
|
||||
"shift_y",
|
||||
"flip",
|
||||
"camera",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int sonicloopvars_get(lua_State *L)
|
||||
{
|
||||
sonicloopvars_t *sonicloopvars = *((sonicloopvars_t **)luaL_checkudata(L, 1, META_SONICLOOPVARS));
|
||||
enum sonicloopvars field = luaL_checkoption(L, 2, NULL, sonicloopvars_opt);
|
||||
|
||||
// This should always be valid.
|
||||
I_Assert(sonicloopvars != NULL);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case sonicloopvars_radius:
|
||||
lua_pushfixed(L, sonicloopvars->radius);
|
||||
break;
|
||||
case sonicloopvars_revolution:
|
||||
lua_pushfixed(L, sonicloopvars->revolution);
|
||||
break;
|
||||
case sonicloopvars_min_revolution:
|
||||
lua_pushfixed(L, sonicloopvars->min_revolution);
|
||||
break;
|
||||
case sonicloopvars_max_revolution:
|
||||
lua_pushfixed(L, sonicloopvars->max_revolution);
|
||||
break;
|
||||
case sonicloopvars_yaw:
|
||||
lua_pushangle(L, sonicloopvars->yaw);
|
||||
break;
|
||||
case sonicloopvars_origin_x:
|
||||
lua_pushfixed(L, sonicloopvars->origin.x);
|
||||
break;
|
||||
case sonicloopvars_origin_y:
|
||||
lua_pushfixed(L, sonicloopvars->origin.y);
|
||||
break;
|
||||
case sonicloopvars_origin_z:
|
||||
lua_pushfixed(L, sonicloopvars->origin.z);
|
||||
break;
|
||||
case sonicloopvars_origin_shift_x:
|
||||
lua_pushfixed(L, sonicloopvars->origin_shift.x);
|
||||
break;
|
||||
case sonicloopvars_origin_shift_y:
|
||||
lua_pushfixed(L, sonicloopvars->origin_shift.y);
|
||||
break;
|
||||
case sonicloopvars_shift_x:
|
||||
lua_pushfixed(L, sonicloopvars->shift.x);
|
||||
break;
|
||||
case sonicloopvars_shift_y:
|
||||
lua_pushfixed(L, sonicloopvars->shift.y);
|
||||
break;
|
||||
case sonicloopvars_flip:
|
||||
lua_pushboolean(L, sonicloopvars->flip);
|
||||
break;
|
||||
case sonicloopvars_camera:
|
||||
LUA_PushUserdata(L, &sonicloopvars->camera, META_SONICLOOPCAMVARS);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
enum sonicloopcamvars {
|
||||
sonicloopcamvars_enter_tic = 0,
|
||||
sonicloopcamvars_exit_tic,
|
||||
sonicloopcamvars_zoom_in_speed,
|
||||
sonicloopcamvars_zoom_out_speed,
|
||||
sonicloopcamvars_dist,
|
||||
sonicloopcamvars_pan,
|
||||
sonicloopcamvars_pan_speed,
|
||||
sonicloopcamvars_pan_accel,
|
||||
sonicloopcamvars_pan_back,
|
||||
};
|
||||
|
||||
static const char *const sonicloopcamvars_opt[] = {
|
||||
"enter_tic",
|
||||
"exit_tic",
|
||||
"zoom_in_speed",
|
||||
"zoom_out_speed",
|
||||
"dist",
|
||||
"pan",
|
||||
"pan_speed",
|
||||
"pan_accel",
|
||||
"pan_back",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int sonicloopcamvars_get(lua_State *L)
|
||||
{
|
||||
sonicloopcamvars_t *sonicloopcamvars = *((sonicloopcamvars_t **)luaL_checkudata(L, 1, META_SONICLOOPCAMVARS));
|
||||
enum sonicloopcamvars field = luaL_checkoption(L, 2, NULL, sonicloopcamvars_opt);
|
||||
|
||||
// This should always be valid.
|
||||
I_Assert(sonicloopcamvars != NULL);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case sonicloopcamvars_enter_tic:
|
||||
lua_pushinteger(L, sonicloopcamvars->enter_tic);
|
||||
break;
|
||||
case sonicloopcamvars_exit_tic:
|
||||
lua_pushinteger(L, sonicloopcamvars->exit_tic);
|
||||
break;
|
||||
case sonicloopcamvars_zoom_in_speed:
|
||||
lua_pushinteger(L, sonicloopcamvars->zoom_in_speed);
|
||||
break;
|
||||
case sonicloopcamvars_zoom_out_speed:
|
||||
lua_pushinteger(L, sonicloopcamvars->zoom_out_speed);
|
||||
break;
|
||||
case sonicloopcamvars_dist:
|
||||
lua_pushfixed(L, sonicloopcamvars->dist);
|
||||
break;
|
||||
case sonicloopcamvars_pan:
|
||||
lua_pushangle(L, sonicloopcamvars->pan);
|
||||
break;
|
||||
case sonicloopcamvars_pan_speed:
|
||||
lua_pushfixed(L, sonicloopcamvars->pan_speed);
|
||||
break;
|
||||
case sonicloopcamvars_pan_accel:
|
||||
lua_pushinteger(L, sonicloopcamvars->pan_accel);
|
||||
break;
|
||||
case sonicloopcamvars_pan_back:
|
||||
lua_pushinteger(L, sonicloopcamvars->pan_back);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LUA_PlayerLib(lua_State *L)
|
||||
{
|
||||
|
|
@ -1642,6 +1802,16 @@ int LUA_PlayerLib(lua_State *L)
|
|||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L,1);
|
||||
|
||||
luaL_newmetatable(L, META_SONICLOOPVARS);
|
||||
lua_pushcfunction(L, sonicloopvars_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L,1);
|
||||
|
||||
luaL_newmetatable(L, META_SONICLOOPCAMVARS);
|
||||
lua_pushcfunction(L, sonicloopcamvars_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, lib_getPlayer);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue