mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-26 15:31:03 +00:00
Merge branch 'instawhip-recharge' into 'master'
Instawhip Recharge VFX (and SFX!) See merge request KartKrew/Kart!1297
This commit is contained in:
commit
c58b06e7c1
11 changed files with 140 additions and 2 deletions
|
|
@ -3288,6 +3288,10 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
|
|||
"S_SLIPTIDEZIP",
|
||||
|
||||
"S_INSTAWHIP",
|
||||
"S_INSTAWHIP_RECHARGE1",
|
||||
"S_INSTAWHIP_RECHARGE2",
|
||||
"S_INSTAWHIP_RECHARGE3",
|
||||
"S_INSTAWHIP_RECHARGE4",
|
||||
"S_BLOCKRING",
|
||||
"S_BLOCKBODY",
|
||||
|
||||
|
|
@ -5336,6 +5340,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
|
|||
"MT_SLIPTIDEZIP",
|
||||
|
||||
"MT_INSTAWHIP",
|
||||
"MT_INSTAWHIP_RECHARGE",
|
||||
"MT_BLOCKRING",
|
||||
"MT_BLOCKBODY",
|
||||
|
||||
|
|
|
|||
32
src/info.c
32
src/info.c
|
|
@ -556,6 +556,7 @@ char sprnames[NUMSPRITES + 1][5] =
|
|||
"SLPT", // Sliptide zip indicator
|
||||
|
||||
"IWHP", // Instawhip
|
||||
"WPRE", // Instawhip Recharge
|
||||
"GRNG", // Guard ring
|
||||
"GBDY", // Guard body
|
||||
|
||||
|
|
@ -3955,6 +3956,10 @@ state_t states[NUMSTATES] =
|
|||
{SPR_SLPT, FF_PAPERSPRITE|0, -1, {NULL}, 0, 0, S_NULL}, // S_SLIPTIDEZIP
|
||||
|
||||
{SPR_IWHP, FF_FLOORSPRITE|FF_ANIMATE|0, -1, {NULL}, 6, 2, S_NULL}, // S_INSTAWHIP
|
||||
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_INSTAWHIP_RECHARGE2}, // S_INSTAWHIP_RECHARGE1
|
||||
{SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3ka0, 2, S_INSTAWHIP_RECHARGE3}, // S_INSTAWHIP_RECHARGE2
|
||||
{SPR_WPRE, FF_FULLBRIGHT|FF_FLOORSPRITE|FF_ANIMATE|0, 36, {NULL}, 17, 2, S_INSTAWHIP_RECHARGE4}, // S_INSTAWHIP_RECHARGE3
|
||||
{SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3k7c, 2, S_NULL}, // S_INSTAWHIP_RECHARGE4
|
||||
{SPR_GRNG, FF_FULLBRIGHT|FF_PAPERSPRITE|0, -1, {NULL}, 0, 0, S_NULL}, // S_BLOCKRING
|
||||
{SPR_GBDY, FF_FULLBRIGHT|FF_ANIMATE|0, -1, {NULL}, 4, 2, S_NULL}, // S_BLOCKBODY
|
||||
|
||||
|
|
@ -22711,6 +22716,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
{ // MT_INSTAWHIP_RECHARGE
|
||||
-1, // doomednum
|
||||
S_INSTAWHIP_RECHARGE1, // spawnstate
|
||||
1000, // spawnhealth
|
||||
S_NULL, // seestate
|
||||
sfx_None, // seesound
|
||||
0, // 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_None, // deathsound
|
||||
0, // speed
|
||||
90*FRACUNIT, // radius
|
||||
90*FRACUNIT, // height
|
||||
0, // display offset
|
||||
100, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_SCENERY|MF_NOCLIPTHING|MF_DONTENCOREMAP|MF_NOSQUISH, // flags
|
||||
S_INSTAWHIP_RECHARGE3 // raisestate
|
||||
},
|
||||
|
||||
{ // MT_BLOCKRING
|
||||
-1, // doomednum
|
||||
S_BLOCKRING, // spawnstate
|
||||
|
|
|
|||
|
|
@ -1109,6 +1109,7 @@ typedef enum sprite
|
|||
SPR_SLPT, // Sliptide zip indicator
|
||||
|
||||
SPR_IWHP, // Instawhip
|
||||
SPR_WPRE, // Instawhip Recharge
|
||||
SPR_GRNG, // Guard ring
|
||||
SPR_GBDY, // Guard body
|
||||
|
||||
|
|
@ -4366,6 +4367,10 @@ typedef enum state
|
|||
S_SLIPTIDEZIP,
|
||||
|
||||
S_INSTAWHIP,
|
||||
S_INSTAWHIP_RECHARGE1,
|
||||
S_INSTAWHIP_RECHARGE2,
|
||||
S_INSTAWHIP_RECHARGE3,
|
||||
S_INSTAWHIP_RECHARGE4,
|
||||
S_BLOCKRING,
|
||||
S_BLOCKBODY,
|
||||
|
||||
|
|
@ -6449,6 +6454,7 @@ typedef enum mobj_type
|
|||
MT_SLIPTIDEZIP,
|
||||
|
||||
MT_INSTAWHIP,
|
||||
MT_INSTAWHIP_RECHARGE,
|
||||
MT_BLOCKRING,
|
||||
MT_BLOCKBODY,
|
||||
|
||||
|
|
|
|||
|
|
@ -10780,6 +10780,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
whip->fuse = 12; // Changing instawhip animation duration? Look here
|
||||
player->flashing = max(player->flashing, 12);
|
||||
player->mo->momz += 4*mapobjectscale;
|
||||
|
||||
// Spawn in triangle formation
|
||||
Obj_SpawnInstaWhipRecharge(player, 0);
|
||||
Obj_SpawnInstaWhipRecharge(player, ANGLE_120);
|
||||
Obj_SpawnInstaWhipRecharge(player, ANGLE_240);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#ifndef k_objects_H
|
||||
#define k_objects_H
|
||||
|
||||
#include "tables.h" // angle_t
|
||||
#include "taglist.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -109,6 +110,8 @@ boolean Obj_DropTargetMorphThink(mobj_t *morph);
|
|||
|
||||
/* Instawhip */
|
||||
void Obj_InstaWhipThink(mobj_t *whip);
|
||||
void Obj_SpawnInstaWhipRecharge(player_t *player, angle_t angleOffset);
|
||||
void Obj_InstaWhipRechargeThink(mobj_t *mobj);
|
||||
|
||||
/* Block VFX */
|
||||
void Obj_BlockRingThink(mobj_t *ring);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
#include "../k_objects.h"
|
||||
#include "../p_local.h"
|
||||
|
||||
#define recharge_target(o) ((o)->target)
|
||||
#define recharge_offset(o) ((o)->movedir)
|
||||
|
||||
void Obj_InstaWhipThink (mobj_t *whip)
|
||||
{
|
||||
if (P_MobjWasRemoved(whip->target))
|
||||
|
|
@ -40,3 +43,32 @@ void Obj_InstaWhipThink (mobj_t *whip)
|
|||
whip->renderflags |= RF_DONTDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
void Obj_SpawnInstaWhipRecharge(player_t *player, angle_t angleOffset)
|
||||
{
|
||||
mobj_t *x = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_INSTAWHIP_RECHARGE);
|
||||
|
||||
x->tics = max(player->instaShieldCooldown - states[x->info->raisestate].tics, 0);
|
||||
x->renderflags |= RF_SLOPESPLAT | RF_NOSPLATBILLBOARD;
|
||||
|
||||
P_SetTarget(&recharge_target(x), player->mo);
|
||||
recharge_offset(x) = angleOffset;
|
||||
}
|
||||
|
||||
void Obj_InstaWhipRechargeThink(mobj_t *x)
|
||||
{
|
||||
mobj_t *target = recharge_target(x);
|
||||
|
||||
if (P_MobjWasRemoved(target))
|
||||
{
|
||||
P_RemoveMobj(x);
|
||||
return;
|
||||
}
|
||||
|
||||
P_MoveOrigin(x, target->x, target->y, target->z + (target->height / 2));
|
||||
P_InstaScale(x, 2 * target->scale);
|
||||
x->angle = target->angle + recharge_offset(x);
|
||||
|
||||
// Flickers every other frame
|
||||
x->renderflags ^= RF_DONTDRAW;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7221,13 +7221,14 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
|||
//
|
||||
// var1 = sound # to play
|
||||
// var2:
|
||||
// lower 16 bits = If 1, play sound using calling object as origin. If 0, play sound without an origin
|
||||
// lower 16 bits = If 1, play sound using calling object as origin. If 2, use target. If 0, play sound without an origin
|
||||
// upper 16 bits = If 1, do not play sound during preticker.
|
||||
//
|
||||
void A_PlaySound(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
mobj_t *origin = NULL;
|
||||
|
||||
if (LUA_CallAction(A_PLAYSOUND, actor))
|
||||
return;
|
||||
|
|
@ -7235,7 +7236,18 @@ void A_PlaySound(mobj_t *actor)
|
|||
if (leveltime < 2 && (locvar2 >> 16))
|
||||
return;
|
||||
|
||||
S_StartSound((locvar2 & 65535) ? actor : NULL, locvar1);
|
||||
switch (locvar2 & 65535)
|
||||
{
|
||||
case 1:
|
||||
origin = actor;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
origin = actor->target ? actor->target : actor;
|
||||
break;
|
||||
}
|
||||
|
||||
S_StartSound(origin, locvar1);
|
||||
}
|
||||
|
||||
// Function: A_FindTarget
|
||||
|
|
|
|||
|
|
@ -6681,6 +6681,14 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
|||
return;
|
||||
}
|
||||
break;
|
||||
case MT_INSTAWHIP_RECHARGE:
|
||||
Obj_InstaWhipRechargeThink(mobj);
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case MT_VWREF:
|
||||
case MT_VWREB:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32
|
|||
void R_DrawFloorSplat(vissprite_t *spr)
|
||||
{
|
||||
floorsplat_t splat;
|
||||
pslope_t localslope;
|
||||
mobj_t *mobj = spr->mobj;
|
||||
fixed_t tr_x, tr_y, rot_x, rot_y, rot_z;
|
||||
|
||||
|
|
@ -258,6 +259,9 @@ void R_DrawFloorSplat(vissprite_t *spr)
|
|||
|
||||
if (standingslope && (renderflags & RF_OBJECTSLOPESPLAT))
|
||||
splat.slope = standingslope;
|
||||
|
||||
if (!splat.slope && R_SplatSlope(mobj, (vector3_t){splat.x, splat.y, splat.z}, &localslope))
|
||||
splat.slope = &localslope;
|
||||
}
|
||||
|
||||
// Translate
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@
|
|||
/// \brief Special effects for sprite rendering
|
||||
|
||||
#include "d_player.h"
|
||||
#include "info.h"
|
||||
#include "p_tick.h"
|
||||
#include "r_splats.h"
|
||||
#include "r_things.h"
|
||||
|
||||
INT32 R_ThingLightLevel(mobj_t* thing)
|
||||
|
|
@ -29,3 +31,31 @@ INT32 R_ThingLightLevel(mobj_t* thing)
|
|||
|
||||
return lightlevel;
|
||||
}
|
||||
|
||||
// Use this function to set the slope of a splat sprite.
|
||||
//
|
||||
// slope->o, slope->d and slope->zdelta must be set, none of
|
||||
// the other fields on pslope_t are used.
|
||||
//
|
||||
// Return true if you want the slope to be used. The object
|
||||
// must have RF_SLOPESPLAT and mobj_t.floorspriteslope must be
|
||||
// NULL. (If RF_OBJECTSLOPESPLAT is set, then
|
||||
// mobj_t.standingslope must also be NULL.)
|
||||
boolean R_SplatSlope(mobj_t* mobj, vector3_t position, pslope_t* slope)
|
||||
{
|
||||
switch (mobj->type)
|
||||
{
|
||||
case MT_INSTAWHIP_RECHARGE: {
|
||||
// Create an acute angle
|
||||
slope->o = position;
|
||||
FV2_Load(&slope->d, FCOS(mobj->angle) / 2, FSIN(mobj->angle) / 2);
|
||||
slope->zdelta = FRACUNIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ boolean R_ThingIsFullDark (mobj_t *thing);
|
|||
boolean R_ThingIsFlashing(mobj_t *thing);
|
||||
|
||||
INT32 R_ThingLightLevel(mobj_t *thing);
|
||||
boolean R_SplatSlope(mobj_t *thing, vector3_t position, pslope_t *slope);
|
||||
|
||||
// --------------
|
||||
// MASKED DRAWING
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue