diff --git a/src/d_main.c b/src/d_main.c index bc46fc0a3..f01633eaa 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a93e86ac0..6e5d245da 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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. diff --git a/src/info.c b/src/info.c index d73c13010..d71631dd1 100644 --- a/src/info.c +++ b/src/info.c @@ -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 diff --git a/src/k_battle.c b/src/k_battle.c index 98cc10a3b..dda33d553 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -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<>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)<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; diff --git a/src/p_inter.c b/src/p_inter.c index 730e7388d..7a778a3ab 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -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 } diff --git a/src/p_saveg.c b/src/p_saveg.c index 375c37120..509d18ec4 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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);