From 7fdc9c80357c62b37c293f11d6e4805c97d7923d Mon Sep 17 00:00:00 2001 From: SeventhSentinel Date: Mon, 25 Jun 2018 09:18:30 -0400 Subject: [PATCH] Intro camera can noclip, fix several compile errors --- src/doomdef.h | 4 ++++ src/doomstat.h | 1 + src/g_game.c | 3 +++ src/k_kart.c | 13 +++++++------ src/m_menu.c | 7 ++++--- src/p_local.h | 1 + src/p_map.c | 11 +++++++---- src/p_mobj.c | 20 +++++++++++--------- src/p_user.c | 16 ++++++++-------- 9 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 175838c0..6c2325c9 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -540,4 +540,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// \note Required for proper collision with moving sloped surfaces that have sector specials on them. #define SECTORSPECIALSAFTERTHINK +/// SRB2Kart: Camera always has noclip. +/// \note Kind of problematic. If we decide to keep this on, we'll need serious map changes. +//#define NOCLIPCAM + #endif // __DOOMDEF__ diff --git a/src/doomstat.h b/src/doomstat.h index 33ce04c9..aac49c60 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -409,6 +409,7 @@ extern UINT16 spacetimetics; extern UINT16 extralifetics; // SRB2kart +extern tic_t introtime; extern tic_t starttime; extern INT32 hyudorotime; extern INT32 stealtime; diff --git a/src/g_game.c b/src/g_game.c index c73db542..4b692ed9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -207,6 +207,7 @@ UINT16 spacetimetics = 11*TICRATE + (TICRATE/2); UINT16 extralifetics = 4*TICRATE; // SRB2kart +tic_t introtime = 108; tic_t starttime = 6*TICRATE + (3*TICRATE/4); INT32 hyudorotime = 7*TICRATE; INT32 stealtime = TICRATE/2; @@ -2974,6 +2975,8 @@ boolean G_IsSpecialStage(INT32 mapnum) #if 0 if (gametype == GT_COOP && modeattacking != ATTACKING_RECORD && mapnum >= sstage_start && mapnum <= sstage_end) return true; +#else + (void)mapnum; #endif return false; } diff --git a/src/k_kart.c b/src/k_kart.c index 74cf713a..17153459 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -538,7 +538,7 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem) \return void */ -static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean mashed) +static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, boolean mashed) { const INT32 distvar = (64*14); INT32 newodds; @@ -771,7 +771,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) for (j = 0; j < NUMKARTRESULTS; j++) { - if (K_KartGetItemOdds(i, j, player, mashed) > 0) + if (K_KartGetItemOdds(i, j, mashed) > 0) { available = 1; break; @@ -810,8 +810,8 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) UINT8 wantedpos = (player->kartstuff[k_balloon]-avgballoon)+2; // 0 is two balloons below average, 2 is average, 4 is two balloons above average if (wantedpos > 4) wantedpos = 4; - if (wantedpos < 0) - wantedpos = 0; + /*if (wantedpos < 0) + wantedpos = 0;*/ useodds = disttable[(wantedpos * distlen) / 5]; } } @@ -853,7 +853,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) //CONS_Printf("Got useodds %d. (position: %d, distance: %d)\n", useodds, player->kartstuff[k_position], pdis); #define SETITEMRESULT(pos, itemnum) \ - for (chance = 0; chance < K_KartGetItemOdds(pos, itemnum, player, mashed); chance++) \ + for (chance = 0; chance < K_KartGetItemOdds(pos, itemnum, mashed); chance++) \ spawnchance[numchoices++] = itemnum SETITEMRESULT(useodds, KITEM_SNEAKER); // Sneaker @@ -2438,7 +2438,9 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed) void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source) { if (banana->hnext) + { K_KillBananaChain(banana->hnext, inflictor, source); + } if (banana->health) { @@ -3715,7 +3717,6 @@ void K_LoadKartHUDGraphics(void) { for (j = 0; j < NUMPOSFRAMES; j++) { - //if (i > 4 && j < 4 && j != 0) continue; // We don't need blue numbers for ranks past 4th sprintf(buffer, "K_POSN%d%d", i, j); kp_positionnum[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } diff --git a/src/m_menu.c b/src/m_menu.c index cd8da4e6..bd4d0260 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4332,14 +4332,15 @@ static char *M_GetConditionString(condition_t cond) case UC_EXTRAEMBLEM: return va("Get \"%s\" emblem", extraemblems[cond.requirement-1].name); default: - return ""; + return NULL; } } #define NUMCHECKLIST 23 static void M_DrawChecklist(void) { - INT32 i, line = 0, c, lastid; + UINT32 i, line = 0, c; + INT32 lastid; for (i = 0; i < MAXUNLOCKABLES; i++) { @@ -4366,7 +4367,7 @@ static void M_DrawChecklist(void) ++line; - if (cond.id != lastid) + if (lastid == -1 || cond.id != (UINT32)lastid) { V_DrawString(16, (line*8), V_MONOSPACE|V_ALLOWLOWERCASE|(achieved ? V_YELLOWMAP : 0), "*"); V_DrawString(32, (line*8), V_MONOSPACE|V_ALLOWLOWERCASE|(achieved ? V_YELLOWMAP : 0), str); diff --git a/src/p_local.h b/src/p_local.h index 8a4bfa7b..0d8ad716 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -338,6 +338,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff); boolean P_Move(mobj_t *actor, fixed_t speed); boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z); void P_SlideMove(mobj_t *mo, boolean forceslide); +void P_BouncePlayerMove(mobj_t *mo); void P_BounceMove(mobj_t *mo); boolean P_CheckSight(mobj_t *t1, mobj_t *t2); void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius); diff --git a/src/p_map.c b/src/p_map.c index b91d628a..6b3af53c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2516,10 +2516,13 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) fixed_t tryx = thiscam->x; fixed_t tryy = thiscam->y; +#ifndef NOCLIPCAM if ((thiscam == &camera && (players[displayplayer].pflags & PF_NOCLIP)) || (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP)) || (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP)) - || (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP))) + || (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP)) + || (leveltime < introtime)) +#endif { // Noclipping player camera noclips too!! floatok = true; thiscam->floorz = thiscam->z; @@ -3823,12 +3826,12 @@ stairstep: } // -// P_PlayerBounceMove +// P_BouncePlayerMove // // Bounce move, for players. // -void P_PlayerBounceMove(mobj_t *mo) +void P_BouncePlayerMove(mobj_t *mo) { fixed_t leadx, leady; fixed_t trailx, traily; @@ -3944,7 +3947,7 @@ void P_BounceMove(mobj_t *mo) if (mo->player) { - P_PlayerBounceMove(mo); + P_BouncePlayerMove(mo); return; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 6a9efc02..9c2531b9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3678,7 +3678,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled dummy.y = thiscam->y; dummy.z = thiscam->z; dummy.height = thiscam->height; - if (!resetcalled && !(player->pflags & PF_NOCLIP) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead. + if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead. P_ResetCamera(player, thiscam); else P_SlideCameraMove(thiscam); @@ -3699,7 +3699,8 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled // adjust height thiscam->z += thiscam->momz + player->mo->pmomz; - if (!itsatwodlevel && !(player->pflags & PF_NOCLIP)) +#ifndef NOCLIPCAM + if (!itsatwodlevel && !(player->pflags & PF_NOCLIP || leveltime < introtime)) { // clip movement if (thiscam->z <= thiscam->floorz) // hit the floor @@ -3739,6 +3740,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled } } } +#endif } if (itsatwodlevel @@ -9337,13 +9339,7 @@ void P_RemoveMobj(mobj_t *mobj) iquetail = (iquetail+1)&(ITEMQUESIZE-1); } - if (mobj->type == MT_OVERLAY) - P_RemoveOverlay(mobj); - - if (mobj->type == MT_SHADOW) - P_RemoveShadow(mobj); - - if (mobj->type == MT_KARMAHITBOX) + if (mobj->type == MT_KARMAHITBOX) // Remove linked list objects for certain types { mobj_t *cur = mobj->hnext; @@ -9355,6 +9351,12 @@ void P_RemoveMobj(mobj_t *mobj) } } + if (mobj->type == MT_OVERLAY) + P_RemoveOverlay(mobj); + + if (mobj->type == MT_SHADOW) + P_RemoveShadow(mobj); + mobj->health = 0; // Just because // unlink from sector and block lists diff --git a/src/p_user.c b/src/p_user.c index 6540255b..103b85a9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8136,12 +8136,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall subsector_t *newsubsec; fixed_t f1, f2; -#if 1 +#ifdef NOCLIPCAM cameranoclip = true; // We like camera noclip! #else cameranoclip = ((player->pflags & (PF_NOCLIP|PF_NIGHTSMODE)) - || (player->mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) - || (leveltime < 3*TICRATE)); // Noclipping player camera noclips too!! + || (player->mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!! + || (leveltime < introtime)); // Kart intro cam #endif if (!(player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)) @@ -8276,12 +8276,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall lookback = camspin4; } - if (leveltime < 3*TICRATE) // Whoooshy camera! + if (leveltime < introtime) // Whoooshy camera! { - const INT32 introcam = (3*TICRATE - leveltime) * 3; - camrotate += 3*introcam/2; - camdist += (introcam * mapheaderinfo[gamemap-1]->mobj_scale); - camheight += (introcam * mapheaderinfo[gamemap-1]->mobj_scale); + const INT32 introcam = (introtime - leveltime); + camrotate += introcam*5; + camdist += (introcam * mapheaderinfo[gamemap-1]->mobj_scale)*3; + camheight += (introcam * mapheaderinfo[gamemap-1]->mobj_scale)*2; } else if (player->exiting) // SRB2Kart: Leave the camera behind while exiting, for dramatic effect! camstill = true;