From dfa0522326202440304d29d1726c06719a2b2114 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 6 Dec 2018 13:46:38 -0500 Subject: [PATCH 01/20] Battle Mode overtime After the time limit is up, spawn a shrinking kill-field. This is one hefty initial commit! --- src/d_netcmd.c | 4 +- src/d_player.h | 1 + src/dehacked.c | 7 +++ src/doomstat.h | 11 ++++ src/g_game.c | 3 ++ src/info.c | 59 ++++++++++++++++++++- src/info.h | 8 +++ src/k_kart.c | 41 +++++++++++++- src/p_enemy.c | 4 +- src/p_inter.c | 99 ++++++++++++++++------------------ src/p_local.h | 1 + src/p_mobj.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++- src/p_saveg.c | 18 ++++++- src/p_setup.c | 4 ++ src/p_tick.c | 4 ++ 15 files changed, 343 insertions(+), 62 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f29798382..956990bd2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4326,9 +4326,9 @@ void D_GameTypeChanged(INT32 lastgametype) case GT_TEAMMATCH: if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits { - // default settings for match: no timelimit, no pointlimit + // default settings for match: 3 mins, no pointlimit CV_SetValue(&cv_pointlimit, 0); - CV_SetValue(&cv_timelimit, 0); + CV_SetValue(&cv_timelimit, 3); } if (!cv_itemrespawntime.changed) CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally diff --git a/src/d_player.h b/src/d_player.h index 1b1d4d0a2..ce5a92ab0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -346,6 +346,7 @@ typedef enum k_comebackpoints, // Number of times you've bombed or gave an item to someone; once it's 3 it gets set back to 0 and you're given a bumper k_comebackmode, // 0 = bomb, 1 = item k_wanted, // Timer for determining WANTED status, lowers when hitting people, prevents the game turning into Camp Lazlo + k_killfield, // How long have you been in the kill field, stay in too long and lose a bumper k_yougotem, // "You Got Em" gfx when hitting someone as a karma player via a method that gets you back in the game instantly // v1.0.2 vars diff --git a/src/dehacked.c b/src/dehacked.c index 8cb704125..44c8163df 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7099,6 +7099,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_KARMAFIREWORK4", "S_KARMAFIREWORKTRAIL", + "S_OVERTIMEFOG", + "S_OVERTIMEORB", + #ifdef SEENAMES "S_NAMECHECK", #endif @@ -7886,6 +7889,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_KARMAFIREWORK", + "MT_OVERTIMEFOG", + "MT_OVERTIMEORB", + #ifdef SEENAMES "MT_NAMECHECK", #endif @@ -8278,6 +8284,7 @@ static const char *const KARTSTUFF_LIST[] = { "COMEBACKPOINTS", "COMEBACKMODE", "WANTED", + "KILLFIELD", "YOUGOTEM", "ITEMBLINK", diff --git a/src/doomstat.h b/src/doomstat.h index 69e2e7cd9..605cef5bb 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -471,6 +471,17 @@ extern INT16 votelevels[5][2]; extern SINT8 votes[MAXPLAYERS]; extern SINT8 pickedvote; +/** Battle overtime information + */ +typedef struct +{ + boolean enabled; ///< Has this been initalized yet? + UINT16 radius; ///< Radius of kill field + fixed_t x, y, z; ///< Position to center on (z is only used for visuals) +} battleovertime_t; + +extern battleovertime_t *battleovertime; + extern tic_t hidetime; extern UINT32 timesBeaten; // # of times the game has been beaten. diff --git a/src/g_game.c b/src/g_game.c index ac8e27a37..75e7440b8 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -260,6 +260,9 @@ INT16 votelevels[5][2]; // Levels that were rolled by the host SINT8 votes[MAXPLAYERS]; // Each player's vote SINT8 pickedvote; // What vote the host rolls +// Battle overtime system +battleovertime_t *battleovertime = {NULL}; + // Server-sided, synched variables SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points tic_t wantedcalcdelay; // Time before it recalculates WANTED diff --git a/src/info.c b/src/info.c index 9851ee23b..863d5f8b5 100644 --- a/src/info.c +++ b/src/info.c @@ -69,7 +69,7 @@ char sprnames[NUMSPRITES + 1][5] = "CNDL","DOCH","DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS","ZTCH", "MKMA","MKMP","RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH","BFRT", "OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","FWRK", - "XMS4","XMS5","VIEW" + "OTFG","XMS4","XMS5","VIEW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -3394,6 +3394,9 @@ state_t states[NUMSTATES] = {SPR_FWRK, 3|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK1}, // S_KARMAFIREWORK4 {SPR_FWRK, 4|FF_FULLBRIGHT, TICRATE, {NULL}, 0, 0, S_NULL}, // S_KARMAFIREWORKTRAIL + {SPR_OTFG, FF_FULLBRIGHT|FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEFOG + {SPR_OTFG, 1|FF_FULLBRIGHT, 8, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB + #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK #endif @@ -20052,6 +20055,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_OVERTIMEFOG + -1, // doomednum + S_OVERTIMEFOG, // 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 + 8<mo->color = player->skincolor; } } + else if (player->kartstuff[k_killfield]) // You're gonna REALLY diiiiie + { + const INT32 flashtime = 4<<(4-(player->kartstuff[k_killfield]/TICRATE)); + if (player->kartstuff[k_killfield] == 1 || (player->kartstuff[k_killfield] % (flashtime/2) != 0)) + { + player->mo->colorized = false; + player->mo->color = player->skincolor; + } + else if (player->kartstuff[k_killfield] % flashtime == 0) + { + player->mo->colorized = true; + player->mo->color = SKINCOLOR_BYZANTIUM; + } + else + { + player->mo->colorized = true; + player->mo->color = SKINCOLOR_RUBY; + } + } else { player->mo->colorized = false; @@ -4370,8 +4389,28 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_tauntvoices]) player->kartstuff[k_tauntvoices]--; - if (G_BattleGametype() && player->kartstuff[k_bumper] > 0) + if (G_BattleGametype() && player->kartstuff[k_bumper] > 0 + && !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_squishedtimer] + && !player->kartstuff[k_respawn] && !player->powers[pw_flashing]) + { player->kartstuff[k_wanted]++; + if (battleovertime->enabled) + { + if (P_AproxDistance(player->mo->x - battleovertime->x, player->mo->y - battleovertime->y) > (battleovertime->radius<kartstuff[k_killfield]++; + if (player->kartstuff[k_killfield] > 4*TICRATE) + { + K_SpinPlayer(player, NULL, 0, NULL, false); + //player->kartstuff[k_killfield] = 1; + } + } + else if (player->kartstuff[k_killfield] > 0) + player->kartstuff[k_killfield]--; + } + } + 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_enemy.c b/src/p_enemy.c index cc37c7747..a529c9b60 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8234,7 +8234,7 @@ void A_ItemPop(mobj_t *actor) remains->flags = actor->flags; // Transfer flags remains->flags2 = actor->flags2; // Transfer flags2 remains->fuse = actor->fuse; // Transfer respawn timer - remains->threshold = (actor->threshold == 69 ? 69 : 68); + remains->threshold = (actor->threshold == 70 ? 70 : (actor->threshold == 69 ? 69 : 68)); remains->skin = NULL; remains->spawnpoint = actor->spawnpoint; @@ -8248,7 +8248,7 @@ void A_ItemPop(mobj_t *actor) remains->flags2 &= ~MF2_AMBUSH; - if (G_BattleGametype() && actor->threshold != 69) + if (G_BattleGametype() && (actor->threshold != 69 && actor->threshold != 70)) numgotboxes++; P_RemoveMobj(actor); diff --git a/src/p_inter.c b/src/p_inter.c index fce8ccd56..4ef2f578f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1755,7 +1755,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) */ void P_CheckTimeLimit(void) { - INT32 i, k; + INT32 i; if (!cv_timelimit.value) return; @@ -1791,66 +1791,62 @@ void P_CheckTimeLimit(void) } //Optional tie-breaker for Match/CTF - else*/ if (cv_overtime.value) + else*/ +#define TESTOVERTIMEINFREEPLAY + if (cv_overtime.value) { - INT32 playerarray[MAXPLAYERS]; - INT32 tempplayer = 0; - INT32 spectators = 0; - INT32 playercount = 0; - - //Figure out if we have enough participating players to care. +#ifndef TESTOVERTIMEINFREEPLAY + boolean foundone = false; // Overtime is used for closing off down to a specific item. for (i = 0; i < MAXPLAYERS; i++) { - if (players[i].exiting) - return; - if (playeringame[i] && players[i].spectator) - spectators++; - } - - if ((D_NumPlayers() - spectators) > 1) - { - // Play the starpost sfx after the first second of overtime. - if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE))) - S_StartSound(NULL, sfx_strpst); - - // Normal Match - if (!G_GametypeHasTeams()) + if (!playeringame[i] || players[i].spectator) + continue; + if (foundone) { - //Store the nodes of participating players in an array. - for (i = 0; i < MAXPLAYERS; i++) +#endif + // Initiate the kill zone + if (!battleovertime->enabled) { - if (playeringame[i] && !players[i].spectator) - { - playerarray[playercount] = i; - playercount++; - } - } + UINT8 b = 0; + thinker_t *th; + mobj_t *item = NULL; - //Sort 'em. - for (i = 1; i < playercount; i++) - { - for (k = i; k < playercount; k++) + // Find us an item box to center on. + for (th = thinkercap.next; th != &thinkercap; th = th->next) { - if (players[playerarray[i-1]].marescore < players[playerarray[k]].marescore) - { - tempplayer = playerarray[i-1]; - playerarray[i-1] = playerarray[k]; - playerarray[k] = tempplayer; - } - } - } + mobj_t *thismo; + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + thismo = (mobj_t *)th; - //End the round if the top players aren't tied. - if (players[playerarray[0]].marescore == players[playerarray[1]].marescore) - return; + if (thismo->type != MT_RANDOMITEM) + continue; + if (thismo->threshold == 69) // Disappears + continue; + b++; + 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; + } + + if (item == NULL) // no item found?! + return; + + item->threshold = 70; // Set constant respawn + battleovertime->x = item->x; + battleovertime->y = item->y; + battleovertime->z = item->z; + battleovertime->radius = 4096; + battleovertime->enabled = true; + } + return; +#ifndef TESTOVERTIMEINFREEPLAY } else - { - //In team match and CTF, determining a tie is much simpler. =P - if (redscore == bluescore) - return; - } + foundone = true; } +#endif } for (i = 0; i < MAXPLAYERS; i++) @@ -1861,9 +1857,6 @@ void P_CheckTimeLimit(void) return; P_DoPlayerExit(&players[i]); } - - /*if (server) - SendNetXCmd(XD_EXITLEVEL, NULL, 0);*/ } /** Checks if a player's score is over the pointlimit and the round should end. diff --git a/src/p_local.h b/src/p_local.h index ddcfd75e8..b6dcd4d0b 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -233,6 +233,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state); //void P_RunShields(void); void P_RunOverlays(void); void P_RunShadows(void); +void P_RunBattleOvertime(void); void P_MobjThinker(mobj_t *mobj); boolean P_RailThinker(mobj_t *mobj); void P_PushableThinker(mobj_t *mobj); diff --git a/src/p_mobj.c b/src/p_mobj.c index 40b107dcf..595ff1137 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6409,6 +6409,140 @@ static void P_RemoveShadow(mobj_t *thing) } } +// SAL'S KART BATTLE MODE OVERTIME HANDLER +#define MAXPLANESPERSECTOR (MAXFFLOORS+1)*2 +static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, boolean ceiling) +{ + UINT8 i; + fixed_t flatz[MAXPLANESPERSECTOR]; + UINT8 numflats = 0; + mobj_t *mo; + subsector_t *ss = R_IsPointInSubsector(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 + + if (sec->floorpic != skyflatnum) + { +#ifdef ESLOPE + flatz[numflats] = (sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : sec->floorheight); +#else + flatz[numflats] = (sec->floorheight); +#endif + numflats++; + } + if (sec->ceilingpic != skyflatnum && ceiling) + { +#ifdef ESLOPE + flatz[numflats] = (sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : sec->ceilingheight) - mobjinfo[MT_THOK].height; +#else + flatz[numflats] = (sec->ceilingheight) - mobjinfo[MT_THOK].height; +#endif + numflats++; + } + + if (sec->ffloors) + { + ffloor_t *rover; + for (rover = sec->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER)) + continue; + if (*rover->toppic != skyflatnum) + { +#ifdef ESLOPE + flatz[numflats] = (*rover->t_slope ? P_GetZAt(*rover->t_slope, x, y) : *rover->topheight); +#else + flatz[numflats] = (*rover->topheight); +#endif + numflats++; + } + if (*rover->bottompic != skyflatnum && ceiling) + { +#ifdef ESLOPE + flatz[numflats] = (*rover->b_slope ? P_GetZAt(*rover->b_slope, x, y) : *rover->bottomheight) - mobjinfo[MT_THOK].height; +#else + flatz[numflats] = (*rover->bottomheight) - mobjinfo[MT_THOK].height; +#endif + 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]) && P_CheckSight(skyboxmo[0], mo)) + { + P_RemoveMobj(mo); + continue; + } + + switch(type) + { + case MT_OVERTIMEFOG: + P_SetScale(mo, 2*mo->scale); + mo->destscale = 8*mo->scale; + mo->momz = P_RandomRange(1,8)*mo->scale; + break; + case MT_OVERTIMEORB: + P_SetScale(mo, 2*mo->scale); + mo->destscale = mo->scale/4; + if ((leveltime/2) & 1) + mo->frame++; + break; + default: + break; + } + } +} +#undef MAXPLANESPERSECTOR + +void P_RunBattleOvertime(void) +{ + UINT8 i, j; + + if (battleovertime->radius > 512) + battleovertime->radius--; + else + battleovertime->radius = 512; + + if (leveltime & 1) + { + for (i = 0; i < 16; i++) // 16 base orbs + { + angle_t ang = FixedAngle(((45*i) * (FRACUNIT>>1)) + ((leveltime % 360)<x + P_ReturnThrustX(NULL, ang, battleovertime->radius<y + P_ReturnThrustY(NULL, ang, battleovertime->radius<x + ((P_RandomRange(-64,64) * 128)<y + ((P_RandomRange(-64,64) * 128)<x, y-battleovertime->y) <= (battleovertime->radius<flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s P_RemoveMobj(mobj); // make sure they disappear return; case MT_RANDOMITEM: - if (G_BattleGametype()) + if (G_BattleGametype() && (mobj->threshold != 70)) { if (mobj->threshold != 69) + { + mobj->fuse = cv_itemrespawntime.value*TICRATE + 2; break; + } } else { @@ -9390,6 +9527,8 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s // Transfer flags2 (strongbox, objectflip) newmobj->flags2 = mobj->flags2 & ~MF2_DONTDRAW; + if (mobj->threshold == 70) + newmobj->threshold = 70; } P_RemoveMobj(mobj); // make sure they disappear return; diff --git a/src/p_saveg.c b/src/p_saveg.c index 02f774574..8306e64ad 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -961,8 +961,8 @@ typedef enum MD2_EXTVAL2 = 1<<6, MD2_HNEXT = 1<<7, MD2_HPREV = 1<<8, - MD2_COLORIZED = 1<<9, - MD2_WAYPOINTCAP = 1<<10 + MD2_COLORIZED = 1<<9, + MD2_WAYPOINTCAP = 1<<10 #ifdef ESLOPE , MD2_SLOPE = 1<<11 #endif @@ -3298,6 +3298,13 @@ static void P_NetArchiveMisc(void) for (i = 0; i < 4; i++) WRITESINT8(save_p, battlewanted[i]); + // battleovertime_t + WRITEUINT8(save_p, battleovertime->enabled); + WRITEUINT16(save_p, battleovertime->radius); + WRITEFIXED(save_p, battleovertime->x); + WRITEFIXED(save_p, battleovertime->y); + WRITEFIXED(save_p, battleovertime->z); + WRITEUINT32(save_p, wantedcalcdelay); WRITEUINT32(save_p, indirectitemcooldown); WRITEUINT32(save_p, mapreset); @@ -3405,6 +3412,13 @@ static inline boolean P_NetUnArchiveMisc(void) for (i = 0; i < 4; i++) battlewanted[i] = READSINT8(save_p); + // battleovertime_t + battleovertime->enabled = (boolean)READUINT8(save_p); + battleovertime->radius = READUINT16(save_p); + battleovertime->x = READFIXED(save_p); + battleovertime->y = READFIXED(save_p); + battleovertime->z = READFIXED(save_p); + wantedcalcdelay = READUINT32(save_p); indirectitemcooldown = READUINT32(save_p); mapreset = READUINT32(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index 3bdb4d057..01b231116 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2373,6 +2373,10 @@ static void P_LevelInitStuff(void) for (i = 0; i < 4; i++) battlewanted[i] = -1; + + if (!battleovertime) + battleovertime = Z_Malloc(sizeof(battleovertime_t), PU_STATIC, NULL); + memset(battleovertime, 0, sizeof(battleovertime_t)); } // diff --git a/src/p_tick.c b/src/p_tick.c index b46b248bb..def074d60 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -621,6 +621,8 @@ void P_Ticker(boolean run) if (run) { P_RunThinkers(); + if (G_BattleGametype() && battleovertime->enabled) + P_RunBattleOvertime(); // Run any "after all the other thinkers" stuff for (i = 0; i < MAXPLAYERS; i++) @@ -760,6 +762,8 @@ void P_PreTicker(INT32 frames) } P_RunThinkers(); + if (G_BattleGametype() && battleovertime->enabled) + P_RunBattleOvertime(); // Run any "after all the other thinkers" stuff for (i = 0; i < MAXPLAYERS; i++) From 19ca7bf1347ee5015c5e092cc6c8c9c65dd447f8 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 6 Dec 2018 16:17:17 -0500 Subject: [PATCH 02/20] Show the central item on the minimap, and other minor aesthetic touches --- src/info.c | 10 +++--- src/k_kart.c | 89 +++++++++++++++++++++++++++++++++++++--------------- src/p_mobj.c | 28 ++++++++++++++--- 3 files changed, 93 insertions(+), 34 deletions(-) diff --git a/src/info.c b/src/info.c index 863d5f8b5..ae9696edc 100644 --- a/src/info.c +++ b/src/info.c @@ -3394,7 +3394,7 @@ state_t states[NUMSTATES] = {SPR_FWRK, 3|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK1}, // S_KARMAFIREWORK4 {SPR_FWRK, 4|FF_FULLBRIGHT, TICRATE, {NULL}, 0, 0, S_NULL}, // S_KARMAFIREWORKTRAIL - {SPR_OTFG, FF_FULLBRIGHT|FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEFOG + {SPR_OTFG, FF_FULLBRIGHT|FF_TRANS50, TICRATE, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEFOG {SPR_OTFG, 1|FF_FULLBRIGHT, 8, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB #ifdef SEENAMES @@ -20072,8 +20072,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 8<skin) - skin = ((skin_t*)mo->skin)-skins; - maxx = maxy = INT32_MAX; minx = miny = INT32_MIN; minx = bsp->bbox[0][BOXLEFT]; @@ -7355,33 +7352,23 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat yscale = FixedDiv(AutomapPic->height, mapheight); zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20); - amnumxpos = (FixedMul(mo->x, zoom) - FixedMul(xoffset, zoom)); - amnumypos = -(FixedMul(mo->y, zoom) - FixedMul(yoffset, zoom)); + amnumxpos = (FixedMul(objx, zoom) - FixedMul(xoffset, zoom)); + amnumypos = -(FixedMul(objy, zoom) - FixedMul(yoffset, zoom)); if (encoremode) amnumxpos = -amnumxpos; - amxpos = amnumxpos + ((x + AutomapPic->width/2 - (facemmapprefix[skin]->width/2))<height/2 - (facemmapprefix[skin]->height/2))<width/2 - (icon->width/2))<height/2 - (icon->height/2))<width/2 + (facemmapprefix[skin]->width/2))<width/2 + (icon->width/2))<color) // 'default' color - V_DrawSciencePatch(amxpos, amypos, flags, facemmapprefix[skin], FRACUNIT); - else - { - UINT8 *colormap; - if (mo->colorized) - colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE); - else - colormap = R_GetTranslationColormap(skin, mo->color, GTC_CACHE); - V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, facemmapprefix[skin], colormap); - } + V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, icon, colormap); } static void K_drawKartMinimap(void) @@ -7392,6 +7379,8 @@ static void K_drawKartMinimap(void) INT32 x, y; INT32 minimaptrans, splitflags = (splitscreen ? 0 : V_SNAPTORIGHT); boolean dop1later = false; + UINT8 skin = 0; + UINT8 *colormap = NULL; // Draw the HUD only when playing in a level. // hu_stuff needs this, unlike st_stuff. @@ -7443,13 +7432,37 @@ static void K_drawKartMinimap(void) x -= SHORT(AutomapPic->leftoffset); y -= SHORT(AutomapPic->topoffset); + // Draw the super item in Battle + if (G_BattleGametype() && battleovertime->enabled) + { + const INT32 prevsplitflags = splitflags; + splitflags &= ~V_HUDTRANSHALF; + splitflags |= V_HUDTRANS; + colormap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE); + K_drawKartMinimapHead(battleovertime->x, battleovertime->y, x, y, splitflags, kp_itemminimap, colormap, AutomapPic); + splitflags = prevsplitflags; + } + // Player's tiny icons on the Automap. (drawn opposite direction so player 1 is drawn last in splitscreen) if (ghosts) { demoghost *g = ghosts; while (g) { - K_drawKartMinimapHead(g->mo, x, y, splitflags, AutomapPic); + if (g->mo->skin) + skin = ((skin_t*)g->mo->skin)-skins; + else + skin = 0; + if (g->mo->color) + { + if (g->mo->colorized) + colormap = R_GetTranslationColormap(TC_RAINBOW, g->mo->color, GTC_CACHE); + else + colormap = R_GetTranslationColormap(skin, g->mo->color, GTC_CACHE); + } + else + colormap = NULL; + K_drawKartMinimapHead(g->mo->x, g->mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); g = g->next; } if (!stplyr->mo || stplyr->spectator) // do we need the latter..? @@ -7481,7 +7494,20 @@ static void K_drawKartMinimap(void) continue; } - K_drawKartMinimapHead(players[i].mo, x, y, splitflags, AutomapPic); + if (players[i].mo->skin) + skin = ((skin_t*)players[i].mo->skin)-skins; + else + skin = 0; + if (players[i].mo->color) + { + if (players[i].mo->colorized) + colormap = R_GetTranslationColormap(TC_RAINBOW, players[i].mo->color, GTC_CACHE); + else + colormap = R_GetTranslationColormap(skin, players[i].mo->color, GTC_CACHE); + } + else + colormap = NULL; + K_drawKartMinimapHead(players[i].mo->x, players[i].mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); } } @@ -7490,7 +7516,20 @@ static void K_drawKartMinimap(void) splitflags &= ~V_HUDTRANSHALF; splitflags |= V_HUDTRANS; - K_drawKartMinimapHead(stplyr->mo, x, y, splitflags, AutomapPic); + if (stplyr->mo->skin) + skin = ((skin_t*)stplyr->mo->skin)-skins; + else + skin = 0; + if (stplyr->mo->color) + { + if (stplyr->mo->colorized) + colormap = R_GetTranslationColormap(TC_RAINBOW, stplyr->mo->color, GTC_CACHE); + else + colormap = R_GetTranslationColormap(skin, stplyr->mo->color, GTC_CACHE); + } + else + colormap = NULL; + K_drawKartMinimapHead(stplyr->mo->x, stplyr->mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); } static void K_drawKartStartCountdown(void) diff --git a/src/p_mobj.c b/src/p_mobj.c index 595ff1137..7c2c8438d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6490,7 +6490,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool switch(type) { case MT_OVERTIMEFOG: - P_SetScale(mo, 2*mo->scale); + P_SetScale(mo, 4*mo->scale); mo->destscale = 8*mo->scale; mo->momz = P_RandomRange(1,8)*mo->scale; break; @@ -6499,6 +6499,8 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool mo->destscale = mo->scale/4; if ((leveltime/2) & 1) mo->frame++; + /*if (i == 0 && !((leveltime/2) % 3 == 0)) + S_StartSoundAtVolume(mo, sfx_s1b1, 64);*/ break; default: break; @@ -6511,6 +6513,9 @@ void P_RunBattleOvertime(void) { UINT8 i, j; + /*if (!S_IdPlaying(sfx_s3kd4l)) // global ambience + S_StartSound(NULL, sfx_s3kd4l);*/ + if (battleovertime->radius > 512) battleovertime->radius--; else @@ -6521,8 +6526,9 @@ void P_RunBattleOvertime(void) for (i = 0; i < 16; i++) // 16 base orbs { angle_t ang = FixedAngle(((45*i) * (FRACUNIT>>1)) + ((leveltime % 360)<x + P_ReturnThrustX(NULL, ang, battleovertime->radius<y + P_ReturnThrustY(NULL, ang, battleovertime->radius<radius - (2*mobjinfo[MT_OVERTIMEORB].radius))<x + P_ReturnThrustX(NULL, ang, dist); + fixed_t y = battleovertime->y + P_ReturnThrustY(NULL, ang, dist); P_SpawnOvertimeParticles(x, y, MT_OVERTIMEORB, true); } } @@ -6534,8 +6540,9 @@ void P_RunBattleOvertime(void) { fixed_t x = battleovertime->x + ((P_RandomRange(-64,64) * 128)<y + ((P_RandomRange(-64,64) * 128)<radius + (4*mobjinfo[MT_OVERTIMEFOG].radius))<x, y-battleovertime->y) <= (battleovertime->radius<x, y-battleovertime->y) < closestdist) continue; P_SpawnOvertimeParticles(x, y, MT_OVERTIMEFOG, false); break; @@ -9246,6 +9253,18 @@ void P_MobjThinker(mobj_t *mobj) trail->color = mobj->color; } break; + case MT_RANDOMITEM: + if (G_BattleGametype() && mobj->threshold == 70) + { + mobj->color = (1 + (leveltime % (MAXSKINCOLORS-1))); + mobj->colorized = true; + } + else + { + mobj->color = SKINCOLOR_NONE; + mobj->colorized = false; + } + break; //} case MT_TURRET: P_MobjCheckWater(mobj); @@ -9525,6 +9544,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s else newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->type); + P_SpawnMobj(newmobj->x, newmobj->y, newmobj->z, MT_EXPLODE); // poof into existance // Transfer flags2 (strongbox, objectflip) newmobj->flags2 = mobj->flags2 & ~MF2_DONTDRAW; if (mobj->threshold == 70) From 43af067415c229ddde7349924d9e0a170b7067b0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 6 Dec 2018 18:13:40 -0500 Subject: [PATCH 03/20] Add a 5-second delay before the kill-field kicks in Until it's ready, the orbs are transparent and the minimap icon blinks. Also, tons more sounds. ALSO, Super Overtime mode. --- src/d_netcmd.c | 3 ++- src/doomstat.h | 4 ++-- src/k_kart.c | 17 ++++++++++------- src/p_inter.c | 4 +++- src/p_mobj.c | 28 ++++++++++++++++++++++------ src/p_saveg.c | 4 +++- src/sounds.c | 1 + src/sounds.h | 1 + 8 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 956990bd2..06f65bcaa 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -398,7 +398,8 @@ consvar_t cv_itemfinder = {"itemfinder", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, // Scoring type options consvar_t cv_match_scoring = {"matchscoring", "Normal", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, match_scoring_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +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_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/doomstat.h b/src/doomstat.h index 605cef5bb..eb0af90f9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -475,8 +475,8 @@ extern SINT8 pickedvote; */ typedef struct { - boolean enabled; ///< Has this been initalized yet? - UINT16 radius; ///< Radius of kill field + UINT8 enabled; ///< Has this been initalized yet? + UINT16 radius, minradius; ///< Radius of kill field fixed_t x, y, z; ///< Position to center on (z is only used for visuals) } battleovertime_t; diff --git a/src/k_kart.c b/src/k_kart.c index 5e6d07766..62bc99c45 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4394,7 +4394,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) && !player->kartstuff[k_respawn] && !player->powers[pw_flashing]) { player->kartstuff[k_wanted]++; - if (battleovertime->enabled) + if (battleovertime->enabled >= 5*TICRATE) { if (P_AproxDistance(player->mo->x - battleovertime->x, player->mo->y - battleovertime->y) > (battleovertime->radius<enabled) { - const INT32 prevsplitflags = splitflags; - splitflags &= ~V_HUDTRANSHALF; - splitflags |= V_HUDTRANS; - colormap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE); - K_drawKartMinimapHead(battleovertime->x, battleovertime->y, x, y, splitflags, kp_itemminimap, colormap, AutomapPic); - splitflags = prevsplitflags; + if (battleovertime->enabled >= 5*TICRATE || (battleovertime->enabled & 1)) + { + const INT32 prevsplitflags = splitflags; + splitflags &= ~V_HUDTRANSHALF; + splitflags |= V_HUDTRANS; + colormap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE); + K_drawKartMinimapHead(battleovertime->x, battleovertime->y, x, y, splitflags, kp_itemminimap, colormap, AutomapPic); + splitflags = prevsplitflags; + } } // Player's tiny icons on the Automap. (drawn opposite direction so player 1 is drawn last in splitscreen) diff --git a/src/p_inter.c b/src/p_inter.c index 4ef2f578f..b5615e4c8 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1838,7 +1838,9 @@ void P_CheckTimeLimit(void) battleovertime->y = item->y; battleovertime->z = item->z; battleovertime->radius = 4096; - battleovertime->enabled = true; + battleovertime->minradius = (cv_overtime.value == 2 ? 40 : 512); + battleovertime->enabled++; + S_StartSound(NULL, sfx_kc47); } return; #ifndef TESTOVERTIMEINFREEPLAY diff --git a/src/p_mobj.c b/src/p_mobj.c index 7c2c8438d..a79a3427d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6499,6 +6499,8 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool mo->destscale = mo->scale/4; if ((leveltime/2) & 1) mo->frame++; + if (battleovertime->enabled < 5*TICRATE) + mo->frame |= FF_TRANS50; /*if (i == 0 && !((leveltime/2) % 3 == 0)) S_StartSoundAtVolume(mo, sfx_s1b1, 64);*/ break; @@ -6513,13 +6515,21 @@ void P_RunBattleOvertime(void) { UINT8 i, j; - /*if (!S_IdPlaying(sfx_s3kd4l)) // global ambience - S_StartSound(NULL, sfx_s3kd4l);*/ - - if (battleovertime->radius > 512) - battleovertime->radius--; + if (battleovertime->enabled < 5*TICRATE) + { + battleovertime->enabled++; + if (battleovertime->enabled == TICRATE) + S_StartSound(NULL, sfx_bhurry); + if (battleovertime->enabled == 5*TICRATE) + S_StartSound(NULL, sfx_kc40); + } else - battleovertime->radius = 512; + { + if (battleovertime->radius > battleovertime->minradius) + battleovertime->radius--; + else + battleovertime->radius = battleovertime->minradius; + } if (leveltime & 1) { @@ -6533,6 +6543,12 @@ void P_RunBattleOvertime(void) } } + if (battleovertime->enabled < 5*TICRATE) + return; + + if (!S_IdPlaying(sfx_s3kd4s)) // global ambience + S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, (4096-battleovertime->radius)/2)); + for (i = 0; i < 16; i++) { j = 0; diff --git a/src/p_saveg.c b/src/p_saveg.c index 8306e64ad..b70c7f83c 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3301,6 +3301,7 @@ static void P_NetArchiveMisc(void) // battleovertime_t WRITEUINT8(save_p, battleovertime->enabled); WRITEUINT16(save_p, battleovertime->radius); + WRITEUINT16(save_p, battleovertime->minradius); WRITEFIXED(save_p, battleovertime->x); WRITEFIXED(save_p, battleovertime->y); WRITEFIXED(save_p, battleovertime->z); @@ -3413,8 +3414,9 @@ static inline boolean P_NetUnArchiveMisc(void) battlewanted[i] = READSINT8(save_p); // battleovertime_t - battleovertime->enabled = (boolean)READUINT8(save_p); + battleovertime->enabled = READUINT8(save_p); battleovertime->radius = READUINT16(save_p); + battleovertime->minradius = READUINT16(save_p); battleovertime->x = READFIXED(save_p); battleovertime->y = READFIXED(save_p); battleovertime->z = READFIXED(save_p); diff --git a/src/sounds.c b/src/sounds.c index a3bc8bf41..4cad7e7c8 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -815,6 +815,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"chain", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Mementos Reaper {"mkuma", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Trigger Happy Havoc Monokuma {"toada", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Arid Sands Toad scream + {"bhurry", false, 255, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // v1.0.2 Battle overtime {"itfree", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // :shitsfree: {"dbgsal", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Debug notification diff --git a/src/sounds.h b/src/sounds.h index 4c341d49d..12e1fa43d 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -890,6 +890,7 @@ typedef enum sfx_chain, sfx_mkuma, sfx_toada, + sfx_bhurry, sfx_itfree, sfx_dbgsal, From 399cc44b93bdac928cfe3cb4ef5832d7a3515273 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 6 Dec 2018 18:16:13 -0500 Subject: [PATCH 04/20] Group k_killfield with the rest of the v1.0.2 vars --- src/d_player.h | 2 +- src/dehacked.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index ce5a92ab0..9ae46c6a8 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -346,12 +346,12 @@ typedef enum k_comebackpoints, // Number of times you've bombed or gave an item to someone; once it's 3 it gets set back to 0 and you're given a bumper k_comebackmode, // 0 = bomb, 1 = item k_wanted, // Timer for determining WANTED status, lowers when hitting people, prevents the game turning into Camp Lazlo - k_killfield, // How long have you been in the kill field, stay in too long and lose a bumper k_yougotem, // "You Got Em" gfx when hitting someone as a karma player via a method that gets you back in the game instantly // v1.0.2 vars k_itemblink, // Item flashing after roulette, prevents Hyudoro stealing AND serves as a mashing indicator k_itemblinkmode, // Type of flashing: 0 = white (normal), 1 = red (mashing), 2 = rainbow (enhanced items) + k_killfield, // How long have you been in the kill field, stay in too long and lose a bumper NUMKARTSTUFF } kartstufftype_t; diff --git a/src/dehacked.c b/src/dehacked.c index 44c8163df..1e4a9266a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8284,11 +8284,11 @@ static const char *const KARTSTUFF_LIST[] = { "COMEBACKPOINTS", "COMEBACKMODE", "WANTED", - "KILLFIELD", "YOUGOTEM", "ITEMBLINK", - "ITEMBLINKMODE" + "ITEMBLINKMODE", + "KILLFIELD" }; static const char *const HUDITEMS_LIST[] = { From 312dd3f57f848920534f39c91d1d8e4a4f3152fe Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 7 Dec 2018 18:50:36 -0500 Subject: [PATCH 05/20] Ensure ALL boxes are respawned for overtime --- src/p_inter.c | 4 ++- src/p_local.h | 1 + src/p_mobj.c | 87 ++++++++++++++++++++++++++------------------------- 3 files changed, 49 insertions(+), 43 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index b5615e4c8..037a3566e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1792,7 +1792,7 @@ void P_CheckTimeLimit(void) //Optional tie-breaker for Match/CTF else*/ -#define TESTOVERTIMEINFREEPLAY +//#define TESTOVERTIMEINFREEPLAY if (cv_overtime.value) { #ifndef TESTOVERTIMEINFREEPLAY @@ -1811,6 +1811,8 @@ void P_CheckTimeLimit(void) thinker_t *th; mobj_t *item = NULL; + P_RespawnBattleBoxes(); // FORCE THESE TO BE RESPAWNED FOR THIS!!!!!!! + // Find us an item box to center on. for (th = thinkercap.next; th != &thinkercap; th = th->next) { diff --git a/src/p_local.h b/src/p_local.h index b6dcd4d0b..4e06f3230 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -216,6 +216,7 @@ extern tic_t itemrespawntime[ITEMQUESIZE]; extern size_t iquehead, iquetail; extern consvar_t cv_gravity/*, cv_viewheight*/; +void P_RespawnBattleBoxes(void); void P_RespawnSpecials(void); mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); diff --git a/src/p_mobj.c b/src/p_mobj.c index a79a3427d..5ae74d947 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9544,10 +9544,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s if (G_BattleGametype() && (mobj->threshold != 70)) { if (mobj->threshold != 69) - { - mobj->fuse = cv_itemrespawntime.value*TICRATE + 2; break; - } } else { @@ -10900,6 +10897,50 @@ void P_PrecipitationEffects(void) } } +void P_RespawnBattleBoxes(void) +{ + thinker_t *th; + + if (!G_BattleGametype()) + return; + + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + mobj_t *box; + mobj_t *newmobj; + + if (th->function.acp1 != (actionf_p1)P_MobjThinker) // not a mobj + continue; + + box = (mobj_t *)th; + + if (box->type != MT_RANDOMITEM || box->threshold != 68 || box->fuse) // only popped items + continue; + + // Respawn from mapthing if you have one! + if (box->spawnpoint) + { + P_SpawnMapThing(box->spawnpoint); + newmobj = box->spawnpoint->mobj; // this is set to the new mobj in P_SpawnMapThing + P_SpawnMobj(box->spawnpoint->mobj->x, box->spawnpoint->mobj->y, box->spawnpoint->mobj->z, MT_EXPLODE); // poof into existance + } + else + { + newmobj = P_SpawnMobj(box->x, box->y, box->z, box->type); + P_SpawnMobj(newmobj->x, newmobj->y, newmobj->z, MT_EXPLODE); // poof into existance + } + + // Transfer flags2 (strongbox, objectflip) + newmobj->flags2 = box->flags2; + P_RemoveMobj(box); // make sure they disappear + numgotboxes--; // you've restored a box, remove it from the count + //continue; -- irrelevant? + } + + if (numgotboxes < 0) + numgotboxes = 0; +} + // // P_RespawnSpecials // @@ -10911,45 +10952,7 @@ void P_RespawnSpecials(void) mapthing_t *mthing = NULL; if (G_BattleGametype() && numgotboxes >= (4*nummapboxes/5)) // Battle Mode respawns all boxes in a different way - { - thinker_t *th; - - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - mobj_t *box; - mobj_t *newmobj; - - if (th->function.acp1 != (actionf_p1)P_MobjThinker) // not a mobj - continue; - - box = (mobj_t *)th; - - if (box->type != MT_RANDOMITEM || box->threshold != 68 || box->fuse) // only popped items - continue; - - // Respawn from mapthing if you have one! - if (box->spawnpoint) - { - P_SpawnMapThing(box->spawnpoint); - newmobj = box->spawnpoint->mobj; // this is set to the new mobj in P_SpawnMapThing - P_SpawnMobj(box->spawnpoint->mobj->x, box->spawnpoint->mobj->y, box->spawnpoint->mobj->z, MT_EXPLODE); // poof into existance - } - else - { - newmobj = P_SpawnMobj(box->x, box->y, box->z, box->type); - P_SpawnMobj(newmobj->x, newmobj->y, newmobj->z, MT_EXPLODE); // poof into existance - } - - // Transfer flags2 (strongbox, objectflip) - newmobj->flags2 = box->flags2; - P_RemoveMobj(box); // make sure they disappear - numgotboxes--; // you've restored a box, remove it from the count - //continue; -- irrelevant? - } - - if (numgotboxes < 0) - numgotboxes = 0; - } + P_RespawnBattleBoxes(); // only respawn items when cv_itemrespawn is on if (!cv_itemrespawn.value) From b27c70987929711d04acdef3ebc76ed2c5b57a9a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 15 Dec 2018 19:14:30 -0500 Subject: [PATCH 06/20] a bunch of stuff I left uncommited --- src/d_netcmd.c | 4 +-- src/dehacked.c | 2 ++ src/doomdef.h | 2 +- src/doomstat.h | 4 +-- src/info.c | 34 +++++++++++++++++-- src/info.h | 2 ++ src/k_kart.c | 6 +++- src/p_inter.c | 13 ++++++-- src/p_mobj.c | 84 +++++++++++++++++++++++++++++++++++++---------- src/p_saveg.c | 8 ++--- src/sdl/i_video.c | 2 +- 11 files changed, 127 insertions(+), 34 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 06f65bcaa..9cf61bc5f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4327,9 +4327,9 @@ void D_GameTypeChanged(INT32 lastgametype) case GT_TEAMMATCH: if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits { - // default settings for match: 3 mins, no pointlimit + // default settings for match: 2 mins, no pointlimit CV_SetValue(&cv_pointlimit, 0); - CV_SetValue(&cv_timelimit, 3); + CV_SetValue(&cv_timelimit, 2); } if (!cv_itemrespawntime.changed) CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally diff --git a/src/dehacked.c b/src/dehacked.c index 1e4a9266a..46b90e8af 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7101,6 +7101,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_OVERTIMEFOG", "S_OVERTIMEORB", + "S_OVERTIMEBEAM", #ifdef SEENAMES "S_NAMECHECK", @@ -7891,6 +7892,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_OVERTIMEFOG", "MT_OVERTIMEORB", + "MT_OVERTIMEBEAM", #ifdef SEENAMES "MT_NAMECHECK", diff --git a/src/doomdef.h b/src/doomdef.h index a35f3291d..0791e07e9 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -140,7 +140,7 @@ extern FILE *logstream; #endif -//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 +#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number diff --git a/src/doomstat.h b/src/doomstat.h index eb0af90f9..aa92e45ed 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -476,8 +476,8 @@ extern SINT8 pickedvote; typedef struct { UINT8 enabled; ///< Has this been initalized yet? - UINT16 radius, minradius; ///< Radius of kill field - fixed_t x, y, z; ///< Position to center on (z is only used for visuals) + fixed_t radius, minradius; ///< Radius of kill field + fixed_t x, y, z; ///< Position to center on } battleovertime_t; extern battleovertime_t *battleovertime; diff --git a/src/info.c b/src/info.c index ae9696edc..917e5ddec 100644 --- a/src/info.c +++ b/src/info.c @@ -3395,7 +3395,8 @@ state_t states[NUMSTATES] = {SPR_FWRK, 4|FF_FULLBRIGHT, TICRATE, {NULL}, 0, 0, S_NULL}, // S_KARMAFIREWORKTRAIL {SPR_OTFG, FF_FULLBRIGHT|FF_TRANS50, TICRATE, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEFOG - {SPR_OTFG, 1|FF_FULLBRIGHT, 8, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB + {SPR_OTFG, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB + {SPR_OTFG, 3|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEBEAM #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK @@ -20072,7 +20073,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 16<type == MT_RANDOMITEM) + return 10<type) { case MT_PLAYER: @@ -4396,7 +4400,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->kartstuff[k_wanted]++; if (battleovertime->enabled >= 5*TICRATE) { - if (P_AproxDistance(player->mo->x - battleovertime->x, player->mo->y - battleovertime->y) > (battleovertime->radius<mo->x - battleovertime->x, player->mo->y - battleovertime->y) > battleovertime->radius) { player->kartstuff[k_killfield]++; if (player->kartstuff[k_killfield] > 4*TICRATE) diff --git a/src/p_inter.c b/src/p_inter.c index 037a3566e..6e4b6f0e9 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -373,7 +373,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; case MT_RANDOMITEM: // SRB2kart if (!P_CanPickupItem(player, 1)) + { + if (G_BattleGametype() && special->threshold == 70 && special->health) + { + K_KartBouncing(toucher, special, false, false); + special->extravalue1 = 6; + } return; + } if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) { @@ -1792,7 +1799,7 @@ void P_CheckTimeLimit(void) //Optional tie-breaker for Match/CTF else*/ -//#define TESTOVERTIMEINFREEPLAY +#define TESTOVERTIMEINFREEPLAY if (cv_overtime.value) { #ifndef TESTOVERTIMEINFREEPLAY @@ -1839,8 +1846,8 @@ void P_CheckTimeLimit(void) battleovertime->x = item->x; battleovertime->y = item->y; battleovertime->z = item->z; - battleovertime->radius = 4096; - battleovertime->minradius = (cv_overtime.value == 2 ? 40 : 512); + battleovertime->radius = 4096*mapheaderinfo[gamemap-1]->mobj_scale; + battleovertime->minradius = (cv_overtime.value == 2 ? 40 : 512)*mapheaderinfo[gamemap-1]->mobj_scale; battleovertime->enabled++; S_StartSound(NULL, sfx_kc47); } diff --git a/src/p_mobj.c b/src/p_mobj.c index 5ae74d947..a37c26d78 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6417,6 +6417,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool fixed_t flatz[MAXPLANESPERSECTOR]; UINT8 numflats = 0; mobj_t *mo; + fixed_t scale = mapheaderinfo[gamemap-1]->mobj_scale; subsector_t *ss = R_IsPointInSubsector(x, y); sector_t *sec; @@ -6424,6 +6425,18 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool return; sec = ss->sector; + switch(type) + { + case MT_OVERTIMEFOG: + scale *= 4; + break; + case MT_OVERTIMEORB: + scale += battleovertime->radius/1024; + break; + default: + break; + } + // convoluted stuff JUST to get all of the planes we need to draw orbs on :V if (sec->floorpic != skyflatnum) @@ -6438,9 +6451,9 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool if (sec->ceilingpic != skyflatnum && ceiling) { #ifdef ESLOPE - flatz[numflats] = (sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : sec->ceilingheight) - mobjinfo[MT_THOK].height; + flatz[numflats] = (sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : sec->ceilingheight) - FixedMul(mobjinfo[type].height, scale); #else - flatz[numflats] = (sec->ceilingheight) - mobjinfo[MT_THOK].height; + flatz[numflats] = (sec->ceilingheight) - FixedMul(mobjinfo[type].height, scale); #endif numflats++; } @@ -6464,9 +6477,9 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool if (*rover->bottompic != skyflatnum && ceiling) { #ifdef ESLOPE - flatz[numflats] = (*rover->b_slope ? P_GetZAt(*rover->b_slope, x, y) : *rover->bottomheight) - mobjinfo[MT_THOK].height; + flatz[numflats] = (*rover->b_slope ? P_GetZAt(*rover->b_slope, x, y) : *rover->bottomheight) - FixedMul(mobjinfo[type].height, scale); #else - flatz[numflats] = (*rover->bottomheight) - mobjinfo[MT_THOK].height; + flatz[numflats] = (*rover->bottomheight) - FixedMul(mobjinfo[type].height, scale); #endif numflats++; } @@ -6487,20 +6500,20 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool continue; } + P_SetScale(mo, scale); + switch(type) { case MT_OVERTIMEFOG: - P_SetScale(mo, 4*mo->scale); mo->destscale = 8*mo->scale; mo->momz = P_RandomRange(1,8)*mo->scale; break; case MT_OVERTIMEORB: - P_SetScale(mo, 2*mo->scale); mo->destscale = mo->scale/4; if ((leveltime/2) & 1) mo->frame++; if (battleovertime->enabled < 5*TICRATE) - mo->frame |= FF_TRANS50; + mo->flags2 |= MF2_SHADOW; /*if (i == 0 && !((leveltime/2) % 3 == 0)) S_StartSoundAtVolume(mo, sfx_s1b1, 64);*/ break; @@ -6514,6 +6527,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool void P_RunBattleOvertime(void) { UINT8 i, j; + UINT16 orbs = 16; if (battleovertime->enabled < 5*TICRATE) { @@ -6526,28 +6540,45 @@ void P_RunBattleOvertime(void) else { if (battleovertime->radius > battleovertime->minradius) - battleovertime->radius--; + battleovertime->radius -= mapheaderinfo[gamemap-1]->mobj_scale; else battleovertime->radius = battleovertime->minradius; } if (leveltime & 1) { - for (i = 0; i < 16; i++) // 16 base orbs + UINT8 transparency = tr_trans50; + + if (!splitscreen && players[displayplayer].mo) { - angle_t ang = FixedAngle(((45*i) * (FRACUNIT>>1)) + ((leveltime % 360)<radius - (2*mobjinfo[MT_OVERTIMEORB].radius))<x + P_ReturnThrustX(NULL, ang, dist); - fixed_t y = battleovertime->y + P_ReturnThrustY(NULL, ang, dist); - P_SpawnOvertimeParticles(x, y, MT_OVERTIMEORB, true); + INT32 dist = P_AproxDistance(battleovertime->x-players[displayplayer].mo->x, battleovertime->y-players[displayplayer].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<radius, 16*mapheaderinfo[gamemap-1]->mobj_scale)>>FRACBITS); + for (i = 0; i < orbs; i++) + { + angle_t ang = FixedAngle(((360/orbs) * i * (FRACUNIT>>1)) + (((leveltime*2) % 360)<x + P_ReturnThrustX(NULL, ang, battleovertime->radius); + fixed_t y = battleovertime->y + P_ReturnThrustY(NULL, ang, battleovertime->radius); + P_SpawnOvertimeParticles(x, y, MT_OVERTIMEORB, true); } if (battleovertime->enabled < 5*TICRATE) return; if (!S_IdPlaying(sfx_s3kd4s)) // global ambience - S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, (4096-battleovertime->radius)/2)); + S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, ((4096*mapheaderinfo[gamemap-1]->mobj_scale) - battleovertime->radius)>>FRACBITS / 2)); for (i = 0; i < 16; i++) { @@ -6556,7 +6587,7 @@ void P_RunBattleOvertime(void) { fixed_t x = battleovertime->x + ((P_RandomRange(-64,64) * 128)<y + ((P_RandomRange(-64,64) * 128)<radius + (4*mobjinfo[MT_OVERTIMEFOG].radius))<radius + (8*mobjinfo[MT_OVERTIMEFOG].radius); j++; if (P_AproxDistance(x-battleovertime->x, y-battleovertime->y) < closestdist) continue; @@ -7172,7 +7203,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->x = mobj->target->x; mobj->y = mobj->target->y; - if (!splitscreen) + if (!splitscreen && players[displayplayer].mo) { scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); @@ -9274,6 +9305,25 @@ void P_MobjThinker(mobj_t *mobj) { mobj->color = (1 + (leveltime % (MAXSKINCOLORS-1))); mobj->colorized = true; + if (mobj->extravalue1) + mobj->extravalue1--; + else if (battleovertime->enabled) + { + fixed_t dist = P_AproxDistance(P_AproxDistance(battleovertime->x-mobj->x, battleovertime->y-mobj->y), battleovertime->z-mobj->z); + if (dist > mobj->scale) + { + angle_t hang = R_PointToAngle2(mobj->x, mobj->y, battleovertime->x, battleovertime->y); + angle_t vang = R_PointToAngle2(mobj->z, 0, battleovertime->z, dist); + mobj->momx += FixedMul(FixedMul(mobj->scale, FINECOSINE(hang>>ANGLETOFINESHIFT)), FINECOSINE(vang>>ANGLETOFINESHIFT)); + mobj->momy += FixedMul(FixedMul(mobj->scale, FINESINE(hang>>ANGLETOFINESHIFT)), FINECOSINE(vang>>ANGLETOFINESHIFT)); + mobj->momz += FixedMul(mobj->scale, FINESINE(vang>>ANGLETOFINESHIFT)); + } + else + { + mobj->momx = mobj->momy = mobj->momz = 0; + P_TeleportMove(mobj, battleovertime->x, battleovertime->y, battleovertime->z); + } + } } else { diff --git a/src/p_saveg.c b/src/p_saveg.c index b70c7f83c..f23179280 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3300,8 +3300,8 @@ static void P_NetArchiveMisc(void) // battleovertime_t WRITEUINT8(save_p, battleovertime->enabled); - WRITEUINT16(save_p, battleovertime->radius); - WRITEUINT16(save_p, battleovertime->minradius); + WRITEFIXED(save_p, battleovertime->radius); + WRITEFIXED(save_p, battleovertime->minradius); WRITEFIXED(save_p, battleovertime->x); WRITEFIXED(save_p, battleovertime->y); WRITEFIXED(save_p, battleovertime->z); @@ -3415,8 +3415,8 @@ static inline boolean P_NetUnArchiveMisc(void) // battleovertime_t battleovertime->enabled = READUINT8(save_p); - battleovertime->radius = READUINT16(save_p); - battleovertime->minradius = READUINT16(save_p); + battleovertime->radius = READFIXED(save_p); + battleovertime->minradius = READFIXED(save_p); battleovertime->x = READFIXED(save_p); battleovertime->y = READFIXED(save_p); battleovertime->z = READFIXED(save_p); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 78dfc820c..8bbd60e89 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1370,7 +1370,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #endif // Create a window - window = SDL_CreateWindow("SRB2Kart "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + window = SDL_CreateWindow("FortniteKart "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags); if (window == NULL) From 8391dd520ab9b9eb686140004559b586e31c5dbb Mon Sep 17 00:00:00 2001 From: SeventhSentinel Date: Wed, 2 Jan 2019 14:08:00 -0500 Subject: [PATCH 07/20] Add item spinning, turn into papersprites, spawn more orbs Also tried to fix a memory issue I only get from Sev's compiles by removing the need to free memory for this... but didn't fix anything :/ --- src/doomstat.h | 8 ++---- src/g_game.c | 2 +- src/info.c | 2 +- src/k_kart.c | 14 ++++------ src/p_inter.c | 31 ++++++++++---------- src/p_mobj.c | 76 +++++++++++++++++++++----------------------------- src/p_saveg.c | 24 ++++++++-------- src/p_setup.c | 4 +-- src/p_tick.c | 4 +-- 9 files changed, 71 insertions(+), 94 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index aa92e45ed..2c810dcfe 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -473,14 +473,12 @@ extern SINT8 pickedvote; /** Battle overtime information */ -typedef struct +extern struct battleovertime { - UINT8 enabled; ///< Has this been initalized yet? + UINT16 enabled; ///< Has this been initalized yet? fixed_t radius, minradius; ///< Radius of kill field fixed_t x, y, z; ///< Position to center on -} battleovertime_t; - -extern battleovertime_t *battleovertime; +} battleovertime; extern tic_t hidetime; diff --git a/src/g_game.c b/src/g_game.c index 75e7440b8..42652a4de 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -261,7 +261,7 @@ SINT8 votes[MAXPLAYERS]; // Each player's vote SINT8 pickedvote; // What vote the host rolls // Battle overtime system -battleovertime_t *battleovertime = {NULL}; +struct battleovertime battleovertime; // Server-sided, synched variables SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points diff --git a/src/info.c b/src/info.c index 917e5ddec..50e10ba6b 100644 --- a/src/info.c +++ b/src/info.c @@ -3395,7 +3395,7 @@ state_t states[NUMSTATES] = {SPR_FWRK, 4|FF_FULLBRIGHT, TICRATE, {NULL}, 0, 0, S_NULL}, // S_KARMAFIREWORKTRAIL {SPR_OTFG, FF_FULLBRIGHT|FF_TRANS50, TICRATE, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEFOG - {SPR_OTFG, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB + {SPR_OTFG, 1|FF_FULLBRIGHT|FF_TRANS30|FF_PAPERSPRITE, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB {SPR_OTFG, 3|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEBEAM #ifdef SEENAMES diff --git a/src/k_kart.c b/src/k_kart.c index 87a655436..7dfddcb8a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1033,10 +1033,6 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) { fixed_t weight = 5<type == MT_RANDOMITEM) - return 10<type) { case MT_PLAYER: @@ -4398,9 +4394,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) && !player->kartstuff[k_respawn] && !player->powers[pw_flashing]) { player->kartstuff[k_wanted]++; - if (battleovertime->enabled >= 5*TICRATE) + if (battleovertime.enabled >= 5*TICRATE) { - if (P_AproxDistance(player->mo->x - battleovertime->x, player->mo->y - battleovertime->y) > 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) @@ -7437,15 +7433,15 @@ static void K_drawKartMinimap(void) y -= SHORT(AutomapPic->topoffset); // Draw the super item in Battle - if (G_BattleGametype() && battleovertime->enabled) + if (G_BattleGametype() && battleovertime.enabled) { - if (battleovertime->enabled >= 5*TICRATE || (battleovertime->enabled & 1)) + if (battleovertime.enabled >= 5*TICRATE || (battleovertime.enabled & 1)) { const INT32 prevsplitflags = splitflags; splitflags &= ~V_HUDTRANSHALF; splitflags |= V_HUDTRANS; colormap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE); - K_drawKartMinimapHead(battleovertime->x, battleovertime->y, x, y, splitflags, kp_itemminimap, colormap, AutomapPic); + K_drawKartMinimapHead(battleovertime.x, battleovertime.y, x, y, splitflags, kp_itemminimap, colormap, AutomapPic); splitflags = prevsplitflags; } } diff --git a/src/p_inter.c b/src/p_inter.c index 6e4b6f0e9..f6eb9db65 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -373,14 +373,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; case MT_RANDOMITEM: // SRB2kart if (!P_CanPickupItem(player, 1)) - { - if (G_BattleGametype() && special->threshold == 70 && special->health) - { - K_KartBouncing(toucher, special, false, false); - special->extravalue1 = 6; - } return; - } if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) { @@ -1752,6 +1745,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } +// Easily make it so that overtime works offline +#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 * timelimitintics and overtime's status will be checked here each tick. @@ -1796,10 +1792,9 @@ void P_CheckTimeLimit(void) } } } + else*/ //Optional tie-breaker for Match/CTF - else*/ -#define TESTOVERTIMEINFREEPLAY if (cv_overtime.value) { #ifndef TESTOVERTIMEINFREEPLAY @@ -1812,9 +1807,9 @@ void P_CheckTimeLimit(void) { #endif // Initiate the kill zone - if (!battleovertime->enabled) + if (!battleovertime.enabled) { - UINT8 b = 0; + INT32 b = 0; thinker_t *th; mobj_t *item = NULL; @@ -1843,12 +1838,12 @@ void P_CheckTimeLimit(void) return; item->threshold = 70; // Set constant respawn - battleovertime->x = item->x; - battleovertime->y = item->y; - battleovertime->z = item->z; - battleovertime->radius = 4096*mapheaderinfo[gamemap-1]->mobj_scale; - battleovertime->minradius = (cv_overtime.value == 2 ? 40 : 512)*mapheaderinfo[gamemap-1]->mobj_scale; - battleovertime->enabled++; + battleovertime.x = item->x; + battleovertime.y = item->y; + battleovertime.z = item->z; + battleovertime.radius = 4096*mapheaderinfo[gamemap-1]->mobj_scale; + battleovertime.minradius = (cv_overtime.value == 2 ? 40 : 512)*mapheaderinfo[gamemap-1]->mobj_scale; + battleovertime.enabled = 1; S_StartSound(NULL, sfx_kc47); } return; @@ -1870,6 +1865,8 @@ void P_CheckTimeLimit(void) } } +#undef TESTOVERTIMEINFREEPLAY + /** Checks if a player's score is over the pointlimit and the round should end. * Verify that the value of ::cv_pointlimit is greater than zero before * calling this function. diff --git a/src/p_mobj.c b/src/p_mobj.c index a37c26d78..1279ec7a8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6431,7 +6431,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool scale *= 4; break; case MT_OVERTIMEORB: - scale += battleovertime->radius/1024; + scale += battleovertime.radius/1024; break; default: break; @@ -6509,13 +6509,12 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool mo->momz = P_RandomRange(1,8)*mo->scale; break; case MT_OVERTIMEORB: - mo->destscale = mo->scale/4; + //mo->destscale = mo->scale/4; if ((leveltime/2) & 1) mo->frame++; - if (battleovertime->enabled < 5*TICRATE) + if (battleovertime.enabled < 5*TICRATE) mo->flags2 |= MF2_SHADOW; - /*if (i == 0 && !((leveltime/2) % 3 == 0)) - S_StartSoundAtVolume(mo, sfx_s1b1, 64);*/ + mo->angle = R_PointToAngle2(mo->x, mo->y, battleovertime.x, battleovertime.y) + ANGLE_90; break; default: break; @@ -6527,22 +6526,22 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool void P_RunBattleOvertime(void) { UINT8 i, j; - UINT16 orbs = 16; + UINT16 orbs = 32; - if (battleovertime->enabled < 5*TICRATE) + if (battleovertime.enabled < 5*TICRATE) { - battleovertime->enabled++; - if (battleovertime->enabled == TICRATE) + battleovertime.enabled++; + if (battleovertime.enabled == TICRATE) S_StartSound(NULL, sfx_bhurry); - if (battleovertime->enabled == 5*TICRATE) + if (battleovertime.enabled == 5*TICRATE) S_StartSound(NULL, sfx_kc40); } else { - if (battleovertime->radius > battleovertime->minradius) - battleovertime->radius -= mapheaderinfo[gamemap-1]->mobj_scale; + if (battleovertime.radius > battleovertime.minradius) + battleovertime.radius -= mapheaderinfo[gamemap-1]->mobj_scale; else - battleovertime->radius = battleovertime->minradius; + battleovertime.radius = battleovertime.minradius; } if (leveltime & 1) @@ -6551,45 +6550,45 @@ void P_RunBattleOvertime(void) if (!splitscreen && players[displayplayer].mo) { - INT32 dist = P_AproxDistance(battleovertime->x-players[displayplayer].mo->x, battleovertime->y-players[displayplayer].mo->y); + INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayer].mo->x, battleovertime.y-players[displayplayer].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); + 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<radius, 16*mapheaderinfo[gamemap-1]->mobj_scale)>>FRACBITS); + // 32 orbs at the normal minimum size of 512 + orbs = max(4, FixedDiv(battleovertime.radius, 16*mapheaderinfo[gamemap-1]->mobj_scale)>>FRACBITS); for (i = 0; i < orbs; i++) { angle_t ang = FixedAngle(((360/orbs) * i * (FRACUNIT>>1)) + (((leveltime*2) % 360)<x + P_ReturnThrustX(NULL, ang, battleovertime->radius); - fixed_t y = battleovertime->y + P_ReturnThrustY(NULL, ang, battleovertime->radius); + fixed_t x = battleovertime.x + P_ReturnThrustX(NULL, ang, battleovertime.radius); + fixed_t y = battleovertime.y + P_ReturnThrustY(NULL, ang, battleovertime.radius); P_SpawnOvertimeParticles(x, y, MT_OVERTIMEORB, true); } - if (battleovertime->enabled < 5*TICRATE) + if (battleovertime.enabled < 5*TICRATE) return; - if (!S_IdPlaying(sfx_s3kd4s)) // global ambience - S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, ((4096*mapheaderinfo[gamemap-1]->mobj_scale) - battleovertime->radius)>>FRACBITS / 2)); + /*if (!S_IdPlaying(sfx_s3kd4s)) // global ambience + S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, ((4096*mapheaderinfo[gamemap-1]->mobj_scale) - 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)<y + ((P_RandomRange(-64,64) * 128)<radius + (8*mobjinfo[MT_OVERTIMEFOG].radius); + fixed_t x = battleovertime.x + ((P_RandomRange(-64,64) * 128)<x, y-battleovertime->y) < closestdist) + if (P_AproxDistance(x-battleovertime.x, y-battleovertime.y) < closestdist) continue; P_SpawnOvertimeParticles(x, y, MT_OVERTIMEFOG, false); break; @@ -9303,26 +9302,15 @@ void P_MobjThinker(mobj_t *mobj) case MT_RANDOMITEM: if (G_BattleGametype() && mobj->threshold == 70) { - mobj->color = (1 + (leveltime % (MAXSKINCOLORS-1))); + mobj->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); mobj->colorized = true; - if (mobj->extravalue1) - mobj->extravalue1--; - else if (battleovertime->enabled) + + if (battleovertime.enabled) { - fixed_t dist = P_AproxDistance(P_AproxDistance(battleovertime->x-mobj->x, battleovertime->y-mobj->y), battleovertime->z-mobj->z); - if (dist > mobj->scale) - { - angle_t hang = R_PointToAngle2(mobj->x, mobj->y, battleovertime->x, battleovertime->y); - angle_t vang = R_PointToAngle2(mobj->z, 0, battleovertime->z, dist); - mobj->momx += FixedMul(FixedMul(mobj->scale, FINECOSINE(hang>>ANGLETOFINESHIFT)), FINECOSINE(vang>>ANGLETOFINESHIFT)); - mobj->momy += FixedMul(FixedMul(mobj->scale, FINESINE(hang>>ANGLETOFINESHIFT)), FINECOSINE(vang>>ANGLETOFINESHIFT)); - mobj->momz += FixedMul(mobj->scale, FINESINE(vang>>ANGLETOFINESHIFT)); - } - else - { - mobj->momx = mobj->momy = mobj->momz = 0; - P_TeleportMove(mobj, battleovertime->x, battleovertime->y, battleovertime->z); - } + fixed_t dist = min((4096*mapheaderinfo[gamemap-1]->mobj_scale - battleovertime.radius) / 2, 512*mapheaderinfo[gamemap-1]->mobj_scale); + angle_t ang = FixedAngle((leveltime % 360) << FRACBITS); + P_TeleportMove(mobj, battleovertime.x + P_ReturnThrustX(NULL, ang, dist), + battleovertime.y + P_ReturnThrustY(NULL, ang, dist), battleovertime.z); } } else diff --git a/src/p_saveg.c b/src/p_saveg.c index f23179280..5d4b88f84 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3299,12 +3299,12 @@ static void P_NetArchiveMisc(void) WRITESINT8(save_p, battlewanted[i]); // battleovertime_t - WRITEUINT8(save_p, battleovertime->enabled); - WRITEFIXED(save_p, battleovertime->radius); - WRITEFIXED(save_p, battleovertime->minradius); - WRITEFIXED(save_p, battleovertime->x); - WRITEFIXED(save_p, battleovertime->y); - WRITEFIXED(save_p, battleovertime->z); + WRITEUINT16(save_p, battleovertime.enabled); + WRITEFIXED(save_p, battleovertime.radius); + WRITEFIXED(save_p, battleovertime.minradius); + WRITEFIXED(save_p, battleovertime.x); + WRITEFIXED(save_p, battleovertime.y); + WRITEFIXED(save_p, battleovertime.z); WRITEUINT32(save_p, wantedcalcdelay); WRITEUINT32(save_p, indirectitemcooldown); @@ -3414,12 +3414,12 @@ static inline boolean P_NetUnArchiveMisc(void) battlewanted[i] = READSINT8(save_p); // battleovertime_t - battleovertime->enabled = READUINT8(save_p); - battleovertime->radius = READFIXED(save_p); - battleovertime->minradius = READFIXED(save_p); - battleovertime->x = READFIXED(save_p); - battleovertime->y = READFIXED(save_p); - battleovertime->z = READFIXED(save_p); + battleovertime.enabled = READUINT16(save_p); + battleovertime.radius = READFIXED(save_p); + battleovertime.minradius = READFIXED(save_p); + battleovertime.x = READFIXED(save_p); + battleovertime.y = READFIXED(save_p); + battleovertime.z = READFIXED(save_p); wantedcalcdelay = READUINT32(save_p); indirectitemcooldown = READUINT32(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index 01b231116..4bfb0ff88 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2374,9 +2374,7 @@ static void P_LevelInitStuff(void) for (i = 0; i < 4; i++) battlewanted[i] = -1; - if (!battleovertime) - battleovertime = Z_Malloc(sizeof(battleovertime_t), PU_STATIC, NULL); - memset(battleovertime, 0, sizeof(battleovertime_t)); + memset(&battleovertime, 0, sizeof(struct battleovertime)); } // diff --git a/src/p_tick.c b/src/p_tick.c index def074d60..90b1835b6 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -621,7 +621,7 @@ void P_Ticker(boolean run) if (run) { P_RunThinkers(); - if (G_BattleGametype() && battleovertime->enabled) + if (G_BattleGametype() && battleovertime.enabled) P_RunBattleOvertime(); // Run any "after all the other thinkers" stuff @@ -762,7 +762,7 @@ void P_PreTicker(INT32 frames) } P_RunThinkers(); - if (G_BattleGametype() && battleovertime->enabled) + if (G_BattleGametype() && battleovertime.enabled) P_RunBattleOvertime(); // Run any "after all the other thinkers" stuff From 7790a6110c12c1a16a561908265add61858770ed Mon Sep 17 00:00:00 2001 From: SeventhSentinel Date: Wed, 2 Jan 2019 16:22:49 -0500 Subject: [PATCH 08/20] Minor issues --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index cc5ba2379..887e3e171 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6525,7 +6525,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool void P_RunBattleOvertime(void) { - UINT8 i, j; + UINT16 i, j; UINT16 orbs = 32; if (battleovertime.enabled < 5*TICRATE) @@ -6567,7 +6567,7 @@ void P_RunBattleOvertime(void) orbs = max(4, FixedDiv(battleovertime.radius, 16*mapheaderinfo[gamemap-1]->mobj_scale)>>FRACBITS); for (i = 0; i < orbs; i++) { - angle_t ang = FixedAngle(((360/orbs) * i * (FRACUNIT>>1)) + (((leveltime*2) % 360)< Date: Wed, 2 Jan 2019 19:32:23 -0500 Subject: [PATCH 09/20] New visual Will be replaced later regardless, but ah well --- src/info.c | 6 +++--- src/p_mobj.c | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/info.c b/src/info.c index 030e4c3ff..080148264 100644 --- a/src/info.c +++ b/src/info.c @@ -3395,8 +3395,8 @@ state_t states[NUMSTATES] = {SPR_FWRK, 4|FF_FULLBRIGHT, TICRATE, {NULL}, 0, 0, S_NULL}, // S_KARMAFIREWORKTRAIL {SPR_OTFG, FF_FULLBRIGHT|FF_TRANS50, TICRATE, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEFOG - {SPR_OTFG, 1|FF_FULLBRIGHT|FF_TRANS30|FF_PAPERSPRITE, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEORB - {SPR_OTFG, 3|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_OVERTIMEBEAM + {SPR_OTFG, 2|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 #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK @@ -20101,7 +20101,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16<destscale = mo->scale/4; - if ((leveltime/2) & 1) - mo->frame++; + mo->frame += ((leveltime/4) % 8); if (battleovertime.enabled < 5*TICRATE) mo->flags2 |= MF2_SHADOW; mo->angle = R_PointToAngle2(mo->x, mo->y, battleovertime.x, battleovertime.y) + ANGLE_90; @@ -6526,7 +6525,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool void P_RunBattleOvertime(void) { UINT16 i, j; - UINT16 orbs = 32; + UINT16 orbs = 16; if (battleovertime.enabled < 5*TICRATE) { @@ -6563,13 +6562,14 @@ void P_RunBattleOvertime(void) } } - // 32 orbs at the normal minimum size of 512 - orbs = max(4, FixedDiv(battleovertime.radius, 16*mapheaderinfo[gamemap-1]->mobj_scale)>>FRACBITS); + // 16 orbs at the normal minimum size of 512 + orbs = max(4, FixedDiv(battleovertime.radius, 32*mapheaderinfo[gamemap-1]->mobj_scale)>>FRACBITS); for (i = 0; i < orbs; i++) { - angle_t ang = FixedAngle(((((i+1) * 360) / orbs) + ((leveltime % 360) * 2))<mobj_scale + battleovertime.radius/1024; + 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)); P_SpawnOvertimeParticles(x, y, MT_OVERTIMEORB, true); } @@ -9293,10 +9293,14 @@ void P_MobjThinker(mobj_t *mobj) if (battleovertime.enabled) { + mobj_t *ghost; fixed_t dist = min((4096*mapheaderinfo[gamemap-1]->mobj_scale - battleovertime.radius) / 2, 512*mapheaderinfo[gamemap-1]->mobj_scale); angle_t ang = FixedAngle((leveltime % 360) << FRACBITS); P_TeleportMove(mobj, battleovertime.x + P_ReturnThrustX(NULL, ang, dist), battleovertime.y + P_ReturnThrustY(NULL, ang, dist), battleovertime.z); + ghost = P_SpawnGhostMobj(mobj); + ghost->fuse = 4; + ghost->frame |= FF_FULLBRIGHT; } } else From ea9fc3c5a1bbd0c0ce086aa96f0fef6453bc5053 Mon Sep 17 00:00:00 2001 From: SeventhSentinel Date: Wed, 2 Jan 2019 19:37:01 -0500 Subject: [PATCH 10/20] Comment these out again --- src/doomdef.h | 2 +- src/p_inter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 0791e07e9..a35f3291d 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -140,7 +140,7 @@ extern FILE *logstream; #endif -#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 +//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number diff --git a/src/p_inter.c b/src/p_inter.c index f6eb9db65..5902063f3 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1746,7 +1746,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } // 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 From 02425bade6f60b2625304429d56127b4027c263b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 8 Jan 2019 18:26:16 -0500 Subject: [PATCH 11/20] Double time for overtime to kick in, make barrier always completely visible --- src/k_kart.c | 4 ++-- src/p_mobj.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 077f1861c..a156f2a57 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4403,7 +4403,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) && !player->kartstuff[k_respawn] && !player->powers[pw_flashing]) { player->kartstuff[k_wanted]++; - if (battleovertime.enabled >= 5*TICRATE) + if (battleovertime.enabled >= 10*TICRATE) { if (P_AproxDistance(player->mo->x - battleovertime.x, player->mo->y - battleovertime.y) > battleovertime.radius) { @@ -7444,7 +7444,7 @@ static void K_drawKartMinimap(void) // Draw the super item in Battle if (G_BattleGametype() && battleovertime.enabled) { - if (battleovertime.enabled >= 5*TICRATE || (battleovertime.enabled & 1)) + if (battleovertime.enabled >= 10*TICRATE || (battleovertime.enabled & 1)) { const INT32 prevsplitflags = splitflags; splitflags &= ~V_HUDTRANSHALF; diff --git a/src/p_mobj.c b/src/p_mobj.c index 436339d2d..8c65d128a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6511,8 +6511,8 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool case MT_OVERTIMEORB: //mo->destscale = mo->scale/4; mo->frame += ((leveltime/4) % 8); - if (battleovertime.enabled < 5*TICRATE) - mo->flags2 |= MF2_SHADOW; + /*if (battleovertime.enabled < 10*TICRATE) + mo->flags2 |= MF2_SHADOW;*/ mo->angle = R_PointToAngle2(mo->x, mo->y, battleovertime.x, battleovertime.y) + ANGLE_90; break; default: @@ -6527,12 +6527,12 @@ void P_RunBattleOvertime(void) UINT16 i, j; UINT16 orbs = 16; - if (battleovertime.enabled < 5*TICRATE) + if (battleovertime.enabled < 10*TICRATE) { battleovertime.enabled++; if (battleovertime.enabled == TICRATE) S_StartSound(NULL, sfx_bhurry); - if (battleovertime.enabled == 5*TICRATE) + if (battleovertime.enabled == 10*TICRATE) S_StartSound(NULL, sfx_kc40); } else @@ -6573,7 +6573,7 @@ void P_RunBattleOvertime(void) P_SpawnOvertimeParticles(x, y, MT_OVERTIMEORB, true); } - if (battleovertime.enabled < 5*TICRATE) + if (battleovertime.enabled < 10*TICRATE) return; /*if (!S_IdPlaying(sfx_s3kd4s)) // global ambience From c6c13bda6481362f84e95f149a658938d0b90ebe Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 8 Jan 2019 18:36:02 -0500 Subject: [PATCH 12/20] Use mapobjectscale --- src/p_inter.c | 4 ++-- src/p_mobj.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 0142981f8..3c0e3f927 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1841,8 +1841,8 @@ void P_CheckTimeLimit(void) battleovertime.x = item->x; battleovertime.y = item->y; battleovertime.z = item->z; - battleovertime.radius = 4096*mapheaderinfo[gamemap-1]->mobj_scale; - battleovertime.minradius = (cv_overtime.value == 2 ? 40 : 512)*mapheaderinfo[gamemap-1]->mobj_scale; + battleovertime.radius = 4096*mapobjectscale; + battleovertime.minradius = (cv_overtime.value == 2 ? 40 : 512) * mapobjectscale; battleovertime.enabled = 1; S_StartSound(NULL, sfx_kc47); } diff --git a/src/p_mobj.c b/src/p_mobj.c index 8c65d128a..afe4274b6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6417,7 +6417,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool fixed_t flatz[MAXPLANESPERSECTOR]; UINT8 numflats = 0; mobj_t *mo; - fixed_t scale = mapheaderinfo[gamemap-1]->mobj_scale; + fixed_t scale = mapobjectscale; subsector_t *ss = R_IsPointInSubsector(x, y); sector_t *sec; @@ -6538,7 +6538,7 @@ void P_RunBattleOvertime(void) else { if (battleovertime.radius > battleovertime.minradius) - battleovertime.radius -= mapheaderinfo[gamemap-1]->mobj_scale; + battleovertime.radius -= mapobjectscale; else battleovertime.radius = battleovertime.minradius; } @@ -6563,11 +6563,11 @@ void P_RunBattleOvertime(void) } // 16 orbs at the normal minimum size of 512 - orbs = max(4, FixedDiv(battleovertime.radius, 32*mapheaderinfo[gamemap-1]->mobj_scale)>>FRACBITS); + orbs = max(4, FixedDiv(battleovertime.radius, 32*mapobjectscale)>>FRACBITS); for (i = 0; i < orbs; i++) { angle_t ang = FixedAngle(((((i+1) * 360) / orbs) - ((leveltime/2) % 360))<mobj_scale + battleovertime.radius/1024; + fixed_t scale = mapobjectscale + battleovertime.radius/1024; 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)); P_SpawnOvertimeParticles(x, y, MT_OVERTIMEORB, true); @@ -6577,7 +6577,7 @@ void P_RunBattleOvertime(void) return; /*if (!S_IdPlaying(sfx_s3kd4s)) // global ambience - S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, ((4096*mapheaderinfo[gamemap-1]->mobj_scale) - battleovertime.radius)>>FRACBITS / 2));*/ + S_StartSoundAtVolume(NULL, sfx_s3kd4s, min(255, ((4096*mapobjectscale) - battleovertime.radius)>>FRACBITS / 2));*/ for (i = 0; i < 16; i++) { @@ -9294,7 +9294,7 @@ void P_MobjThinker(mobj_t *mobj) if (battleovertime.enabled) { mobj_t *ghost; - fixed_t dist = min((4096*mapheaderinfo[gamemap-1]->mobj_scale - battleovertime.radius) / 2, 512*mapheaderinfo[gamemap-1]->mobj_scale); + fixed_t dist = min((4096*mapobjectscale - battleovertime.radius) / 2, 512*mapobjectscale); angle_t ang = FixedAngle((leveltime % 360) << FRACBITS); P_TeleportMove(mobj, battleovertime.x + P_ReturnThrustX(NULL, ang, dist), battleovertime.y + P_ReturnThrustY(NULL, ang, dist), battleovertime.z); From 450e693c655ef7a2ce11c2ba0ccab8cd4986a376 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 8 Jan 2019 20:36:42 -0500 Subject: [PATCH 13/20] Extra improvements - The rainbow item now spawns in the middle before slowly expanding in radius. This keeps it anti-campy, but doesn't make it a pain in the ass to grab if it's being constantly picked up like intended. - Entirely remove the potential for holes in the barrier sprites - Flip particles that are attached to ceilings - More throughly check to make sure particles don't spawn in the skybox --- src/p_mobj.c | 90 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 29 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index afe4274b6..ec20ad0df 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6411,13 +6411,13 @@ static void P_RemoveShadow(mobj_t *thing) // SAL'S KART BATTLE MODE OVERTIME HANDLER #define MAXPLANESPERSECTOR (MAXFFLOORS+1)*2 -static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, boolean ceiling) +static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjtype_t type, boolean ceiling) { UINT8 i; fixed_t flatz[MAXPLANESPERSECTOR]; + boolean flip[MAXPLANESPERSECTOR]; UINT8 numflats = 0; mobj_t *mo; - fixed_t scale = mapobjectscale; subsector_t *ss = R_IsPointInSubsector(x, y); sector_t *sec; @@ -6425,20 +6425,11 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool return; sec = ss->sector; - switch(type) - { - case MT_OVERTIMEFOG: - scale *= 4; - break; - case MT_OVERTIMEORB: - scale += battleovertime.radius/1024; - break; - default: - break; - } - // 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) { #ifdef ESLOPE @@ -6455,6 +6446,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool #else flatz[numflats] = (sec->ceilingheight) - FixedMul(mobjinfo[type].height, scale); #endif + flip[numflats] = true; numflats++; } @@ -6481,6 +6473,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool #else flatz[numflats] = (*rover->bottomheight) - FixedMul(mobjinfo[type].height, scale); #endif + flip[numflats] = true; numflats++; } } @@ -6494,14 +6487,37 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool 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]) && P_CheckSight(skyboxmo[0], mo)) + if (skyboxmo[0] && !P_MobjWasRemoved(skyboxmo[0])) { - P_RemoveMobj(mo); - continue; + 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; } P_SetScale(mo, scale); + if (flip[i]) + { + mo->flags2 |= MF2_OBJECTFLIP; + mo->eflags |= MFE_VERTICALFLIP; + } + switch(type) { case MT_OVERTIMEFOG: @@ -6525,7 +6541,6 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, mobjtype_t type, bool void P_RunBattleOvertime(void) { UINT16 i, j; - UINT16 orbs = 16; if (battleovertime.enabled < 10*TICRATE) { @@ -6563,14 +6578,21 @@ void P_RunBattleOvertime(void) } // 16 orbs at the normal minimum size of 512 - orbs = max(4, FixedDiv(battleovertime.radius, 32*mapobjectscale)>>FRACBITS); - for (i = 0; i < orbs; i++) { - angle_t ang = FixedAngle(((((i+1) * 360) / orbs) - ((leveltime/2) % 360))<subsector->sector->floorheight) + z = mobj->subsector->sector->floorheight;*/ + + if (mobj->extravalue1 < 512) + mobj->extravalue1++; + dist = mobj->extravalue1 * mapobjectscale; + P_TeleportMove(mobj, battleovertime.x + P_ReturnThrustX(NULL, ang, dist), - battleovertime.y + P_ReturnThrustY(NULL, ang, dist), battleovertime.z); + battleovertime.y + P_ReturnThrustY(NULL, ang, dist), z); + ghost = P_SpawnGhostMobj(mobj); ghost->fuse = 4; ghost->frame |= FF_FULLBRIGHT; From 12e41dfb002bb1209449d1130544e0f237b81915 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 11 Mar 2019 14:05:53 -0400 Subject: [PATCH 14/20] I *can't stand* waiting an entire minute minimum every time I need to test the tiniest thing -- time limit is now in seconds --- src/d_netcmd.c | 10 +++++----- src/p_inter.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 69f9fe5f7..18e105ea9 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4363,8 +4363,8 @@ static void TimeLimit_OnChange(void) if (cv_timelimit.value != 0) { - 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; + 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; //add hidetime for tag too! if (G_TagGametype()) @@ -4406,8 +4406,8 @@ void D_GameTypeChanged(INT32 lastgametype) if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits { // default settings for match: 2 mins, no pointlimit - CV_SetValue(&cv_pointlimit, 0); - CV_SetValue(&cv_timelimit, 2); + CV_SetValue(&cv_pointlimit, 0); + CV_SetValue(&cv_timelimit, 120); } if (!cv_itemrespawntime.changed) CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally @@ -4713,7 +4713,7 @@ static void Hidetime_OnChange(void) //uh oh, gotta change timelimitintics now too if (G_TagGametype()) - timelimitintics = (cv_timelimit.value * 60 * TICRATE) + (hidetime * TICRATE); + timelimitintics = (cv_timelimit.value * TICRATE) + (hidetime * TICRATE); } static void Command_Showmap_f(void) diff --git a/src/p_inter.c b/src/p_inter.c index dce2021ac..9c49ccd4e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1753,7 +1753,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } // 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 From 47df41aa86e13128733150a33396ee3652a99c67 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 12 Mar 2019 01:24:43 -0400 Subject: [PATCH 15/20] Dither barrier --- src/p_mobj.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 801f6cf2a..10ac6817c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6533,6 +6533,7 @@ static void P_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjty /*if (battleovertime.enabled < 10*TICRATE) mo->flags2 |= MF2_SHADOW;*/ mo->angle = R_PointToAngle2(mo->x, mo->y, battleovertime.x, battleovertime.y) + ANGLE_90; + mo->z += P_RandomRange(0,48) * mo->scale; break; default: break; @@ -6583,7 +6584,7 @@ void P_RunBattleOvertime(void) // 16 orbs at the normal minimum size of 512 { const fixed_t pi = (22< Date: Sun, 22 Sep 2019 22:44:15 -0400 Subject: [PATCH 16/20] compile --- src/k_kart.c | 10 ++++++---- src/p_mobj.c | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ea64da8ea..dcd3c1c83 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8964,8 +8964,10 @@ static void K_drawKartMinimap(void) // hu_stuff needs this, unlike st_stuff. if (gamestate != GS_LEVEL) return; - - if (stplyr != &players[displayplayer]) + + // Only draw for the first player + // Maybe move this somewhere else where this won't be a concern? + if (stplyr != &players[displayplayers[0]]) return; lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap))); @@ -9066,7 +9068,7 @@ static void K_drawKartMinimap(void) if (!players[i].mo || players[i].spectator) continue; - if (i != displayplayer || splitscreen) + if (i != displayplayers[0] || splitscreen) { if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) continue; @@ -9080,7 +9082,7 @@ static void K_drawKartMinimap(void) } } - if (i == displayplayer || i == secondarydisplayplayer || i == thirddisplayplayer || i == fourthdisplayplayer) + if (i == displayplayers[0] || i == displayplayers[1] || i == displayplayers[2] || i == displayplayers[3]) { // Draw display players on top of everything else localplayers[numlocalplayers] = i; diff --git a/src/p_mobj.c b/src/p_mobj.c index f98de3003..16f27142e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6464,9 +6464,9 @@ void P_RunBattleOvertime(void) { UINT8 transparency = tr_trans50; - if (!splitscreen && players[displayplayer].mo) + if (!splitscreen && players[displayplayers[0]].mo) { - INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayer].mo->x, battleovertime.y-players[displayplayer].mo->y); + 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)); } @@ -7131,7 +7131,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->x = mobj->target->x; mobj->y = mobj->target->y; - if (!splitscreen && players[displayplayer].mo) + if (!splitscreen && players[displayplayers[0]].mo) { scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x, players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); From 7cfcb2f61a243946ffbe8c7ca08c9b2f0ad0e51d Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 24 Sep 2019 02:00:27 -0400 Subject: [PATCH 17/20] Don't select items in the air or with the Ambush flag for overtime --- src/p_inter.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index 2029e6a48..022432af9 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1857,15 +1857,24 @@ void P_CheckTimeLimit(void) continue; if (thismo->threshold == 69) // Disappears 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; } - if (item == NULL) // no item found?! + if (item == NULL) // no item found, could happen if every item is in the air or has ambush flag, or the map has none + { + CONS_Alert(CONS_WARNING, "No usuable items for Battle overtime!\n"); return; + } item->threshold = 70; // Set constant respawn battleovertime.x = item->x; From 60b0df0330c9ecbcf7b9972a9ca036ad563e2e93 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 24 Sep 2019 02:01:27 -0400 Subject: [PATCH 18/20] Did not mean to commit this eons ago... :V --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 824c67bf4..42e0a917f 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1678,7 +1678,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #endif // Create a window - window = SDL_CreateWindow("FortniteKart "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + window = SDL_CreateWindow("SRB2Kart "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags); if (window == NULL) From 2635d1b8106506424cff6c1477838a01fbbcc7b8 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 27 Sep 2019 06:46:10 -0400 Subject: [PATCH 19/20] Fix SPB target not being merged --- src/k_kart.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 348c5a824..3b6e80aeb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9142,7 +9142,9 @@ static void K_drawKartMinimap(void) colormap = NULL; K_drawKartMinimapIcon(players[i].mo->x, players[i].mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); - if (K_IsPlayerWanted(&players[i])) + // Target reticule + if ((G_RaceGametype() && players[i].kartstuff[k_position] == spbplace) + || (G_BattleGametype() && K_IsPlayerWanted(&players[i]))) K_drawKartMinimapIcon(players[i].mo->x, players[i].mo->y, x, y, splitflags, kp_wantedreticle, NULL, AutomapPic); } } @@ -9171,8 +9173,11 @@ static void K_drawKartMinimap(void) else colormap = NULL; - K_drawKartMinimapIcon(players[localplayers[i]].mo->x, players[localplayers[i]].mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); - if (K_IsPlayerWanted(&players[localplayers[i]])) + K_drawKartMinimapIcon(players[localplayers[i]].mo->x, players[localplayers[i]].mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); + + // Target reticule + if ((G_RaceGametype() && players[localplayers[i]].kartstuff[k_position] == spbplace) + || (G_BattleGametype() && K_IsPlayerWanted(&players[localplayers[i]]))) K_drawKartMinimapIcon(players[localplayers[i]].mo->x, players[localplayers[i]].mo->y, x, y, splitflags, kp_wantedreticle, NULL, AutomapPic); } } From 9a9a1c13742cbd4ac9feb75ee2bad2d79e30194e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 27 Sep 2019 15:31:57 -0400 Subject: [PATCH 20/20] This shouldn't be merged --- src/p_inter.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 022432af9..e5b4cb029 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1776,7 +1776,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } // 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 @@ -1904,8 +1904,6 @@ void P_CheckTimeLimit(void) } } -#undef TESTOVERTIMEINFREEPLAY - /** Checks if a player's score is over the pointlimit and the round should end. * Verify that the value of ::cv_pointlimit is greater than zero before * calling this function.