Merge branch 'sweet-new-kicks' into 'master'

Sweet new kicks

See merge request KartKrew/Kart!39
This commit is contained in:
Sal 2018-10-19 15:49:51 -04:00
commit ab4bf563e0
8 changed files with 273 additions and 53 deletions

View file

@ -6313,6 +6313,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_WIPEOUTTRAIL4",
"S_WIPEOUTTRAIL5",
// Rocket sneaker
"S_ROCKETSNEAKER_L",
"S_ROCKETSNEAKER_R",
"S_ROCKETSNEAKER_LVIBRATE",
"S_ROCKETSNEAKER_RVIBRATE",
//{ Eggman Monitor
"S_FAKEITEM1",
"S_FAKEITEM2",
@ -7296,6 +7302,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_DRIFTSPARK",
"MT_DRIFTDUST",
"MT_ROCKETSNEAKER", // Rocket sneakers
"MT_FAKESHIELD",
"MT_FAKEITEM",

View file

@ -56,12 +56,12 @@ char sprnames[NUMSPRITES + 1][5] =
"SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO",
//SRB2kart Sprites
"SPRG","BSPR","RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE",
"KINV","KINF","WIPD","DRIF","DUST","FITM","BANA","ORBN","JAWZ","SSMN",
"KRBM","BHOG","BHBM","BLIG","LIGH","THNS","SINK","SITR","KBLN","DEZL",
"POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM","SACO",
"CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB","ARRO",
"ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK","LZI1",
"LZI2","KLIT","VIEW"
"KINV","KINF","WIPD","DRIF","DUST","RSHE","FITM","BANA","ORBN","JAWZ",
"SSMN","KRBM","BHOG","BHBM","BLIG","LIGH","THNS","SINK","SITR","KBLN",
"DEZL","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM",
"SACO","CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB",
"ARRO","ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK",
"LZI1","LZI2","KLIT","VIEW"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@ -2623,6 +2623,11 @@ state_t states[NUMSTATES] =
{SPR_WIPD, 3, 3, {NULL}, 0, 0, S_WIPEOUTTRAIL5}, // S_WIPEOUTTRAIL4
{SPR_WIPD, 4, 3, {NULL}, 0, 0, S_NULL}, // S_WIPEOUTTRAIL5
{SPR_RSHE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_L
{SPR_RSHE, 1, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_R
{SPR_RSHE, 2, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_LVIBRATE
{SPR_RSHE, 3, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_RVIBRATE
{SPR_FITM, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM2}, // S_FAKEITEM1
{SPR_FITM, 1|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM3}, // S_FAKEITEM2
{SPR_FITM, 2|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM4}, // S_FAKEITEM3
@ -14803,6 +14808,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_ROCKETSNEAKER
-1, // doomednum
S_ROCKETSNEAKER_L, // spawnstate
1, // spawnhealth
S_NULL, // seestate
sfx_tossed, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_s3k5d, // deathsound
0, // speed
16*FRACUNIT, // radius
16*FRACUNIT, // height
0, // display offset
0, // mass
0, // damage
sfx_s3kc0s, // activesound
MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FAKESHIELD
-1, // doomednum
S_FAKEITEM1, // spawnstate

View file

@ -596,6 +596,7 @@ typedef enum sprite
SPR_DUST, // Drift Dust
// Kart Items
SPR_RSHE, // Rocket sneaker
SPR_FITM, // Eggman Monitor
SPR_BANA, // Banana Peel
SPR_ORBN, // Orbinaut
@ -3155,6 +3156,12 @@ typedef enum state
S_WIPEOUTTRAIL4,
S_WIPEOUTTRAIL5,
// Rocket sneaker
S_ROCKETSNEAKER_L,
S_ROCKETSNEAKER_R,
S_ROCKETSNEAKER_LVIBRATE,
S_ROCKETSNEAKER_RVIBRATE,
//{ Eggman Monitor
S_FAKEITEM1,
S_FAKEITEM2,
@ -4155,6 +4162,8 @@ typedef enum mobj_type
MT_DRIFTSPARK,
MT_DRIFTDUST,
MT_ROCKETSNEAKER,
MT_FAKESHIELD,
MT_FAKEITEM,

View file

@ -2962,35 +2962,66 @@ static void K_DoHyudoroSteal(player_t *player)
}
}
void K_DoSneaker(player_t *player, boolean doPFlag)
void K_DoSneaker(player_t *player, INT32 type)
{
const fixed_t prevboost = player->kartstuff[k_speedboost];
fixed_t intendedboost;
switch (gamespeed)
{
case 0:
intendedboost = 53740+768;
break;
case 2:
intendedboost = 17294+768;
break;
default:
intendedboost = 32768;
break;
}
if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3)
{
S_StartSound(player->mo, sfx_cdfm01);
K_SpawnDashDustRelease(player);
if (intendedboost > player->kartstuff[k_speedboost])
player->kartstuff[k_destboostcam] = FixedMul(FRACUNIT, FixedDiv((intendedboost - player->kartstuff[k_speedboost]), intendedboost));
}
if (!player->kartstuff[k_sneakertimer])
{
if (type == 2)
{
if (player->mo->hnext)
{
mobj_t *cur = player->mo->hnext;
while (cur && !P_MobjWasRemoved(cur))
{
if (!cur->tracer)
{
mobj_t *overlay = P_SpawnMobj(cur->x, cur->y, cur->z, MT_BOOSTFLAME);
P_SetTarget(&overlay->target, cur);
P_SetTarget(&cur->tracer, overlay);
P_SetScale(overlay, (overlay->destscale = 3*cur->scale/4));
}
cur = cur->hnext;
}
}
}
else
{
mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BOOSTFLAME);
P_SetTarget(&overlay->target, player->mo);
overlay->destscale = player->mo->scale;
P_SetScale(overlay, player->mo->scale);
P_SetScale(overlay, (overlay->destscale = player->mo->scale));
}
}
player->kartstuff[k_sneakertimer] = sneakertime;
if (doPFlag)
if (type != 0)
{
player->pflags |= PF_ATTACKDOWN;
K_PlayBoostTaunt(player->mo);
}
K_GetKartBoostPower(player);
if (player->kartstuff[k_speedboost] > prevboost)
player->kartstuff[k_destboostcam] = FRACUNIT;
}
static void K_DoShrink(player_t *player)
@ -3201,6 +3232,7 @@ void K_DropHnextList(player_t *player)
break;
// intentionally do nothing
case MT_SINK_SHIELD:
case MT_ROCKETSNEAKER:
return;
default:
continue;
@ -3548,6 +3580,93 @@ static void K_MoveHeldObjects(player_t *player)
}
}
break;
case MT_ROCKETSNEAKER: // Special rocket sneaker stuff
{
mobj_t *cur = player->mo->hnext;
INT32 num = 0;
while (cur && !P_MobjWasRemoved(cur))
{
const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius);
boolean vibrate = ((leveltime & 1) && !cur->tracer);
angle_t angoffset;
fixed_t targx, targy, targz;
cur->flags &= ~MF_NOCLIPTHING;
if (player->kartstuff[k_rocketsneakertimer] <= TICRATE && (leveltime & 1))
cur->flags2 |= MF2_DONTDRAW;
else
cur->flags2 &= ~MF2_DONTDRAW;
if (num & 1)
P_SetMobjStateNF(cur, (vibrate ? S_ROCKETSNEAKER_LVIBRATE : S_ROCKETSNEAKER_L));
else
P_SetMobjStateNF(cur, (vibrate ? S_ROCKETSNEAKER_RVIBRATE : S_ROCKETSNEAKER_R));
if (!player->kartstuff[k_rocketsneakertimer] || cur->extravalue2 || !cur->health)
{
num = (num+1) % 2;
cur = cur->hnext;
continue;
}
if (cur->extravalue1 < radius)
cur->extravalue1 += FixedMul(P_AproxDistance(cur->extravalue1, radius), FRACUNIT/12);
if (cur->extravalue1 > radius)
cur->extravalue1 = radius;
// Shrink your items if the player shrunk too.
P_SetScale(cur, (cur->destscale = FixedMul(FixedDiv(cur->extravalue1, radius), player->mo->scale)));
#if 1
{
angle_t input = player->mo->angle - cur->angle;
boolean invert = (input > ANGLE_180);
if (invert)
input = InvAngle(input);
input = FixedAngle(AngleFixed(input)/4);
if (invert)
input = InvAngle(input);
cur->angle = cur->angle + input;
}
#else
cur->angle = player->mo->angle;
#endif
angoffset = ANGLE_90 + (ANGLE_180 * num);
targx = player->mo->x + P_ReturnThrustX(cur, cur->angle + angoffset, cur->extravalue1);
targy = player->mo->y + P_ReturnThrustY(cur, cur->angle + angoffset, cur->extravalue1);
{ // bobbing, copy pasted from my kimokawaiii entry
const fixed_t pi = (22<<FRACBITS) / 7; // loose approximation, this doesn't need to be incredibly precise
fixed_t sine = 8 * FINESINE((((2*pi*(4*TICRATE)) * leveltime)>>ANGLETOFINESHIFT) & FINEMASK);
targz = (player->mo->z + (player->mo->height/2)) + sine;
}
if (cur->tracer)
{
fixed_t diffx, diffy, diffz;
diffx = targx - cur->x;
diffy = targy - cur->y;
diffz = targz - cur->z;
P_TeleportMove(cur->tracer, cur->tracer->x + diffx + P_ReturnThrustX(cur, cur->angle + angoffset, 6*cur->scale),
cur->tracer->y + diffy + P_ReturnThrustY(cur, cur->angle + angoffset, 6*cur->scale), cur->tracer->z + diffz);
P_SetScale(cur->tracer, (cur->tracer->destscale = 3*cur->scale/4));
}
P_TeleportMove(cur, targx, targy, targz);
num = (num+1) % 2;
cur = cur->hnext;
}
}
break;
default:
break;
}
@ -4573,9 +4692,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
else if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO
&& player->kartstuff[k_rocketsneakertimer] > 1)
{
K_DoSneaker(player, true);
K_DoSneaker(player, 2);
K_PlayBoostTaunt(player->mo);
player->kartstuff[k_rocketsneakertimer] -= 5;
player->kartstuff[k_rocketsneakertimer] -= 2*TICRATE;
if (player->kartstuff[k_rocketsneakertimer] < 1)
player->kartstuff[k_rocketsneakertimer] = 1;
}
@ -4590,7 +4709,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
case KITEM_SNEAKER:
if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO)
{
K_DoSneaker(player, true);
K_DoSneaker(player, 1);
K_PlayBoostTaunt(player->mo);
player->kartstuff[k_itemamount]--;
}
@ -4599,10 +4718,33 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO
&& player->kartstuff[k_rocketsneakertimer] == 0)
{
K_DoSneaker(player, true);
INT32 moloop;
mobj_t *mo = NULL;
mobj_t *prev = player->mo;
K_PlayBoostTaunt(player->mo);
player->kartstuff[k_rocketsneakertimer] = itemtime;
//player->kartstuff[k_itemheld] = 1;
S_StartSound(player->mo, sfx_s3k3a);
//K_DoSneaker(player, 2);
player->kartstuff[k_rocketsneakertimer] = (itemtime*3);
player->kartstuff[k_itemamount]--;
K_UpdateHnextList(player, true);
for (moloop = 0; moloop < 2; moloop++)
{
mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_ROCKETSNEAKER);
mo->flags |= MF_NOCLIPTHING;
mo->angle = player->mo->angle;
mo->threshold = 10;
mo->movecount = moloop%2;
mo->movedir = mo->lastlook = moloop+1;
P_SetTarget(&mo->target, player->mo);
P_SetTarget(&mo->hprev, prev);
P_SetTarget(&prev->hnext, mo);
prev = mo;
}
}
break;
case KITEM_INVINCIBILITY:
@ -5108,7 +5250,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_boostcharge] <= 36)
{
player->kartstuff[k_startboost] = 0;
K_DoSneaker(player, false);
K_DoSneaker(player, 0);
player->kartstuff[k_sneakertimer] = 70; // PERFECT BOOST!!
if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) // Let everyone hear this one
@ -6018,9 +6160,10 @@ static void K_drawKartItem(void)
// Extensible meter, currently only used for rocket sneaker...
if (itembar && hudtrans)
{
const INT32 barlength = (splitscreen > 1 ? 12 : 24);
const INT32 max = itemtime; // timer's normal highest value
const INT32 length = min(barlength, (itembar * barlength) / max);
const INT32 barlength = (splitscreen > 1 ? 12 : 26);
const INT32 maxl = (itemtime*3) - barlength; // timer's normal highest value
const INT32 fill = ((itembar*barlength)/maxl);
const INT32 length = min(barlength, fill);
const INT32 height = (offset ? 1 : 2);
const INT32 x = (offset ? 17 : 11), y = (offset ? 27 : 35);

View file

@ -36,7 +36,7 @@ void K_SpawnBoostTrail(player_t *player);
void K_SpawnSparkleTrail(mobj_t *mo);
void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent);
void K_DriftDustHandling(mobj_t *spawner);
void K_DoSneaker(player_t *player, boolean doPFlag);
void K_DoSneaker(player_t *player, INT32 type);
void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound);
void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source);
void K_UpdateHnextList(player_t *player, boolean clean);

View file

@ -2222,11 +2222,11 @@ static int lib_kDriftDustHandling(lua_State *L)
static int lib_kDoSneaker(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
boolean doPFlag = luaL_checkboolean(L, 2);
INT32 type = luaL_checkinteger(L, 2);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_DoSneaker(player, doPFlag);
K_DoSneaker(player, type);
return 0;
}

View file

@ -6639,20 +6639,7 @@ void P_MobjThinker(mobj_t *mobj)
case MT_SSMINE_SHIELD:
case MT_FAKESHIELD:
case MT_SINK_SHIELD:
/*if (mobj->health > 0 && mobj->target && mobj->target->player
&& mobj->target->player->health > 0 && !mobj->target->player->spectator)
{
// Was this so hard? -- Handled this with K_UpdateHnextList instead of thinking it away...
if ((mobj->type == MT_ORBINAUT_SHIELD && mobj->target->player->kartstuff[k_itemtype] != KITEM_ORBINAUT)
|| (mobj->type == MT_JAWZ_SHIELD && mobj->target->player->kartstuff[k_itemtype] != KITEM_JAWZ)
|| (mobj->movedir > 0 && ((UINT16)mobj->target->player->kartstuff[k_itemamount] < mobj->movedir))
|| (!mobj->target->player->kartstuff[k_itemheld]))
{
P_RemoveMobj(mobj);
return;
}
}
else*/ if ((mobj->health > 0
if ((mobj->health > 0
&& (!mobj->target || !mobj->target->player || mobj->target->player->health <= 0 || mobj->target->player->spectator))
|| (mobj->health <= 0 && mobj->z <= mobj->floorz)
|| P_CheckDeathPitCollide(mobj)) // When in death state
@ -8251,16 +8238,24 @@ void P_MobjThinker(mobj_t *mobj)
return;
}
P_TeleportMove(mobj, mobj->target->x + P_ReturnThrustX(mobj, mobj->target->angle+ANGLE_180, mobj->target->radius),
mobj->target->y + P_ReturnThrustY(mobj, mobj->target->angle+ANGLE_180, mobj->target->radius), mobj->target->z);
mobj->angle = mobj->target->angle;
P_TeleportMove(mobj, mobj->target->x + P_ReturnThrustX(mobj, mobj->angle+ANGLE_180, mobj->target->radius),
mobj->target->y + P_ReturnThrustY(mobj, mobj->angle+ANGLE_180, mobj->target->radius), mobj->target->z);
P_SetScale(mobj, mobj->target->scale);
if (mobj->target->player)
{
if (mobj->target->player->kartstuff[k_sneakertimer] > mobj->movecount)
player_t *p = NULL;
if (mobj->target->target && mobj->target->target->player)
p = mobj->target->target->player;
else if (mobj->target->player)
p = mobj->target->player;
if (p)
{
if (p->kartstuff[k_sneakertimer] > mobj->movecount)
P_SetMobjState(mobj, S_BOOSTFLAME);
mobj->movecount = mobj->target->player->kartstuff[k_sneakertimer];
mobj->movecount = p->kartstuff[k_sneakertimer];
}
}
if (mobj->state == &states[S_BOOSTSMOKESPAWNER])
@ -8275,7 +8270,7 @@ void P_MobjThinker(mobj_t *mobj)
smoke->momy = mobj->target->momy/2;
smoke->momz = mobj->target->momz/2;
P_Thrust(smoke, mobj->target->angle+FixedAngle(P_RandomRange(135, 225)<<FRACBITS), P_RandomRange(0, 8) * mobj->target->scale);
P_Thrust(smoke, mobj->angle+FixedAngle(P_RandomRange(135, 225)<<FRACBITS), P_RandomRange(0, 8) * mobj->target->scale);
}
break;
case MT_SPARKLETRAIL:
@ -8353,6 +8348,39 @@ void P_MobjThinker(mobj_t *mobj)
P_TeleportMove(mobj, destx, desty, mobj->target->z);
break;
}
case MT_ROCKETSNEAKER:
if (!mobj->target || !mobj->target->health)
{
P_RemoveMobj(mobj);
return;
}
if (mobj->target->player && !mobj->target->player->kartstuff[k_rocketsneakertimer])
{
mobj->flags &= ~MF_NOGRAVITY;
mobj->angle += ANGLE_45;
if (!mobj->extravalue2)
{
if (mobj->eflags & MFE_VERTICALFLIP)
mobj->z -= mobj->height;
else
mobj->z += mobj->height;
S_StartSound(mobj, mobj->info->deathsound);
P_SetObjectMomZ(mobj, 8*FRACUNIT, false);
P_InstaThrust(mobj, R_PointToAngle2(mobj->target->x, mobj->target->y, mobj->x, mobj->y)+ANGLE_90, 16*FRACUNIT);
mobj->momx += mobj->target->momx;
mobj->momy += mobj->target->momy;
mobj->momz += mobj->target->momz;
mobj->extravalue2 = 1;
}
else if (P_IsObjectOnGround(mobj))
{
P_RemoveMobj(mobj);
return;
}
}
break;
case MT_KARMAHITBOX:
if (!mobj->target || !mobj->target->health || !mobj->target->player || mobj->target->player->spectator
|| (G_RaceGametype() || mobj->target->player->kartstuff[k_bumper]))
@ -9341,7 +9369,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
case MT_JAWZ: case MT_JAWZ_DUD: case MT_JAWZ_SHIELD:
case MT_SSMINE: case MT_SSMINE_SHIELD:
case MT_BALLHOG: case MT_SINK:
case MT_THUNDERSHIELD:
case MT_THUNDERSHIELD: case MT_ROCKETSNEAKER:
P_SpawnShadowMobj(mobj);
default:
break;

View file

@ -4023,7 +4023,7 @@ DoneSection2:
player->kartstuff[k_floorboost] = 3;
else
player->kartstuff[k_floorboost] = 2;
K_DoSneaker(player, false);
K_DoSneaker(player, 0);
}
break;