Fix time limit, make overtime kill you instantly and close in faster, remove minimum radius

Radius SHOULD be doubled to 8192 to be reasonable... but something gets severely messed up, makes me MAD
This commit is contained in:
Sally Coolatta 2020-10-22 05:36:36 -04:00
parent 7ce53ac104
commit 7430df5f4f
8 changed files with 80 additions and 138 deletions

View file

@ -1544,6 +1544,11 @@ void D_SRB2Main(void)
CON_Init();
memset(timelimits, 0, sizeof(timelimits));
memset(pointlimits, 0, sizeof(pointlimits));
timelimits[GT_BATTLE] = 2;
D_RegisterServerCommands();
D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame
R_RegisterEngineStuff();

View file

@ -460,8 +460,7 @@ consvar_t cv_scrambleonchange = {"scrambleonchange", "Off", CV_NETVAR, teamscram
consvar_t cv_itemfinder = {"itemfinder", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, ItemFinder_OnChange, 0, NULL, NULL, 0, 0, NULL};
// Scoring type options
static CV_PossibleValue_t overtime_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Super"}, {0, NULL}};
consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR|CV_CHEAT, overtime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR|CV_CHEAT, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -4311,8 +4310,8 @@ static void TimeLimit_OnChange(void)
if (cv_timelimit.value != 0)
{
CONS_Printf(M_GetText("Levels will end after %d second%s.\n"),cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s"); // Graue 11-17-2003
timelimitintics = cv_timelimit.value * TICRATE;
CONS_Printf(M_GetText("Levels will end after %d minute%s.\n"),cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s"); // Graue 11-17-2003
timelimitintics = cv_timelimit.value * (60*TICRATE);
// Note the deliberate absence of any code preventing
// pointlimit and timelimit from being set simultaneously.

View file

@ -4996,7 +4996,7 @@ state_t states[NUMSTATES] =
{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_OTFG, 2|FF_FULLBRIGHT|FF_PAPERSPRITE, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB
{SPR_OTFG, 1|FF_FULLBRIGHT|FF_PAPERSPRITE, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB
{SPR_OTFG, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEBEAM
{SPR_CAPS, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BATTLECAPSULE_SIDE1

View file

@ -279,110 +279,47 @@ void K_CheckBumpers(void)
#define MAXPLANESPERSECTOR (MAXFFLOORS+1)*2
static void K_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjtype_t type, boolean ceiling)
static void K_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjtype_t type)
{
UINT8 i;
fixed_t flatz[MAXPLANESPERSECTOR];
boolean flip[MAXPLANESPERSECTOR];
UINT8 numflats = 0;
mobj_t *mo;
subsector_t *ss = R_PointInSubsectorOrNull(x, y);
sector_t *sec;
if (!ss)
return;
sec = ss->sector;
// convoluted stuff JUST to get all of the planes we need to draw orbs on :V
for (i = 0; i < MAXPLANESPERSECTOR; i++)
flip[i] = false;
if (sec->floorpic != skyflatnum)
for (i = 0; i <= r_splitscreen; i++)
{
flatz[numflats] = P_GetZAt(sec->f_slope, x, y, sec->floorheight);
numflats++;
}
if (sec->ceilingpic != skyflatnum && ceiling)
{
flatz[numflats] = P_GetZAt(sec->c_slope, x, y, sec->ceilingheight) - FixedMul(mobjinfo[type].height, scale);
flip[numflats] = true;
numflats++;
}
player_t *player = &players[displayplayers[i]];
mobj_t *mo;
INT32 f = 0;
if (sec->ffloors)
{
ffloor_t *rover;
for (rover = sec->ffloors; rover; rover = rover->next)
if (player == NULL || player->mo == NULL || P_MobjWasRemoved(player->mo) == true)
{
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER))
continue;
if (*rover->toppic != skyflatnum)
{
flatz[numflats] = P_GetZAt(*rover->t_slope, x, y, *rover->topheight);
numflats++;
}
if (*rover->bottompic != skyflatnum && ceiling)
{
flatz[numflats] = P_GetZAt(*rover->b_slope, x, y, *rover->bottomheight);
flip[numflats] = true;
numflats++;
}
}
}
if (numflats <= 0) // no flats
return;
for (i = 0; i < numflats; i++)
{
mo = P_SpawnMobj(x, y, flatz[i], type);
// Lastly, if this can see the skybox mobj, then... we just wasted our time :V
if (skyboxmo[0] && !P_MobjWasRemoved(skyboxmo[0]))
{
const fixed_t sbz = skyboxmo[0]->z;
fixed_t checkz = sec->floorheight;
while (checkz < sec->ceilingheight)
{
P_TeleportMove(skyboxmo[0], skyboxmo[0]->x, skyboxmo[0]->y, checkz);
if (P_CheckSight(skyboxmo[0], mo))
{
P_RemoveMobj(mo);
break;
}
else
checkz += 32*mapobjectscale;
}
P_TeleportMove(skyboxmo[0], skyboxmo[0]->x, skyboxmo[0]->y, sbz);
if (P_MobjWasRemoved(mo))
continue;
continue;
}
mo = P_SpawnMobj(x, y, player->mo->z + (player->mo->height / 2), type);
P_SetScale(mo, scale);
if (flip[i])
if (player->mo->eflags & MFE_VERTICALFLIP)
{
mo->flags2 |= MF2_OBJECTFLIP;
mo->eflags |= MFE_VERTICALFLIP;
}
switch(type)
mo->drawflags |= (MFD_DONTDRAW & ~(K_GetPlayerDontDrawFlag(player)));
switch (type)
{
case MT_OVERTIMEFOG:
mo->destscale = 8*mo->scale;
mo->momz = P_RandomRange(1,8)*mo->scale;
mo->destscale = 8 * mo->scale;
mo->momz = P_RandomRange(1,8) * mo->scale;
break;
case MT_OVERTIMEORB:
//mo->destscale = mo->scale/4;
mo->frame += ((leveltime/4) % 8);
/*if (battleovertime.enabled < 10*TICRATE)
mo->drawflags |= MFD_SHADOW;*/
mo->angle = R_PointToAngle2(mo->x, mo->y, battleovertime.x, battleovertime.y) + ANGLE_90;
mo->z += P_RandomRange(0,48) * mo->scale;
if (leveltime & 1)
f = 3;
else
f = (leveltime / 2) % 3;
mo->frame += f;
break;
default:
break;
@ -394,7 +331,7 @@ static void K_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjty
void K_RunBattleOvertime(void)
{
UINT16 i, j;
UINT32 i, j;
if (battleovertime.enabled < 10*TICRATE)
{
@ -404,14 +341,20 @@ void K_RunBattleOvertime(void)
if (battleovertime.enabled == 10*TICRATE)
S_StartSound(NULL, sfx_kc40);
}
else
else if (battleovertime.radius > 0)
{
if (battleovertime.radius > battleovertime.minradius)
battleovertime.radius -= mapobjectscale;
if (battleovertime.radius > 4*mapobjectscale)
battleovertime.radius -= 4*mapobjectscale;
else
battleovertime.radius = battleovertime.minradius;
battleovertime.radius = 0;
}
if (battleovertime.radius <= 0)
{
return;
}
/*
if (leveltime & 1)
{
UINT8 transparency = tr_trans50;
@ -430,43 +373,50 @@ void K_RunBattleOvertime(void)
beam->frame |= transparency<<FF_TRANSSHIFT;
}
}
*/
// 16 orbs at the normal minimum size of 512
{
const fixed_t pi = (22<<FRACBITS) / 7; // loose approximation, this doesn't need to be incredibly precise
fixed_t scale = mapobjectscale + (battleovertime.radius/2048);
fixed_t sprwidth = 32*scale;
fixed_t circumference = FixedMul(pi, battleovertime.radius<<1);
UINT16 orbs = circumference / sprwidth;
const fixed_t pi = (22 * FRACUNIT) / 7; // loose approximation, this doesn't need to be incredibly precise
fixed_t scale = mapobjectscale + (battleovertime.radius / 2048);
fixed_t sprwidth = 64 * scale;
fixed_t circumference = FixedMul(pi, battleovertime.radius * 2);
UINT32 orbs = circumference / sprwidth;
angle_t angoff = ANGLE_MAX / orbs;
for (i = 0; i < orbs; i++)
{
angle_t ang = (i * angoff) + FixedAngle((leveltime/2)<<FRACBITS);
fixed_t x = battleovertime.x + P_ReturnThrustX(NULL, ang, battleovertime.radius - FixedMul(mobjinfo[MT_OVERTIMEORB].radius, scale));
fixed_t y = battleovertime.y + P_ReturnThrustY(NULL, ang, battleovertime.radius - FixedMul(mobjinfo[MT_OVERTIMEORB].radius, scale));
K_SpawnOvertimeParticles(x, y, scale, MT_OVERTIMEORB, false);
angle_t ang = (i * angoff);
fixed_t size = FixedMul(mobjinfo[MT_OVERTIMEORB].radius, mapobjectscale);
fixed_t x = battleovertime.x + P_ReturnThrustX(NULL, ang, battleovertime.radius + size);
fixed_t y = battleovertime.y + P_ReturnThrustY(NULL, ang, battleovertime.radius + size);
K_SpawnOvertimeParticles(x, y, mapobjectscale, MT_OVERTIMEORB);
}
}
if (battleovertime.enabled < 10*TICRATE)
return;
/*if (!S_IdPlaying(sfx_s3kd4s)) // global ambience
S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, ((4096*mapobjectscale) - battleovertime.radius)>>FRACBITS / 2));*/
for (i = 0; i < 16; i++)
{
j = 0;
while (j < 32) // max attempts
{
fixed_t x = battleovertime.x + ((P_RandomRange(-64,64) * 128)<<FRACBITS);
fixed_t y = battleovertime.y + ((P_RandomRange(-64,64) * 128)<<FRACBITS);
fixed_t closestdist = battleovertime.radius + (8*mobjinfo[MT_OVERTIMEFOG].radius);
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)
if (P_AproxDistance(x - battleovertime.x, y - battleovertime.y) < closestdist)
continue;
K_SpawnOvertimeParticles(x, y, 4*mapobjectscale, MT_OVERTIMEFOG, false);
K_SpawnOvertimeParticles(x, y, scale, MT_OVERTIMEFOG);
break;
}
}

View file

@ -7,7 +7,7 @@
extern struct battleovertime
{
UINT16 enabled; ///< Has this been initalized yet?
fixed_t radius, minradius; ///< Radius of kill field
fixed_t radius; ///< Radius of kill field
fixed_t x, y, z; ///< Position to center on
} battleovertime;

View file

@ -5750,23 +5750,13 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] > 0 && !P_PlayerInPain(player) && !player->powers[pw_flashing])
{
player->kartstuff[k_wanted]++;
if (battleovertime.enabled >= 10*TICRATE)
if ((battleovertime.enabled >= 10*TICRATE) && (P_AproxDistance(player->mo->x - battleovertime.x, player->mo->y - battleovertime.y) - (player->mo->radius * 2)) > battleovertime.radius)
{
if (P_AproxDistance(player->mo->x - battleovertime.x, player->mo->y - battleovertime.y) > battleovertime.radius)
{
player->kartstuff[k_killfield]++;
if (player->kartstuff[k_killfield] > 4*TICRATE)
{
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_NORMAL);
//player->kartstuff[k_killfield] = 1;
}
}
else if (player->kartstuff[k_killfield] > 0)
player->kartstuff[k_killfield]--;
P_KillMobj(player->mo, NULL, NULL, DMG_NORMAL);
player->kartstuff[k_bumper] = 0;
}
}
else if (player->kartstuff[k_killfield] > 0)
player->kartstuff[k_killfield]--;
if (P_IsObjectOnGround(player->mo))
player->kartstuff[k_waterskip] = 0;

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
//#define TESTOVERTIMEINFREEPLAY
#define TESTOVERTIMEINFREEPLAY
/** 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
@ -743,9 +743,6 @@ void P_CheckTimeLimit(void)
if (!cv_timelimit.value)
return;
if (!(multiplayer || netgame))
return;
if (battlecapsules) // capsules override any time limit settings
return;
@ -766,6 +763,7 @@ void P_CheckTimeLimit(void)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (foundone)
{
#endif
@ -779,6 +777,8 @@ void P_CheckTimeLimit(void)
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)
{
mobj_t *thismo;
@ -809,15 +809,15 @@ void P_CheckTimeLimit(void)
return;
}
item->threshold = 70; // Set constant respawn
//item->threshold = 70; // Set constant respawn
battleovertime.x = item->x;
battleovertime.y = item->y;
battleovertime.z = item->z;
battleovertime.radius = 4096*mapobjectscale;
battleovertime.minradius = (cv_overtime.value == 2 ? 40 : 512) * mapobjectscale;
battleovertime.radius = 4096 * mapobjectscale;
battleovertime.enabled = 1;
S_StartSound(NULL, sfx_kc47);
}
return;
#ifndef TESTOVERTIMEINFREEPLAY
}

View file

@ -4116,8 +4116,7 @@ static void P_NetArchiveMisc(void)
// battleovertime_t
WRITEUINT16(save_p, battleovertime.enabled);
WRITEFIXED(save_p, battleovertime.radius);
WRITEFIXED(save_p, battleovertime.minradius);
WRITEUINT16(save_p, battleovertime.radius);
WRITEFIXED(save_p, battleovertime.x);
WRITEFIXED(save_p, battleovertime.y);
WRITEFIXED(save_p, battleovertime.z);
@ -4250,8 +4249,7 @@ static inline boolean P_NetUnArchiveMisc(void)
// battleovertime_t
battleovertime.enabled = READUINT16(save_p);
battleovertime.radius = READFIXED(save_p);
battleovertime.minradius = READFIXED(save_p);
battleovertime.radius = READUINT16(save_p);
battleovertime.x = READFIXED(save_p);
battleovertime.y = READFIXED(save_p);
battleovertime.z = READFIXED(save_p);