mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Morph Drop Target from forward thrown white to lime
Blends from white into lime over 27 tics.
This commit is contained in:
parent
05d80f9e92
commit
dc024b874b
7 changed files with 110 additions and 0 deletions
|
|
@ -5380,6 +5380,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
|
|||
|
||||
"MT_DROPTARGET", // Drop Target
|
||||
"MT_DROPTARGET_SHIELD",
|
||||
"MT_DROPTARGET_MORPH",
|
||||
|
||||
"MT_BALLHOG", // Ballhog
|
||||
"MT_BALLHOGBOOM",
|
||||
|
|
|
|||
27
src/info.c
27
src/info.c
|
|
@ -23722,6 +23722,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
{ // MT_DROPTARGET_MORPH
|
||||
-1, // doomednum
|
||||
S_DROPTARGET, // spawnstate
|
||||
1, // 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
|
||||
45*FRACUNIT, // radius
|
||||
32*FRACUNIT, // height
|
||||
0, // display offset
|
||||
100, // mass
|
||||
1, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
{ // MT_BALLHOG
|
||||
-1, // doomednum
|
||||
S_BALLHOG1, // spawnstate
|
||||
|
|
|
|||
|
|
@ -6452,6 +6452,7 @@ typedef enum mobj_type
|
|||
|
||||
MT_DROPTARGET, // Drop Target
|
||||
MT_DROPTARGET_SHIELD,
|
||||
MT_DROPTARGET_MORPH,
|
||||
|
||||
MT_BALLHOG, // Ballhog
|
||||
MT_BALLHOGBOOM,
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@ void Obj_InitLoopCenter(mobj_t *center);
|
|||
void Obj_LinkLoopAnchor(mobj_t *anchor, mobj_t *center, UINT8 type);
|
||||
void Obj_LoopEndpointCollide(mobj_t *special, mobj_t *toucher);
|
||||
|
||||
/* Drop Target */
|
||||
void Obj_BeginDropTargetMorph(mobj_t *target, skincolornum_t color);
|
||||
boolean Obj_DropTargetMorphThink(mobj_t *morph);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@ target_sources(SRB2SDL2 PRIVATE
|
|||
monitor.c
|
||||
item-spot.c
|
||||
loops.c
|
||||
drop-target.c
|
||||
)
|
||||
|
|
|
|||
64
src/objects/drop-target.c
Normal file
64
src/objects/drop-target.c
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include "../doomdef.h"
|
||||
#include "../info.h"
|
||||
#include "../k_objects.h"
|
||||
#include "../p_local.h"
|
||||
|
||||
#define MORPH_TIME_FACTOR (3)
|
||||
|
||||
#define morph_target(o) ((o)->target)
|
||||
#define morph_time(o) ((o)->extravalue1)
|
||||
|
||||
void
|
||||
Obj_BeginDropTargetMorph
|
||||
( mobj_t * target,
|
||||
skincolornum_t color)
|
||||
{
|
||||
mobj_t *x = P_SpawnMobjFromMobj(target, 0, 0, 0,
|
||||
MT_DROPTARGET_MORPH);
|
||||
|
||||
x->color = color;
|
||||
x->colorized = true;
|
||||
x->renderflags |= RF_FULLBRIGHT;
|
||||
|
||||
P_SetTarget(&morph_target(x), target);
|
||||
|
||||
morph_time(x) = tr_trans90 * MORPH_TIME_FACTOR;
|
||||
|
||||
x->health = target->health;
|
||||
}
|
||||
|
||||
boolean
|
||||
Obj_DropTargetMorphThink (mobj_t *x)
|
||||
{
|
||||
mobj_t *target = morph_target(x);
|
||||
|
||||
if (P_MobjWasRemoved(target))
|
||||
{
|
||||
P_RemoveMobj(x);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->health != x->health)
|
||||
{
|
||||
P_RemoveMobj(x);
|
||||
return false;
|
||||
}
|
||||
|
||||
morph_time(x)--;
|
||||
|
||||
if (morph_time(x) <= 0)
|
||||
{
|
||||
target->health--;
|
||||
target->color = x->color;
|
||||
|
||||
P_RemoveMobj(x);
|
||||
return false;
|
||||
}
|
||||
|
||||
x->renderflags = (x->renderflags & ~(RF_TRANSMASK))
|
||||
| ((morph_time(x) / MORPH_TIME_FACTOR) << RF_TRANSSHIFT);
|
||||
|
||||
P_MoveOrigin(x, target->x, target->y, target->z);
|
||||
|
||||
return true;
|
||||
}
|
||||
12
src/p_mobj.c
12
src/p_mobj.c
|
|
@ -6618,6 +6618,12 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
|||
case MT_MONITOR_SHARD:
|
||||
Obj_MonitorShardThink(mobj);
|
||||
break;
|
||||
case MT_DROPTARGET_MORPH:
|
||||
if (Obj_DropTargetMorphThink(mobj) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case MT_VWREF:
|
||||
case MT_VWREB:
|
||||
{
|
||||
|
|
@ -7416,6 +7422,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
if (!--mobj->reactiontime)
|
||||
{
|
||||
P_SetMobjState(mobj, mobj->info->spawnstate);
|
||||
|
||||
// forward thrown
|
||||
if (mobj->health == 4)
|
||||
{
|
||||
Obj_BeginDropTargetMorph(mobj, SKINCOLOR_LIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue