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