Add center point mobj, polish the visual a bit more, reduce the speed that the barrier shrinks

This commit is contained in:
Sally Coolatta 2020-10-22 17:38:06 -04:00
parent 7430df5f4f
commit 9ad88cdfa9
6 changed files with 141 additions and 177 deletions

View file

@ -9286,9 +9286,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_TIREGREASE", "S_TIREGREASE",
"S_OVERTIMEFOG", "S_OVERTIME_BULB1",
"S_OVERTIMEORB", "S_OVERTIME_BULB2",
"S_OVERTIMEBEAM", "S_OVERTIME_LASER",
"S_OVERTIME_CENTER",
"S_BATTLECAPSULE_SIDE1", "S_BATTLECAPSULE_SIDE1",
"S_BATTLECAPSULE_SIDE2", "S_BATTLECAPSULE_SIDE2",
@ -10382,9 +10383,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_SPBDUST", "MT_SPBDUST",
"MT_TIREGREASE", "MT_TIREGREASE",
"MT_OVERTIMEFOG", "MT_OVERTIME_PARTICLE",
"MT_OVERTIMEORB", "MT_OVERTIME_CENTER",
"MT_OVERTIMEBEAM",
"MT_BATTLECAPSULE", "MT_BATTLECAPSULE",
"MT_BATTLECAPSULE_PIECE", "MT_BATTLECAPSULE_PIECE",

View file

@ -713,7 +713,9 @@ char sprnames[NUMSPRITES + 1][5] =
"DRAF", "DRAF",
"GRES", "GRES",
"OTFG", "OTBU",
"OTLS",
"OTCP",
"DBOS", // Drift boost flame "DBOS", // Drift boost flame
@ -4995,9 +4997,10 @@ state_t states[NUMSTATES] =
{SPR_GRES, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 2, 4, S_NULL}, // S_TIREGREASE {SPR_GRES, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 2, 4, S_NULL}, // S_TIREGREASE
{SPR_OTFG, FF_FULLBRIGHT|FF_TRANS50, TICRATE, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEFOG {SPR_OTBU, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIME_BULB1
{SPR_OTFG, 1|FF_FULLBRIGHT|FF_PAPERSPRITE, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB {SPR_OTBU, FF_FULLBRIGHT|2, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIME_BULB2
{SPR_OTFG, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEBEAM {SPR_OTLS, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIME_LASER
{SPR_OTCP, 0, -1, {NULL}, 0, 0, S_NULL}, // S_OVERTIME_CENTER
{SPR_CAPS, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BATTLECAPSULE_SIDE1 {SPR_CAPS, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BATTLECAPSULE_SIDE1
{SPR_CAPS, FF_PAPERSPRITE|1, -1, {NULL}, 0, 0, S_NULL}, // S_BATTLECAPSULE_SIDE2 {SPR_CAPS, FF_PAPERSPRITE|1, -1, {NULL}, 0, 0, S_NULL}, // S_BATTLECAPSULE_SIDE2
@ -28402,9 +28405,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate S_NULL // raisestate
}, },
{ // MT_OVERTIMEFOG { // MT_OVERTIME_PARTICLE
-1, // doomednum -1, // doomednum
S_OVERTIMEFOG, // spawnstate S_NULL, // spawnstate
1000, // spawnhealth 1000, // spawnhealth
S_NULL, // seestate S_NULL, // seestate
sfx_None, // seesound sfx_None, // seesound
@ -28420,8 +28423,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // deathsound sfx_None, // deathsound
0, // speed 0, // speed
16<<FRACBITS, // radius 16<<FRACBITS, // radius
32<<FRACBITS, // height 24<<FRACBITS, // height
-1, // display offset 0, // display offset
100, // mass 100, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
@ -28429,36 +28432,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate S_NULL // raisestate
}, },
{ // MT_OVERTIMEORB { // MT_OVERTIME_CENTER
-1, // doomednum 3775, // doomednum
S_OVERTIMEORB, // spawnstate S_OVERTIME_CENTER, // 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
0, // speed
16<<FRACBITS, // radius
48<<FRACBITS, // height
-1, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_OVERTIMEBEAM
-1, // doomednum
S_OVERTIMEBEAM, // spawnstate
1000, // spawnhealth 1000, // spawnhealth
S_NULL, // seestate S_NULL, // seestate
sfx_None, // seesound sfx_None, // seesound
@ -28475,11 +28451,11 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // speed 0, // speed
48<<FRACBITS, // radius 48<<FRACBITS, // radius
48<<FRACBITS, // height 48<<FRACBITS, // height
-1, // display offset 0, // display offset
100, // mass 100, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags MF_SOLID|MF_DONTENCOREMAP, // flags
S_NULL // raisestate S_NULL // raisestate
}, },

View file

@ -984,7 +984,9 @@ typedef enum sprite
SPR_DRAF, SPR_DRAF,
SPR_GRES, SPR_GRES,
SPR_OTFG, SPR_OTBU,
SPR_OTLS,
SPR_OTCP,
SPR_DBOS, // Drift boost flame SPR_DBOS, // Drift boost flame
@ -5147,9 +5149,10 @@ typedef enum state
S_TIREGREASE, S_TIREGREASE,
S_OVERTIMEFOG, S_OVERTIME_BULB1,
S_OVERTIMEORB, S_OVERTIME_BULB2,
S_OVERTIMEBEAM, S_OVERTIME_LASER,
S_OVERTIME_CENTER,
S_BATTLECAPSULE_SIDE1, S_BATTLECAPSULE_SIDE1,
S_BATTLECAPSULE_SIDE2, S_BATTLECAPSULE_SIDE2,
@ -6263,9 +6266,8 @@ typedef enum mobj_type
MT_SPBDUST, MT_SPBDUST,
MT_TIREGREASE, MT_TIREGREASE,
MT_OVERTIMEFOG, MT_OVERTIME_PARTICLE,
MT_OVERTIMEORB, MT_OVERTIME_CENTER,
MT_OVERTIMEBEAM,
MT_BATTLECAPSULE, MT_BATTLECAPSULE,
MT_BATTLECAPSULE_PIECE, MT_BATTLECAPSULE_PIECE,

View file

@ -277,52 +277,81 @@ void K_CheckBumpers(void)
P_DoPlayerExit(&players[i]); P_DoPlayerExit(&players[i]);
} }
#define MAXPLANESPERSECTOR (MAXFFLOORS+1)*2 static void K_SpawnOvertimeLaser(fixed_t x, fixed_t y, fixed_t scale)
static void K_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjtype_t type)
{ {
UINT8 i; UINT8 i, j;
for (i = 0; i <= r_splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
player_t *player = &players[displayplayers[i]]; player_t *player = &players[displayplayers[i]];
mobj_t *mo; fixed_t zpos;
INT32 f = 0; SINT8 flip;
if (player == NULL || player->mo == NULL || P_MobjWasRemoved(player->mo) == true) if (player == NULL || player->mo == NULL || P_MobjWasRemoved(player->mo) == true)
{ {
continue; continue;
} }
mo = P_SpawnMobj(x, y, player->mo->z + (player->mo->height / 2), type);
P_SetScale(mo, scale);
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
{ {
mo->flags2 |= MF2_OBJECTFLIP; zpos = player->mo->z + player->mo->height;
mo->eflags |= MFE_VERTICALFLIP; }
else
{
zpos = player->mo->z;
} }
mo->drawflags |= (MFD_DONTDRAW & ~(K_GetPlayerDontDrawFlag(player))); flip = P_MobjFlip(player->mo);
switch (type) for (j = 0; j < 3; j++)
{ {
case MT_OVERTIMEFOG: mobj_t *mo = P_SpawnMobj(x, y, zpos, MT_OVERTIME_PARTICLE);
mo->destscale = 8 * mo->scale;
mo->momz = P_RandomRange(1,8) * mo->scale;
break;
case MT_OVERTIMEORB:
mo->angle = R_PointToAngle2(mo->x, mo->y, battleovertime.x, battleovertime.y) + ANGLE_90;
if (leveltime & 1) if (player->mo->eflags & MFE_VERTICALFLIP)
f = 3; {
else mo->flags2 |= MF2_OBJECTFLIP;
f = (leveltime / 2) % 3; mo->eflags |= MFE_VERTICALFLIP;
}
mo->frame += f; mo->angle = R_PointToAngle2(mo->x, mo->y, battleovertime.x, battleovertime.y) + ANGLE_90;
break; mo->drawflags |= (MFD_DONTDRAW & ~(K_GetPlayerDontDrawFlag(player)));
default:
break; P_SetScale(mo, scale);
switch (j)
{
case 0:
P_SetMobjState(mo, S_OVERTIME_BULB1);
if (leveltime & 1)
mo->frame += 1;
//P_SetScale(mo, mapobjectscale);
zpos += 35 * mo->scale * flip;
break;
case 1:
P_SetMobjState(mo, S_OVERTIME_LASER);
if (leveltime & 1)
mo->frame += 3;
else
mo->frame += (leveltime / 2) % 3;
//P_SetScale(mo, scale);
zpos += 346 * mo->scale * flip;
break;
case 2:
P_SetMobjState(mo, S_OVERTIME_BULB2);
if (leveltime & 1)
mo->frame += 1;
//P_SetScale(mo, mapobjectscale);
break;
default:
I_Error("Bruh moment has occured\n");
return;
}
} }
} }
} }
@ -331,8 +360,6 @@ static void K_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjty
void K_RunBattleOvertime(void) void K_RunBattleOvertime(void)
{ {
UINT32 i, j;
if (battleovertime.enabled < 10*TICRATE) if (battleovertime.enabled < 10*TICRATE)
{ {
battleovertime.enabled++; battleovertime.enabled++;
@ -343,81 +370,35 @@ void K_RunBattleOvertime(void)
} }
else if (battleovertime.radius > 0) else if (battleovertime.radius > 0)
{ {
if (battleovertime.radius > 4*mapobjectscale) if (battleovertime.radius > 2*mapobjectscale)
battleovertime.radius -= 4*mapobjectscale; battleovertime.radius -= 2*mapobjectscale;
else else
battleovertime.radius = 0; battleovertime.radius = 0;
} }
if (battleovertime.radius <= 0) if (battleovertime.radius > 0)
{
return;
}
/*
if (leveltime & 1)
{
UINT8 transparency = tr_trans50;
if (!splitscreen && players[displayplayers[0]].mo)
{
INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayers[0]].mo->x, battleovertime.y-players[displayplayers[0]].mo->y);
transparency = max(0, NUMTRANSMAPS - ((256 + (dist>>FRACBITS)) / 256));
}
if (transparency < NUMTRANSMAPS)
{
mobj_t *beam = P_SpawnMobj(battleovertime.x, battleovertime.y, battleovertime.z + (mobjinfo[MT_RANDOMITEM].height/2), MT_OVERTIMEBEAM);
P_SetScale(beam, beam->scale*2);
if (transparency > 0)
beam->frame |= transparency<<FF_TRANSSHIFT;
}
}
*/
{ {
const fixed_t pi = (22 * FRACUNIT) / 7; // loose approximation, this doesn't need to be incredibly precise const fixed_t pi = (22 * FRACUNIT) / 7; // loose approximation, this doesn't need to be incredibly precise
fixed_t scale = mapobjectscale + (battleovertime.radius / 2048); const UINT32 orbs = 32;
fixed_t sprwidth = 64 * scale; const angle_t angoff = ANGLE_MAX / orbs;
const UINT8 spriteSpacing = 128;
fixed_t circumference = FixedMul(pi, battleovertime.radius * 2); fixed_t circumference = FixedMul(pi, battleovertime.radius * 2);
UINT32 orbs = circumference / sprwidth; fixed_t scale = max(circumference / spriteSpacing / orbs, mapobjectscale);
angle_t angoff = ANGLE_MAX / orbs;
fixed_t size = FixedMul(mobjinfo[MT_OVERTIME_PARTICLE].radius, scale);
fixed_t posOffset = max(battleovertime.radius - size, 0);
UINT32 i;
for (i = 0; i < orbs; i++) for (i = 0; i < orbs; i++)
{ {
angle_t ang = (i * angoff); angle_t ang = (i * angoff) + FixedAngle((leveltime * FRACUNIT) / 4);
fixed_t size = FixedMul(mobjinfo[MT_OVERTIMEORB].radius, mapobjectscale);
fixed_t x = battleovertime.x + P_ReturnThrustX(NULL, ang, battleovertime.radius + size); fixed_t x = battleovertime.x + P_ReturnThrustX(NULL, ang, posOffset);
fixed_t y = battleovertime.y + P_ReturnThrustY(NULL, ang, battleovertime.radius + size); fixed_t y = battleovertime.y + P_ReturnThrustY(NULL, ang, posOffset);
K_SpawnOvertimeParticles(x, y, mapobjectscale, MT_OVERTIMEORB); K_SpawnOvertimeLaser(x, y, scale);
}
}
if (battleovertime.enabled < 10*TICRATE)
return;
for (i = 0; i < 16; i++)
{
j = 0;
while (j < 32) // max attempts
{
fixed_t scale = 4*mapobjectscale;
fixed_t x = battleovertime.x + (P_RandomRange(-64,64) * scale);
fixed_t y = battleovertime.y + (P_RandomRange(-64,64) * scale);
fixed_t closestdist = battleovertime.radius + (8 * FixedMul(mobjinfo[MT_OVERTIMEFOG].radius, scale));
j++;
if (P_AproxDistance(x - battleovertime.x, y - battleovertime.y) < closestdist)
continue;
K_SpawnOvertimeParticles(x, y, scale, MT_OVERTIMEFOG);
break;
} }
} }
} }

View file

@ -5751,10 +5751,21 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
{ {
player->kartstuff[k_wanted]++; player->kartstuff[k_wanted]++;
if ((battleovertime.enabled >= 10*TICRATE) && (P_AproxDistance(player->mo->x - battleovertime.x, player->mo->y - battleovertime.y) - (player->mo->radius * 2)) > battleovertime.radius) if (battleovertime.enabled >= 10*TICRATE)
{ {
P_KillMobj(player->mo, NULL, NULL, DMG_NORMAL); fixed_t distanceToBarrier = 0;
player->kartstuff[k_bumper] = 0;
if (battleovertime.radius > 0)
{
distanceToBarrier = R_PointToDist2(player->mo->x, player->mo->y, battleovertime.x, battleovertime.y) - (player->mo->radius * 2);
}
if (distanceToBarrier > battleovertime.radius)
{
//P_KillMobj(player->mo, NULL, NULL, DMG_NORMAL);
player->kartstuff[k_bumper] = 0;
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_NORMAL);
}
} }
} }

View file

@ -726,7 +726,7 @@ void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost)
} }
// Easily make it so that overtime works offline // Easily make it so that overtime works offline
#define TESTOVERTIMEINFREEPLAY //#define TESTOVERTIMEINFREEPLAY
/** Checks if the level timer is over the timelimit and the round should end, /** Checks if the level timer is over the timelimit and the round should end,
* unless you are in overtime. In which case leveltime may stretch out beyond * unless you are in overtime. In which case leveltime may stretch out beyond
@ -743,8 +743,10 @@ void P_CheckTimeLimit(void)
if (!cv_timelimit.value) if (!cv_timelimit.value)
return; return;
#ifndef TESTOVERTIMEINFREEPLAY
if (battlecapsules) // capsules override any time limit settings if (battlecapsules) // capsules override any time limit settings
return; return;
#endif
if (!(gametyperules & GTR_TIMELIMIT)) if (!(gametyperules & GTR_TIMELIMIT))
return; return;
@ -770,51 +772,43 @@ void P_CheckTimeLimit(void)
// Initiate the kill zone // Initiate the kill zone
if (!battleovertime.enabled) if (!battleovertime.enabled)
{ {
INT32 b = 0;
thinker_t *th; thinker_t *th;
mobj_t *item = NULL; mobj_t *center = NULL;
P_RespawnBattleBoxes(); // FORCE THESE TO BE RESPAWNED FOR THIS!!!!!!!
// Find us an item box to center on.
// TO DO: DON'T do this, instead use a specialized center point object
// just use 0,0 if it's not found
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{ {
mobj_t *thismo; mobj_t *thismo;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue; continue;
thismo = (mobj_t *)th; thismo = (mobj_t *)th;
if (thismo->type != MT_RANDOMITEM) if (thismo->type == MT_OVERTIME_CENTER)
continue; {
if (thismo->threshold == 69) // Disappears center = thismo;
continue;
b++;
// Only select items that are on the ground, ignore ones in the air. Ambush flag inverts this rule.
if ((!P_IsObjectOnGround(thismo)) != (thismo->flags2 & MF2_AMBUSH))
continue;
if (item == NULL || (b < nummapboxes && P_RandomChance(((nummapboxes-b)*FRACUNIT)/nummapboxes))) // This is to throw off the RNG some
item = thismo;
if (b >= nummapboxes) // end early if we've found them all already
break; break;
}
} }
if (item == NULL) // no item found, could happen if every item is in the air or has ambush flag, or the map has none if (center == NULL || P_MobjWasRemoved(center))
{ {
CONS_Alert(CONS_WARNING, "No usuable items for Battle overtime!\n"); CONS_Alert(CONS_WARNING, "No center point for overtime!\n");
return;
battleovertime.x = 0;
battleovertime.y = 0;
battleovertime.z = 0;
}
else
{
battleovertime.x = center->x;
battleovertime.y = center->y;
battleovertime.z = center->z;
} }
//item->threshold = 70; // Set constant respawn
battleovertime.x = item->x;
battleovertime.y = item->y;
battleovertime.z = item->z;
battleovertime.radius = 4096 * mapobjectscale; battleovertime.radius = 4096 * mapobjectscale;
battleovertime.enabled = 1; battleovertime.enabled = 1;
S_StartSound(NULL, sfx_kc47); S_StartSound(NULL, sfx_kc47);
} }