3D signpost

This commit is contained in:
TehRealSalt 2019-11-08 23:25:46 -05:00
parent 2c67c97c58
commit 88cb623c2a
6 changed files with 213 additions and 147 deletions

View file

@ -1774,7 +1774,6 @@ static actionpointer_t actionpointers[] =
{{A_GrenadeRing}, "A_GRENADERING"}, // SRB2kart
{{A_SetSolidSteam}, "A_SETSOLIDSTEAM"},
{{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"},
{{A_SignPlayer}, "A_SIGNPLAYER"},
{{A_OverlayThink}, "A_OVERLAYTHINK"},
{{A_JetChase}, "A_JETCHASE"},
{{A_JetbThink}, "A_JETBTHINK"},
@ -4887,27 +4886,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_BUBBLES2",
// Level End Sign
"S_SIGN1",
"S_SIGN2",
"S_SIGN3",
"S_SIGN4",
"S_SIGN5",
"S_SIGN6",
"S_SIGN7",
"S_SIGN8",
"S_SIGN9",
"S_SIGN10",
"S_SIGN11",
"S_SIGN12",
"S_SIGN13",
"S_SIGN14",
"S_SIGN15",
"S_SIGN16",
"S_SIGN17",
"S_SIGN18",
"S_SIGN19",
"S_SIGN20",
"S_SIGN_END",
"S_SIGN_POLE",
"S_SIGN_BACK",
"S_SIGN_SIDE",
"S_SIGN_FACE",
// Steam Riser
"S_STEAM1",
@ -7363,6 +7345,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
// Interactive Objects
"MT_BUBBLES", // Bubble source
"MT_SIGN", // Level end sign
"MT_SIGN_PIECE",
"MT_SPIKEBALL", // Spike Ball
"MT_SPECIALSPIKEBALL",
"MT_SPINFIRE",

View file

@ -193,7 +193,7 @@ state_t states[NUMSTATES] =
{SPR_NULL, 0, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3
// Level end sign (uses player sprite)
{SPR_PLAY, 18, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN S
{SPR_PLAY, 18|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_PLAY_SIGN}, // S_PLAY_SIGN
// Blue Crawla
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND}, // S_POSS_STND
@ -1063,27 +1063,10 @@ state_t states[NUMSTATES] =
{SPR_BUBL, 1, 8, {A_BubbleCheck}, 0, 0, S_BUBBLES1}, // S_BUBBLES2
// Level End Sign
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN2}, // S_SIGN1
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN3}, // S_SIGN2
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN4}, // S_SIGN3
{SPR_SIGN, 3, 1, {NULL}, 0, 0, S_SIGN5}, // S_SIGN4
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN6}, // S_SIGN5
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN7}, // S_SIGN6
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN8}, // S_SIGN7
{SPR_SIGN, 4, 1, {NULL}, 0, 0, S_SIGN9}, // S_SIGN8
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN10}, // S_SIGN9
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN11}, // S_SIGN10
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN12}, // S_SIGN11
{SPR_SIGN, 5, 1, {NULL}, 0, 0, S_SIGN13}, // S_SIGN12
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN14}, // S_SIGN13
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN15}, // S_SIGN14
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN16}, // S_SIGN15
{SPR_SIGN, 6, 1, {NULL}, 0, 0, S_SIGN17}, // S_SIGN16
{SPR_SIGN, 0, 1, {NULL}, 0, 0, S_SIGN18}, // S_SIGN17
{SPR_SIGN, 1, 1, {NULL}, 0, 0, S_SIGN19}, // S_SIGN18
{SPR_SIGN, 2, 1, {NULL}, 0, 0, S_SIGN20}, // S_SIGN19
{SPR_SIGN, 7, 1, {NULL}, 0, 0, S_SIGN1}, // S_SIGN20
{SPR_SIGN, 8, -1, {A_SignPlayer}, 0, 0, S_NULL}, // S_SIGN_END
{SPR_SIGN, 0, -1, {NULL}, 0, 0, S_SIGN_POLE}, // S_SIGN_POLE
{SPR_SIGN, 1|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_SIGN_BACK}, // S_SIGN_BACK
{SPR_SIGN, 2|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_SIGN_SIDE}, // S_SIGN_SIDE
{SPR_SIGN, 3|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_SIGN_FACE}, // S_SIGN_FACE
// Steam Riser
{SPR_STEM, 0, 2, {A_SetSolidSteam}, 0, 0, S_STEAM2}, // S_STEAM1
@ -6434,7 +6417,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
501, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
S_PLAY_SIGN, // seestate
S_NULL, // seestate
sfx_s3kb8, // seesound
8, // reactiontime
sfx_s3k7e, // attacksound
@ -6448,7 +6431,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // deathsound
8, // speed
8*FRACUNIT, // radius
32*FRACUNIT, // height
48*FRACUNIT, // height
0, // display offset
16, // mass
0, // damage
@ -6457,6 +6440,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_SIGN_PIECE
-1, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // 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_None, // deathsound
8, // speed
8*FRACUNIT, // radius
48*FRACUNIT, // height
0, // display offset
0, // mass
0, // damage
sfx_None, // activesound
MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_NOTHINK|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_SPIKEBALL
-1, // doomednum
S_SPIKEBALL1, // spawnstate

View file

@ -63,7 +63,6 @@ void A_ThrownRing(); // Sparkle trail for red ring
void A_GrenadeRing(); // SRB2kart
void A_SetSolidSteam();
void A_UnsetSolidSteam();
void A_SignPlayer();
void A_OverlayThink();
void A_JetChase();
void A_JetbThink(); // Jetty-Syn Bomber Thinker
@ -1776,27 +1775,10 @@ typedef enum state
S_BUBBLES2,
// Level End Sign
S_SIGN1,
S_SIGN2,
S_SIGN3,
S_SIGN4,
S_SIGN5,
S_SIGN6,
S_SIGN7,
S_SIGN8,
S_SIGN9,
S_SIGN10,
S_SIGN11,
S_SIGN12,
S_SIGN13,
S_SIGN14,
S_SIGN15,
S_SIGN16,
S_SIGN17,
S_SIGN18,
S_SIGN19,
S_SIGN20,
S_SIGN_END,
S_SIGN_POLE,
S_SIGN_BACK,
S_SIGN_SIDE,
S_SIGN_FACE,
// Steam Riser
S_STEAM1,
@ -4284,6 +4266,7 @@ typedef enum mobj_type
// Interactive Objects
MT_BUBBLES, // Bubble source
MT_SIGN, // Level end sign
MT_SIGN_PIECE,
MT_SPIKEBALL, // Spike Ball
MT_SPECIALSPIKEBALL,
MT_SPINFIRE,

View file

@ -117,7 +117,6 @@ void A_ThrownRing(mobj_t *actor);
void A_GrenadeRing(mobj_t *actor);
void A_SetSolidSteam(mobj_t *actor);
void A_UnsetSolidSteam(mobj_t *actor);
void A_SignPlayer(mobj_t *actor);
void A_OverlayThink(mobj_t *actor);
void A_JetChase(mobj_t *actor);
void A_JetbThink(mobj_t *actor);
@ -4180,38 +4179,6 @@ void A_UnsetSolidSteam(mobj_t *actor)
actor->flags |= MF_NOCLIP;
}
// Function: A_SignPlayer
//
// Description: Changes the state of a level end sign to reflect the player that hit it.
//
// var1 = unused
// var2 = unused
//
void A_SignPlayer(mobj_t *actor)
{
mobj_t *ov;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SignPlayer", actor))
return;
#endif
if (!actor->target)
return;
if (!actor->target->player)
return;
// Set the sign to be an appropriate background color for this player's skincolor.
actor->color = KartColor_Opposite[actor->target->player->skincolor*2];
actor->frame += KartColor_Opposite[actor->target->player->skincolor*2+1];
// spawn an overlay of the player's face.
ov = P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY);
P_SetTarget(&ov->target, actor);
ov->color = actor->target->player->skincolor;
ov->skin = &skins[actor->target->player->skin];
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
}
// Function: A_OverlayThink
//
// Description: Moves the overlay to the position of its target.

View file

@ -1329,9 +1329,6 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
case MT_JAWZ_DUD:
gravityadd = (5*gravityadd)/2;
break;
case MT_SIGN:
gravityadd /= 8;
break;
case MT_KARMAFIREWORK:
gravityadd /= 3;
break;
@ -8957,31 +8954,104 @@ void P_MobjThinker(mobj_t *mobj)
}
break;
case MT_SIGN: // Kart's unique sign behavior
if (mobj->movecount)
if (mobj->movecount != 0)
{
if (mobj->z <= mobj->movefactor)
mobj_t *cur = mobj->hnext;
SINT8 newskin = -1;
UINT8 newcolor = SKINCOLOR_NONE;
angle_t endangle = FixedAngle(mobj->extravalue1 << FRACBITS);
if (mobj->movecount == 1)
{
P_SetMobjState(mobj, S_SIGN_END);
if (mobj->info->attacksound)
S_StartSound(mobj, mobj->info->attacksound);
mobj->flags |= MF_NOGRAVITY; // ?
mobj->flags &= ~MF_NOCLIPHEIGHT;
mobj->z = mobj->movefactor;
mobj->movecount = 0;
}
else
{
P_SpawnMobj(mobj->x + (P_RandomRange(-48,48)*mobj->scale),
mobj->y + (P_RandomRange(-48,48)*mobj->scale),
mobj->z + (24*mobj->scale) + (P_RandomRange(-8,8)*mobj->scale),
MT_SIGNSPARKLE);
mobj->flags &= ~MF_NOGRAVITY;
if (abs(mobj->z - mobj->movefactor) <= (512*mobj->scale) && !mobj->cvmem)
if (mobj->z + mobj->momz <= mobj->movefactor)
{
if (mobj->info->seesound)
S_StartSound(mobj, mobj->info->seesound);
mobj->cvmem = 1;
if (mobj->info->attacksound)
S_StartSound(mobj, mobj->info->attacksound);
mobj->z = mobj->movefactor;
mobj->momz = 0;
mobj->movecount = 2;
newskin = ((skin_t*)mobj->target->skin)-skins;
newcolor = mobj->target->player->skincolor;
}
else
{
fixed_t g = (6*mobj->scale);
UINT16 ticstilimpact = abs(mobj->z - mobj->movefactor) / g;
P_SpawnMobj(
mobj->x + FixedMul(48*mobj->scale, FINECOSINE(mobj->angle >> ANGLETOFINESHIFT)),
mobj->y + FixedMul(48*mobj->scale, FINESINE(mobj->angle >> ANGLETOFINESHIFT)),
mobj->z + ((24 + ((leveltime % 4) * 8)) * mobj->scale),
MT_SIGNSPARKLE
);
if (ticstilimpact == (3*TICRATE/2))
{
if (mobj->info->seesound)
S_StartSound(mobj, mobj->info->seesound);
}
mobj->angle += ANGLE_45;
mobj->momz = -g;
if (mobj->angle == endangle + ANGLE_180)
{
if (ticstilimpact <= 8)
{
newskin = ((skin_t*)mobj->target->skin)-skins;
newcolor = mobj->target->player->skincolor;
}
else
{
newskin = leveltime % numskins;
newcolor = skins[newskin].prefcolor;
}
}
}
}
else if (mobj->movecount == 2)
{
if (mobj->angle != endangle)
mobj->angle += ANGLE_11hh;
}
while (cur && !P_MobjWasRemoved(cur))
{
fixed_t amt = cur->extravalue1 * mobj->scale;
angle_t dir = mobj->angle + (cur->extravalue2 * ANGLE_90);
fixed_t z = mobj->z + (23*mobj->scale);
if (cur->state == &states[S_SIGN_FACE])
{
if (newcolor != SKINCOLOR_NONE)
{
cur->color = KartColor_Opposite[newcolor*2];
cur->frame = states[S_SIGN_FACE].frame + KartColor_Opposite[newcolor*2+1];
}
}
else if (cur->state == &states[S_PLAY_SIGN])
{
z += (5*mobj->scale);
amt += 1;
if (newskin != -1)
cur->skin = &skins[newskin];
if (newcolor != SKINCOLOR_NONE)
cur->color = newcolor;
}
P_TeleportMove(
cur,
mobj->x + FixedMul(amt, FINECOSINE(dir >> ANGLETOFINESHIFT)),
mobj->y + FixedMul(amt, FINESINE(dir >> ANGLETOFINESHIFT)),
z
);
cur->angle = dir + ANGLE_90;
cur = cur->hnext;
}
}
break;

View file

@ -3232,6 +3232,76 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
}
}
static void P_SetupSignObject(mobj_t *sign, mobj_t *pmo)
{
mobj_t *cur = sign, *prev = NULL;
// Setup the sign itself
P_SetTarget(&sign->target, pmo);
P_SetMobjState(sign, S_SIGN_POLE);
sign->movefactor = sign->z;
sign->z += (768*sign->scale) * P_MobjFlip(sign);
sign->movecount = 1;
sign->extravalue1 = AngleFixed(sign->angle) >> FRACBITS;
// Setup the overlay pieces
// Front
cur->hnext = P_SpawnMobj(sign->x, sign->y, sign->z, MT_SIGN_PIECE);
P_SetTarget(&cur->hnext->target, sign);
P_SetMobjState(cur->hnext, S_SIGN_FACE);
cur->hnext->extravalue1 = 6;
cur->hnext->extravalue2 = 2;
prev = cur;
cur = cur->hnext;
cur->hprev = prev;
// Player icon
cur->hnext = P_SpawnMobj(sign->x, sign->y, sign->z, MT_SIGN_PIECE);
P_SetTarget(&cur->hnext->target, sign);
cur->hnext->skin = pmo->skin;
P_SetMobjState(cur->hnext, S_PLAY_SIGN);
cur->hnext->extravalue1 = 7;
cur->hnext->extravalue2 = 2;
prev = cur;
cur = cur->hnext;
cur->hprev = prev;
// Back
cur->hnext = P_SpawnMobj(sign->x, sign->y, sign->z, MT_SIGN_PIECE);
P_SetTarget(&cur->hnext->target, sign);
P_SetMobjState(cur->hnext, S_SIGN_BACK);
cur->hnext->extravalue1 = 6;
cur->hnext->extravalue2 = 0;
prev = cur;
cur = cur->hnext;
cur->hprev = prev;
// Sides
cur->hnext = P_SpawnMobj(sign->x, sign->y, sign->z, MT_SIGN_PIECE);
P_SetTarget(&cur->hnext->target, sign);
P_SetMobjState(cur->hnext, S_SIGN_SIDE);
cur->hnext->extravalue1 = 30;
cur->hnext->extravalue2 = 1;
prev = cur;
cur = cur->hnext;
cur->hprev = prev;
cur->hnext = P_SpawnMobj(sign->x, sign->y, sign->z, MT_SIGN_PIECE);
P_SetTarget(&cur->hnext->target, sign);
P_SetMobjState(cur->hnext, S_SIGN_SIDE);
cur->hnext->extravalue1 = 30;
cur->hnext->extravalue2 = 3;
prev = cur;
cur = cur->hnext;
cur->hprev = prev;
}
//
// P_SetupSignExit
//
@ -3257,13 +3327,7 @@ void P_SetupSignExit(player_t *player)
if (thing->state != &states[thing->info->spawnstate])
continue;
P_SetTarget(&thing->target, player->mo);
P_SetMobjState(thing, S_SIGN1);
// SRB2Kart: Set sign spinning variables
thing->movefactor = thing->z;
thing->z += (768*thing->scale) * P_MobjFlip(thing);
thing->movecount = 1;
P_SetupSignObject(thing, player->mo);
++numfound;
}
@ -3285,14 +3349,7 @@ void P_SetupSignExit(player_t *player)
if (thing->state != &states[thing->info->spawnstate])
continue;
P_SetTarget(&thing->target, player->mo);
P_SetMobjState(thing, S_SIGN1);
// SRB2Kart: Set sign spinning variables
thing->movefactor = thing->z;
thing->z += (768*thing->scale) * P_MobjFlip(thing);
thing->movecount = 1;
P_SetupSignObject(thing, player->mo);
++numfound;
}
@ -3300,14 +3357,10 @@ void P_SetupSignExit(player_t *player)
return;
// SRB2Kart: FINALLY, add in an alternative if no place is found
if (player->mo)
if (player->mo && !P_MobjWasRemoved(player->mo))
{
mobj_t *sign = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (768*mapobjectscale), MT_SIGN);
P_SetTarget(&sign->target, player->mo);
P_SetMobjState(sign, S_SIGN1);
sign->movefactor = player->mo->floorz;
sign->movecount = 1;
thing = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->floorz, MT_SIGN);
P_SetupSignObject(thing, player->mo);
}
}