Fix Alt invin conflict with rings and expose some of it to lua
This commit is contained in:
parent
05647a9633
commit
d164d97fc0
9 changed files with 51 additions and 19 deletions
|
|
@ -1570,5 +1570,10 @@ struct int_const_s const INT_CONST[] = {
|
|||
{"FACE_MINIMAP", FACE_MINIMAP},
|
||||
{"NUMFACES", NUMFACES},
|
||||
|
||||
// invintype
|
||||
{"KARTINVIN_LEGACY", KARTINVIN_LEGACY},
|
||||
{"KARTINVIN_ALTERN", KARTINVIN_ALTERN},
|
||||
|
||||
|
||||
{NULL,0}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2)
|
|||
boolean t2Condition = false;
|
||||
|
||||
// Rim suggestion: Flipover damage is negligible at best, just cull it from Invincibility as a whole.
|
||||
if (invintype == KARTINVIN_LEGACY)
|
||||
if (K_GetKartInvinType() == KARTINVIN_LEGACY)
|
||||
{
|
||||
t1Condition = (t1->player->invincibilitytimer > 0);
|
||||
t2Condition = (t2->player->invincibilitytimer > 0);
|
||||
|
|
@ -706,7 +706,7 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2)
|
|||
K_DoInstashield(t2->player);
|
||||
return false;
|
||||
}
|
||||
else if (invintype == KARTINVIN_LEGACY)
|
||||
else if (K_GetKartInvinType() == KARTINVIN_LEGACY)
|
||||
{
|
||||
if (t1Condition == true && t2Condition == false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1252,7 +1252,7 @@ static void K_drawKartItem(void)
|
|||
else
|
||||
localpatch = kp_nodraw;
|
||||
}
|
||||
else if ((stplyr->invincibilitytimer) && (invintype == KARTINVIN_ALTERN))
|
||||
else if ((stplyr->invincibilitytimer) && (K_GetKartInvinType() == KARTINVIN_ALTERN))
|
||||
{
|
||||
itembar = stplyr->invincibilitytimer;
|
||||
maxl = max(1, stplyr->maxinvincibilitytime);
|
||||
|
|
@ -1897,7 +1897,7 @@ static boolean K_drawKartPositionFaces(void)
|
|||
|
||||
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin][FACE_RANK], colormap);
|
||||
|
||||
if ((players[rankplayer[i]].invincibilitytimer) && (invintype == KARTINVIN_ALTERN))
|
||||
if ((players[rankplayer[i]].invincibilitytimer) && (K_GetKartInvinType() == KARTINVIN_ALTERN))
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(leveltime / 2), GTC_CACHE);
|
||||
invinchudtrans = K_InvincibilityHUDVisibility(players[rankplayer[i]].invincibilitytimer);
|
||||
|
|
@ -3681,7 +3681,7 @@ static void K_drawKartMinimap(void)
|
|||
|
||||
colorizeplayer = players[i].mo->colorized;
|
||||
|
||||
if ((players[i].invincibilitytimer) && ((K_InvincibilityGradient(players[i].invincibilitytimer) > (FRACUNIT/2)) || (invintype == KARTINVIN_LEGACY)))
|
||||
if ((players[i].invincibilitytimer) && ((K_InvincibilityGradient(players[i].invincibilitytimer) > (FRACUNIT/2)) || (K_GetKartInvinType() == KARTINVIN_LEGACY)))
|
||||
{
|
||||
usecolor = (K_RainbowColor(leveltime / 2));
|
||||
colorizeplayer = true;
|
||||
|
|
@ -3852,7 +3852,7 @@ static void K_drawKartMinimap(void)
|
|||
|
||||
if ((players[localplayers[i]].invincibilitytimer) &&
|
||||
((K_InvincibilityGradient(players[localplayers[i]].invincibilitytimer) >
|
||||
(FRACUNIT / 2)) || (invintype == KARTINVIN_LEGACY)))
|
||||
(FRACUNIT / 2)) || (K_GetKartInvinType() == KARTINVIN_LEGACY)))
|
||||
{
|
||||
usecolor = (K_RainbowColor(leveltime / 2));
|
||||
colorizeplayer = true;
|
||||
|
|
|
|||
28
src/k_kart.c
28
src/k_kart.c
|
|
@ -898,7 +898,7 @@ INT32 K_KartGetItemOdds(
|
|||
notNearEnd = true;
|
||||
break;
|
||||
case KITEM_INVINCIBILITY:
|
||||
if (invintype == KARTINVIN_ALTERN)
|
||||
if (K_GetKartInvinType() == KARTINVIN_ALTERN)
|
||||
{
|
||||
// It's a power item, yes, but we don't want mashing to lessen
|
||||
// its chances, so we lie to the game's face.
|
||||
|
|
@ -1102,7 +1102,7 @@ INT32 K_KartGetLegacyItemOdds(UINT8 pos, SINT8 item, fixed_t clusterDist, fixed_
|
|||
powerItem = true;
|
||||
break;
|
||||
case KITEM_INVINCIBILITY:
|
||||
if (invintype == KARTINVIN_ALTERN)
|
||||
if (K_GetKartInvinType() == KARTINVIN_ALTERN)
|
||||
{
|
||||
// It's a power item, yes, but we don't want mashing to lessen
|
||||
// its chances, so we lie to the game's face.
|
||||
|
|
@ -2312,7 +2312,7 @@ static fixed_t K_CheckOffroadCollide(mobj_t *mo)
|
|||
static fixed_t K_OffroadGradient(player_t *player, fixed_t offroad)
|
||||
{
|
||||
// At 50% or lower Invincibility, offroad creeps up on you.
|
||||
fixed_t invinoffroad = (invintype == KARTINVIN_LEGACY) ? ((player->invincibilitytimer) ? FRACUNIT : 0) : min(FRACUNIT, K_InvincibilityGradient(player->invincibilitytimer) << 1);
|
||||
fixed_t invinoffroad = (K_GetKartInvinType() == KARTINVIN_LEGACY) ? ((player->invincibilitytimer) ? FRACUNIT : 0) : min(FRACUNIT, K_InvincibilityGradient(player->invincibilitytimer) << 1);
|
||||
fixed_t fac = CLAMP(FRACUNIT - invinoffroad, 0, FRACUNIT);
|
||||
|
||||
return FixedMul(offroad, fac);
|
||||
|
|
@ -3578,7 +3578,7 @@ UINT16 K_GetInvincibilityTime(player_t *player)
|
|||
{
|
||||
UINT32 i, pingame;
|
||||
|
||||
if (invintype == KARTINVIN_LEGACY)
|
||||
if (K_GetKartInvinType() == KARTINVIN_LEGACY)
|
||||
return BASEINVINTIME;
|
||||
|
||||
pingame = 0;
|
||||
|
|
@ -3603,7 +3603,7 @@ UINT16 K_GetInvincibilityTime(player_t *player)
|
|||
|
||||
static fixed_t K_GetInvincibilitySpeed(UINT16 time)
|
||||
{
|
||||
if (invintype == KARTINVIN_LEGACY)
|
||||
if (K_GetKartInvinType() == KARTINVIN_LEGACY)
|
||||
return INVINSPEEDBOOSTLGC;
|
||||
|
||||
fixed_t t = min(FRACUNIT, K_InvincibilityGradient(time));
|
||||
|
|
@ -3612,7 +3612,7 @@ static fixed_t K_GetInvincibilitySpeed(UINT16 time)
|
|||
|
||||
static fixed_t K_GetInvincibilityAccel(UINT16 time)
|
||||
{
|
||||
if (invintype == KARTINVIN_LEGACY)
|
||||
if (K_GetKartInvinType() == KARTINVIN_LEGACY)
|
||||
return INVINACCELBOOSTLGC;
|
||||
|
||||
fixed_t t = min(FRACUNIT, K_InvincibilityGradient(time));
|
||||
|
|
@ -5968,7 +5968,7 @@ void K_DoInvincibility(player_t *player, tic_t time)
|
|||
overlay->destscale = player->mo->scale;
|
||||
P_SetScale(overlay, player->mo->scale);
|
||||
|
||||
if (invintype == KARTINVIN_ALTERN)
|
||||
if (K_GetKartInvinType() == KARTINVIN_ALTERN)
|
||||
{
|
||||
mobj_t *aura = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_OVERLAY);
|
||||
P_SetTarget(&aura->target, player->mo);
|
||||
|
|
@ -5978,7 +5978,7 @@ void K_DoInvincibility(player_t *player, tic_t time)
|
|||
}
|
||||
}
|
||||
|
||||
if (invintype == KARTINVIN_ALTERN)
|
||||
if (K_GetKartInvinType() == KARTINVIN_ALTERN)
|
||||
{
|
||||
// Rim suggestion: Don't allow already invincible players to chain.
|
||||
if (K_InvincibilityGradient(player->invincibilitytimer) < (FRACUNIT/2))
|
||||
|
|
@ -7863,7 +7863,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
if (player->invincibilitytimer)
|
||||
{
|
||||
INT16 invinfac = 1;
|
||||
if ((invintype == KARTINVIN_ALTERN) && ((INT16)(player->invincibilitybottleneck) != -1) && (player->invincibilitytimer > 2))
|
||||
if ((K_GetKartInvinType() == KARTINVIN_ALTERN) && ((INT16)(player->invincibilitybottleneck) != -1) && (player->invincibilitytimer > 2))
|
||||
{
|
||||
UINT32 invindist = INVINDIST >> 2;
|
||||
if (player->distancefromcluster < invindist)
|
||||
|
|
@ -8204,7 +8204,7 @@ void K_KartResetPlayerColor(player_t *player)
|
|||
{
|
||||
boolean skip = false;
|
||||
|
||||
if (invintype == KARTINVIN_LEGACY)
|
||||
if (K_GetKartInvinType() == KARTINVIN_LEGACY)
|
||||
{
|
||||
fullbright = true;
|
||||
|
||||
|
|
@ -10663,7 +10663,7 @@ void K_UnsetItemOut(player_t *player)
|
|||
|
||||
static boolean K_InvincibilitySlotHogging(player_t *player)
|
||||
{
|
||||
if (invintype == KARTINVIN_LEGACY)
|
||||
if (K_GetKartInvinType() == KARTINVIN_LEGACY)
|
||||
return false;
|
||||
|
||||
return ((player->invincibilitytimer) != 0);
|
||||
|
|
@ -10705,6 +10705,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
|| player->itemroulette
|
||||
|| player->rocketsneakertimer
|
||||
|| player->eggmanexplode
|
||||
|| ((K_GetKartInvinType() == KARTINVIN_ALTERN) && player->invincibilitytimer)
|
||||
|| (player->growshrinktimer > 0)
|
||||
|| player->flametimer
|
||||
|| (leveltime < starttime)))
|
||||
|
|
@ -11778,6 +11779,11 @@ boolean K_SlopeBoostActive(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean K_GetKartInvinType(void)
|
||||
{
|
||||
return invintype;
|
||||
}
|
||||
|
||||
boolean K_UsingLegacyCheckpoints(void)
|
||||
{
|
||||
if (K_UsingPatchedMap() && waypointcap)
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ boolean K_StackingActive(void);
|
|||
boolean K_ChainingActive(void);
|
||||
boolean K_SlipdashActive(void);
|
||||
boolean K_SlopeBoostActive(void);
|
||||
boolean K_GetKartInvinType(void);
|
||||
boolean K_BoostChain(player_t *player, INT32 timer, boolean chainsound);
|
||||
INT32 K_ChainOrDeincrementTime(player_t *player, INT32 timer, INT32 deincrement, boolean chainsound);
|
||||
boolean K_UsingLegacyCheckpoints(void);
|
||||
|
|
|
|||
|
|
@ -4066,6 +4066,13 @@ static int lib_kSlopeBoostActive(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Grabs the currently active invintype.
|
||||
static int lib_kGetKartInvinType(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, K_GetKartInvinType());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Checks if current map is using legacy boss3 bassed checkpoints. Useful for map compat.
|
||||
static int lib_kUsingLegacyCheckpoints(lua_State *L)
|
||||
{
|
||||
|
|
@ -4646,6 +4653,7 @@ static luaL_Reg lib[] = {
|
|||
{"K_ChainingActive",lib_kChainingActive},
|
||||
{"K_SlipdashActive",lib_kSlipdashActive},
|
||||
{"K_SlopeBoostActive",lib_kSlopeBoostActive},
|
||||
{"K_GetKartInvinType",lib_kGetKartInvinType},
|
||||
{"K_UsingLegacyCheckpoints",lib_kUsingLegacyCheckpoints},
|
||||
{"K_DoBoost",lib_kDoBoost},
|
||||
{"K_ClearBoost",lib_kClearBoost},
|
||||
|
|
|
|||
|
|
@ -386,6 +386,18 @@ int LUA_PushGlobals(lua_State *L, const char *word)
|
|||
} else if (fastcmp(word,"chainingactive")) {
|
||||
lua_pushinteger(L, chainingactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"slipdashactive")) {
|
||||
lua_pushinteger(L, slipdashactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"slopeboostactive")) {
|
||||
lua_pushinteger(L, slopeboostactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"purpledriftactive")) {
|
||||
lua_pushinteger(L, purpledriftactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"invintype")) {
|
||||
lua_pushinteger(L, invintype);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"hyubgone")) {
|
||||
lua_pushinteger(L, hyubgone);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon)
|
|||
if (player->stealingtimer || player->stolentimer
|
||||
|| player->rocketsneakertimer
|
||||
|| player->eggmanexplode
|
||||
|| ((invintype == KARTINVIN_ALTERN) && (player->invincibilitytimer))
|
||||
|| ((K_GetKartInvinType() == KARTINVIN_ALTERN) && (player->invincibilitytimer))
|
||||
|| (player->growshrinktimer > 0)
|
||||
|| player->flametimer)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -2224,7 +2224,7 @@ void P_MovePlayer(player_t *player)
|
|||
if ((player->invincibilitytimer > 0) &&
|
||||
(((leveltime %
|
||||
max(1, 10 - FixedMul(9, K_InvincibilityGradient(player->invincibilitytimer)))) == 0) ||
|
||||
(invintype == KARTINVIN_LEGACY)))
|
||||
(K_GetKartInvinType() == KARTINVIN_LEGACY)))
|
||||
{
|
||||
K_SpawnSparkleTrail(player->mo);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue