Makes it through all kart files

All that's left is SDL, OGL, maybe also Lua
This commit is contained in:
Sally Coolatta 2020-08-15 04:42:56 -04:00
parent fd5fe916bc
commit 9efdc98de6
19 changed files with 141 additions and 275 deletions

View file

@ -466,22 +466,25 @@ enum GameTypeRules
// Battle gametype rules // Battle gametype rules
GTR_BUMPERS = 1<<3, // Enables the bumper health system GTR_BUMPERS = 1<<3, // Enables the bumper health system
GTR_KARMA = 1<<4, // Enables the Karma system if you're out of bumpers GTR_WANTED = 1<<4, // Enables the wanted anti-camping system
GTR_ITEMARROWS = 1<<5, // Show item box arrows above players GTR_KARMA = 1<<5, // Enables the Karma system if you're out of bumpers
GTR_BATTLESTARTS = 1<<6, // Use Battle Mode start positions. GTR_ITEMARROWS = 1<<6, // Show item box arrows above players
GTR_POINTLIMIT = 1<<7, // Reaching point limit ends the round GTR_CAPSULES = 1<<7, // Enables the wanted anti-camping system
GTR_TIMELIMIT = 1<<8, // Reaching time limit ends the round GTR_BATTLESTARTS = 1<<8, // Use Battle Mode start positions.
GTR_OVERTIME = 1<<9, // Allow overtime behavior
GTR_POINTLIMIT = 1<<9, // Reaching point limit ends the round
GTR_TIMELIMIT = 1<<10, // Reaching time limit ends the round
GTR_OVERTIME = 1<<11, // Allow overtime behavior
// Custom gametype rules // Custom gametype rules
GTR_TEAMS = 1<<10, // Teams are forced on GTR_TEAMS = 1<<12, // Teams are forced on
GTR_NOTEAMS = 1<<11, // Teams are forced off GTR_NOTEAMS = 1<<13, // Teams are forced off
GTR_TEAMSTARTS = 1<<12, // Use team-based start positions GTR_TEAMSTARTS = 1<<14, // Use team-based start positions
// Grand Prix rules // Grand Prix rules
GTR_CAMPAIGN = 1<<13, // Handles cup-based progression GTR_CAMPAIGN = 1<<15, // Handles cup-based progression
GTR_LIVES = 1<<14, // Lives system, players are forced to spectate during Game Over. GTR_LIVES = 1<<16, // Lives system, players are forced to spectate during Game Over.
GTR_SPECIALBOTS = 1<<15, // Bot difficulty gets stronger between rounds, and the rival system is enabled. GTR_SPECIALBOTS = 1<<17, // Bot difficulty gets stronger between rounds, and the rival system is enabled.
// free: to and including 1<<31 // free: to and including 1<<31
}; };

View file

@ -300,20 +300,12 @@ static void K_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjty
if (sec->floorpic != skyflatnum) if (sec->floorpic != skyflatnum)
{ {
#ifdef ESLOPE flatz[numflats] = P_GetZAt(sec->f_slope, x, y, sec->floorheight);
flatz[numflats] = (sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : sec->floorheight);
#else
flatz[numflats] = (sec->floorheight);
#endif
numflats++; numflats++;
} }
if (sec->ceilingpic != skyflatnum && ceiling) if (sec->ceilingpic != skyflatnum && ceiling)
{ {
#ifdef ESLOPE flatz[numflats] = P_GetZAt(sec->c_slope, x, y, sec->ceilingheight) - FixedMul(mobjinfo[type].height, scale);
flatz[numflats] = (sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : sec->ceilingheight) - FixedMul(mobjinfo[type].height, scale);
#else
flatz[numflats] = (sec->ceilingheight) - FixedMul(mobjinfo[type].height, scale);
#endif
flip[numflats] = true; flip[numflats] = true;
numflats++; numflats++;
} }
@ -327,20 +319,12 @@ static void K_SpawnOvertimeParticles(fixed_t x, fixed_t y, fixed_t scale, mobjty
continue; continue;
if (*rover->toppic != skyflatnum) if (*rover->toppic != skyflatnum)
{ {
#ifdef ESLOPE flatz[numflats] = P_GetZAt(*rover->t_slope, x, y, *rover->topheight);
flatz[numflats] = (*rover->t_slope ? P_GetZAt(*rover->t_slope, x, y) : *rover->topheight);
#else
flatz[numflats] = (*rover->topheight);
#endif
numflats++; numflats++;
} }
if (*rover->bottompic != skyflatnum && ceiling) if (*rover->bottompic != skyflatnum && ceiling)
{ {
#ifdef ESLOPE flatz[numflats] = P_GetZAt(*rover->b_slope, x, y, *rover->bottomheight);
flatz[numflats] = (*rover->b_slope ? P_GetZAt(*rover->b_slope, x, y) : *rover->bottomheight) - FixedMul(mobjinfo[type].height, scale);
#else
flatz[numflats] = (*rover->bottomheight) - FixedMul(mobjinfo[type].height, scale);
#endif
flip[numflats] = true; flip[numflats] = true;
numflats++; numflats++;
} }
@ -598,11 +582,7 @@ void K_SpawnBattleCapsules(void)
mt->mobj = NULL; mt->mobj = NULL;
mtsector = R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector; mtsector = R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector;
mt->z = (INT16)( mt->z = (INT16)(P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS, mtsector->floorheight) / FRACUNIT);
#ifdef ESLOPE
mtsector->f_slope ? P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) :
#endif
mtsector->floorheight)>>FRACBITS;
x = mt->x << FRACBITS; x = mt->x << FRACBITS;
y = mt->y << FRACBITS; y = mt->y << FRACBITS;
@ -611,11 +591,7 @@ void K_SpawnBattleCapsules(void)
if (mt->options & MTF_OBJECTFLIP) if (mt->options & MTF_OBJECTFLIP)
{ {
z = ( z = P_GetZAt(sec->c_slope, x, y, sec->ceilingheight) - mobjinfo[MT_BATTLECAPSULE].height;
#ifdef ESLOPE
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
#endif
sec->ceilingheight) - mobjinfo[MT_BATTLECAPSULE].height;
floorheights[0] = z; floorheights[0] = z;
@ -624,11 +600,7 @@ void K_SpawnBattleCapsules(void)
} }
else else
{ {
z = z = P_GetZAt(sec->f_slope, x, y, sec->floorheight);
#ifdef ESLOPE
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
#endif
sec->floorheight;
floorheights[0] = z; floorheights[0] = z;
@ -646,19 +618,11 @@ void K_SpawnBattleCapsules(void)
{ {
if (mt->options & MTF_OBJECTFLIP) if (mt->options & MTF_OBJECTFLIP)
{ {
floorheights[numfloors] = ( floorheights[numfloors] = P_GetZAt(*rover->b_slope, x, y, *rover->bottomheight) - mobjinfo[MT_BATTLECAPSULE].height;
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, x, y) :
#endif
*rover->bottomheight) - mobjinfo[MT_BATTLECAPSULE].height;
} }
else else
{ {
floorheights[numfloors] = ( floorheights[numfloors] = P_GetZAt(*rover->t_slope, x, y, *rover->topheight);
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, x, y) :
#endif
*rover->topheight);
} }
numfloors++; numfloors++;

View file

@ -183,12 +183,12 @@ static boolean K_BotHatesThisSector(player_t *player, sector_t *sec, fixed_t x,
if (flip == true) if (flip == true)
{ {
specialflag = SF_FLIPSPECIAL_CEILING; specialflag = SF_FLIPSPECIAL_CEILING;
highestfloor = (sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : sec->ceilingheight); highestfloor = P_GetZAt(sec->c_slope, x, y, sec->ceilingheight);
} }
else else
{ {
specialflag = SF_FLIPSPECIAL_FLOOR; specialflag = SF_FLIPSPECIAL_FLOOR;
highestfloor = (sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : sec->floorheight); highestfloor = P_GetZAt(sec->f_slope, x, y, sec->floorheight);
} }
if (sec->flags & specialflag) if (sec->flags & specialflag)
@ -206,8 +206,8 @@ static boolean K_BotHatesThisSector(player_t *player, sector_t *sec, fixed_t x,
continue; continue;
} }
top = (*rover->t_slope ? P_GetZAt(*rover->t_slope, x, y) : *rover->topheight); top = P_GetZAt(*rover->t_slope, x, y, *rover->topheight);
bottom = (*rover->b_slope ? P_GetZAt(*rover->b_slope, x, y) : *rover->bottomheight); bottom = P_GetZAt(*rover->b_slope, x, y, *rover->bottomheight);
if (!(rover->flags & FF_BLOCKPLAYER)) if (!(rover->flags & FF_BLOCKPLAYER))
{ {

View file

@ -533,7 +533,7 @@ void K_FakeBotResults(player_t *bot)
if (besttime == UINT32_MAX // No one finished, so you don't finish either. if (besttime == UINT32_MAX // No one finished, so you don't finish either.
|| bot->distancetofinish >= worstdist) // Last place, you aren't going to finish. || bot->distancetofinish >= worstdist) // Last place, you aren't going to finish.
{ {
bot->pflags |= PF_TIMEOVER; bot->pflags |= PF_GAMETYPEOVER;
return; return;
} }

View file

@ -870,11 +870,6 @@ static void K_initKartHUD(void)
} }
} }
} }
if (timeinmap > 105)
hudtrans = cv_translucenthud.value;
else
hudtrans = 0;
} }
static void K_drawKartItem(void) static void K_drawKartItem(void)
@ -1167,7 +1162,7 @@ static void K_drawKartItem(void)
V_DrawFixedPatch(fx<<FRACBITS, fy<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SLIDEIN|fflags, localpatch, colmap); V_DrawFixedPatch(fx<<FRACBITS, fy<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SLIDEIN|fflags, localpatch, colmap);
// Extensible meter, currently only used for rocket sneaker... // Extensible meter, currently only used for rocket sneaker...
if (itembar && hudtrans) if (itembar)
{ {
const INT32 fill = ((itembar*barlength)/maxl); const INT32 fill = ((itembar*barlength)/maxl);
const INT32 length = min(barlength, fill); const INT32 length = min(barlength, fill);
@ -1334,7 +1329,7 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
if (emblem->collected) if (emblem->collected)
{ {
emblempic[curemb] = W_CachePatchName(M_GetEmblemPatch(emblem), PU_CACHE); emblempic[curemb] = W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_CACHE);
emblemcol[curemb] = R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE); emblemcol[curemb] = R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE);
if (++curemb == 3) if (++curemb == 3)
break; break;
@ -1538,10 +1533,8 @@ static boolean K_drawKartPositionFaces(void)
if (numplayersingame <= 1) if (numplayersingame <= 1)
return true; return true;
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_minirankings)) if (!LUA_HudEnabled(hud_minirankings))
return false; // Don't proceed but still return true for free play above if HUD is disabled. return false; // Don't proceed but still return true for free play above if HUD is disabled.
#endif
for (j = 0; j < numplayersingame; j++) for (j = 0; j < numplayersingame; j++)
{ {
@ -1612,10 +1605,8 @@ static boolean K_drawKartPositionFaces(void)
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT, facerankprefix[players[rankplayer[i]].skin], colormap); V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT, facerankprefix[players[rankplayer[i]].skin], colormap);
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_battlebumpers)) if (LUA_HudEnabled(hud_battlebumpers))
{ {
#endif
if (gametype == GT_BATTLE && players[rankplayer[i]].kartstuff[k_bumper] > 0) if (gametype == GT_BATTLE && players[rankplayer[i]].kartstuff[k_bumper] > 0)
{ {
V_DrawMappedPatch(bumperx-2, Y, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT, kp_tinybumper[0], colormap); V_DrawMappedPatch(bumperx-2, Y, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT, kp_tinybumper[0], colormap);
@ -1625,9 +1616,7 @@ static boolean K_drawKartPositionFaces(void)
V_DrawMappedPatch(bumperx, Y, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT, kp_tinybumper[1], colormap); V_DrawMappedPatch(bumperx, Y, V_HUDTRANS|V_SLIDEIN|V_SNAPTOLEFT, kp_tinybumper[1], colormap);
} }
} }
#ifdef HAVE_BLUA
} // A new level of stupidity: checking if lua is enabled to close a bracket. :Fascinating: } // A new level of stupidity: checking if lua is enabled to close a bracket. :Fascinating:
#endif
} }
if (i == strank) if (i == strank)
@ -1764,7 +1753,7 @@ void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, IN
{ {
if (players[tab[i].num].exiting) if (players[tab[i].num].exiting)
V_DrawRightAlignedThinString(x+rightoffset, y-1, hilicol|V_6WIDTHSPACE, timestring(players[tab[i].num].realtime)); V_DrawRightAlignedThinString(x+rightoffset, y-1, hilicol|V_6WIDTHSPACE, timestring(players[tab[i].num].realtime));
else if (players[tab[i].num].pflags & PF_TIMEOVER) else if (players[tab[i].num].pflags & PF_GAMETYPEOVER)
V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, "NO CONTEST."); V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, "NO CONTEST.");
else if (circuitmap) else if (circuitmap)
V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, va("Lap %d", tab[i].count)); V_DrawRightAlignedThinString(x+rightoffset, y-1, V_6WIDTHSPACE, va("Lap %d", tab[i].count));
@ -1773,7 +1762,7 @@ void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, IN
{ {
if (players[tab[i].num].exiting) if (players[tab[i].num].exiting)
V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(players[tab[i].num].realtime)); V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(players[tab[i].num].realtime));
else if (players[tab[i].num].pflags & PF_TIMEOVER) else if (players[tab[i].num].pflags & PF_GAMETYPEOVER)
V_DrawRightAlignedThinString(x+rightoffset, y-1, 0, "NO CONTEST."); V_DrawRightAlignedThinString(x+rightoffset, y-1, 0, "NO CONTEST.");
else if (circuitmap) else if (circuitmap)
V_DrawRightAlignedString(x+rightoffset, y, 0, va("Lap %d", tab[i].count)); V_DrawRightAlignedString(x+rightoffset, y, 0, va("Lap %d", tab[i].count));
@ -2207,7 +2196,7 @@ static void K_drawKartWanted(void)
} }
} }
static void K_ObjectTracking(fixed_t *hud_x, fixed_t *hud_y, vertex_t *campos, angle_t camang, angle_t camaim, vertex_t *point) static void K_ObjectTracking(fixed_t *hud_x, fixed_t *hud_y, vector3_t *campos, angle_t camang, angle_t camaim, vector3_t *point)
{ {
const INT32 swhalf = (BASEVIDWIDTH / 2); const INT32 swhalf = (BASEVIDWIDTH / 2);
const fixed_t swhalffixed = swhalf * FRACUNIT; const fixed_t swhalffixed = swhalf * FRACUNIT;
@ -2309,7 +2298,7 @@ static void K_drawKartPlayerCheck(void)
{ {
const fixed_t maxdistance = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)); const fixed_t maxdistance = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
camera_t *thiscam; camera_t *thiscam;
vertex_t c; vector3_t c;
UINT8 cnum = 0; UINT8 cnum = 0;
UINT8 i; UINT8 i;
INT32 splitflags = V_SNAPTOBOTTOM|V_SPLITSCREEN; INT32 splitflags = V_SNAPTOBOTTOM|V_SPLITSCREEN;
@ -2354,7 +2343,7 @@ static void K_drawKartPlayerCheck(void)
UINT8 *colormap = NULL; UINT8 *colormap = NULL;
UINT8 pnum = 0; UINT8 pnum = 0;
fixed_t x = 0; fixed_t x = 0;
vertex_t v; vector3_t v;
if (!playeringame[i] || checkplayer->spectator) if (!playeringame[i] || checkplayer->spectator)
{ {
@ -2446,8 +2435,9 @@ static void K_DrawRivalTagForPlayer(fixed_t x, fixed_t y)
static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p, UINT8 cnum) static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p, UINT8 cnum)
{ {
INT32 namelen = V_ThinStringWidth(player_names[p - players], V_6WIDTHSPACE|V_ALLOWLOWERCASE); const INT32 clr = skincolors[p->skincolor].chatcolor;
INT32 clr = K_SkincolorToTextColor(p->skincolor); const INT32 namelen = V_ThinStringWidth(player_names[p - players], V_6WIDTHSPACE|V_ALLOWLOWERCASE);
UINT8 *colormap = V_GetStringColormap(clr); UINT8 *colormap = V_GetStringColormap(clr);
INT32 barx = 0, bary = 0, barw = 0; INT32 barx = 0, bary = 0, barw = 0;
@ -2499,7 +2489,7 @@ static void K_drawKartNameTags(void)
{ {
const fixed_t maxdistance = 8192*mapobjectscale; const fixed_t maxdistance = 8192*mapobjectscale;
camera_t *thiscam; camera_t *thiscam;
vertex_t c; vector3_t c;
UINT8 cnum = 0; UINT8 cnum = 0;
UINT8 tobesorted[MAXPLAYERS]; UINT8 tobesorted[MAXPLAYERS];
fixed_t sortdist[MAXPLAYERS]; fixed_t sortdist[MAXPLAYERS];
@ -2538,7 +2528,7 @@ static void K_drawKartNameTags(void)
{ {
player_t *ntplayer = &players[i]; player_t *ntplayer = &players[i];
fixed_t distance = maxdistance+1; fixed_t distance = maxdistance+1;
vertex_t v; vector3_t v;
if (!playeringame[i] || ntplayer->spectator) if (!playeringame[i] || ntplayer->spectator)
{ {
@ -2613,7 +2603,7 @@ static void K_drawKartNameTags(void)
fixed_t y = -BASEVIDWIDTH * FRACUNIT; fixed_t y = -BASEVIDWIDTH * FRACUNIT;
SINT8 localindicator = -1; SINT8 localindicator = -1;
vertex_t v; vector3_t v;
v.x = ntplayer->mo->x; v.x = ntplayer->mo->x;
v.y = ntplayer->mo->y; v.y = ntplayer->mo->y;
@ -3249,10 +3239,9 @@ static void K_drawBattleFullscreen(void)
INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead
fixed_t scale = FRACUNIT; fixed_t scale = FRACUNIT;
boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run. boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run.
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_battlecomebacktimer)) if (!LUA_HudEnabled(hud_battlecomebacktimer))
drawcomebacktimer = false; drawcomebacktimer = false;
#endif
if (r_splitscreen) if (r_splitscreen)
{ {
@ -3361,9 +3350,7 @@ static void K_drawBattleFullscreen(void)
return; return;
} }
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_freeplay)) if (LUA_HudEnabled(hud_freeplay))
#endif
K_drawKartFreePlay(leveltime); K_drawKartFreePlay(leveltime);
} }
} }
@ -3513,8 +3500,8 @@ static void K_drawInput(void)
static INT32 pn = 0; static INT32 pn = 0;
INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT); INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT);
INT32 x = BASEVIDWIDTH - 32, y = BASEVIDHEIGHT-24, offs, col; INT32 x = BASEVIDWIDTH - 32, y = BASEVIDHEIGHT-24, offs, col;
const INT32 accent1 = splitflags|colortranslations[stplyr->skincolor][5]; const INT32 accent1 = splitflags | skincolors[stplyr->skincolor].ramp[5];
const INT32 accent2 = splitflags|colortranslations[stplyr->skincolor][9]; const INT32 accent2 = splitflags | skincolors[stplyr->skincolor].ramp[9];
ticcmd_t *cmd = &stplyr->cmd; ticcmd_t *cmd = &stplyr->cmd;
if (timeinmap <= 105) if (timeinmap <= 105)
@ -3899,66 +3886,50 @@ void K_drawKartHUD(void)
if (!demo.title && (!battlefullscreen || r_splitscreen)) if (!demo.title && (!battlefullscreen || r_splitscreen))
{ {
// Draw the CHECK indicator before the other items, so it's overlapped by everything else // Draw the CHECK indicator before the other items, so it's overlapped by everything else
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_check)) // delete lua when? if (LUA_HudEnabled(hud_check)) // delete lua when?
#endif
if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting && !freecam) if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting && !freecam)
K_drawKartPlayerCheck(); K_drawKartPlayerCheck();
// nametags // nametags
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_names)) if (LUA_HudEnabled(hud_names))
#endif
K_drawKartNameTags(); K_drawKartNameTags();
// Draw WANTED status // Draw WANTED status
if (gametype == GT_BATTLE) if (gametype == GT_BATTLE)
{ {
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_wanted)) if (LUA_HudEnabled(hud_wanted))
#endif
K_drawKartWanted(); K_drawKartWanted();
} }
if (cv_kartminimap.value) if (cv_kartminimap.value)
{ {
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minimap)) if (LUA_HudEnabled(hud_minimap))
#endif
K_drawKartMinimap(); K_drawKartMinimap();
} }
} }
if (battlefullscreen && !freecam) if (battlefullscreen && !freecam)
{ {
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_battlefullscreen)) if (LUA_HudEnabled(hud_battlefullscreen))
#endif
K_drawBattleFullscreen(); K_drawBattleFullscreen();
return; return;
} }
// Draw the item window // Draw the item window
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_item) && !freecam) if (LUA_HudEnabled(hud_item) && !freecam)
#endif
K_drawKartItem(); K_drawKartItem();
// If not splitscreen, draw... // If not splitscreen, draw...
if (!r_splitscreen && !demo.title) if (!r_splitscreen && !demo.title)
{ {
// Draw the timestamp // Draw the timestamp
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_time)) if (LUA_HudEnabled(hud_time))
#endif
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, 0); K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, 0);
if (!modeattacking) if (!modeattacking)
{ {
// The top-four faces on the left // The top-four faces on the left
/*#ifdef HAVE_BLUA //if (LUA_HudEnabled(hud_minirankings))
if (LUA_HudEnabled(hud_minirankings))
#endif*/
isfreeplay = K_drawKartPositionFaces(); isfreeplay = K_drawKartPositionFaces();
} }
} }
@ -3968,9 +3939,7 @@ void K_drawKartHUD(void)
// Draw the speedometer // Draw the speedometer
if (cv_kartspeedometer.value && !r_splitscreen) if (cv_kartspeedometer.value && !r_splitscreen)
{ {
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_speedometer)) if (LUA_HudEnabled(hud_speedometer))
#endif
K_drawKartSpeedometer(); K_drawKartSpeedometer();
} }
@ -3999,9 +3968,7 @@ void K_drawKartHUD(void)
else if (gametype == GT_RACE) // Race-only elements else if (gametype == GT_RACE) // Race-only elements
{ {
// Draw the lap counter // Draw the lap counter
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_gametypeinfo)) if (LUA_HudEnabled(hud_gametypeinfo))
#endif
K_drawKartLapsAndRings(); K_drawKartLapsAndRings();
if (isfreeplay) if (isfreeplay)
@ -4009,26 +3976,20 @@ void K_drawKartHUD(void)
else if (!modeattacking) else if (!modeattacking)
{ {
// Draw the numerical position // Draw the numerical position
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_position)) if (LUA_HudEnabled(hud_position))
#endif
K_DrawKartPositionNum(stplyr->kartstuff[k_position]); K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
} }
else //if (!(demo.playback && hu_showscores)) else //if (!(demo.playback && hu_showscores))
{ {
// Draw the input UI // Draw the input UI
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_position)) if (LUA_HudEnabled(hud_position))
#endif
K_drawInput(); K_drawInput();
} }
} }
else if (gametype == GT_BATTLE) // Battle-only else if (gametype == GT_BATTLE) // Battle-only
{ {
// Draw the hits left! // Draw the hits left!
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_gametypeinfo)) if (LUA_HudEnabled(hud_gametypeinfo))
#endif
K_drawKartBumpersOrKarma(); K_drawKartBumpersOrKarma();
} }
} }
@ -4070,9 +4031,7 @@ void K_drawKartHUD(void)
// Draw FREE PLAY. // Draw FREE PLAY.
if (isfreeplay && !stplyr->spectator && timeinmap > 113) if (isfreeplay && !stplyr->spectator && timeinmap > 113)
{ {
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_freeplay)) if (LUA_HudEnabled(hud_freeplay))
#endif
K_drawKartFreePlay(leveltime); K_drawKartFreePlay(leveltime);
} }
@ -4102,7 +4061,7 @@ void K_drawKartHUD(void)
if (cv_kartdebugcolorize.value && stplyr->mo && stplyr->mo->skin) if (cv_kartdebugcolorize.value && stplyr->mo && stplyr->mo->skin)
{ {
INT32 x = 0, y = 0; INT32 x = 0, y = 0;
UINT8 c; UINT16 c;
for (c = 1; c < MAXSKINCOLORS; c++) for (c = 1; c < MAXSKINCOLORS; c++)
{ {

View file

@ -11,6 +11,7 @@
#include "doomtype.h" #include "doomtype.h"
#include "doomstat.h" #include "doomstat.h"
#include "hu_stuff.h"
#ifndef __K_HUD__ #ifndef __K_HUD__
#define __K_HUD__ #define __K_HUD__

View file

@ -1785,8 +1785,8 @@ void K_KartMoveAnimation(player_t *player)
if (!spinningwheels) if (!spinningwheels)
{ {
// TODO: These should prooobably be different SPR2s // TODO: These should prooobably be different SPR2s
// Just a quick hack to prevent needing to do this :V // Just a quick hack to prevent needing to do that :V
player->mo->frame = (player->mo->frames & ~FF_FRAMEMASK); player->mo->frame = (player->mo->frame & ~FF_FRAMEMASK);
} }
} }
else else
@ -3332,8 +3332,7 @@ static void K_SpawnAIZDust(player_t *player)
void K_SpawnBoostTrail(player_t *player) void K_SpawnBoostTrail(player_t *player)
{ {
fixed_t newx; fixed_t newx, newy, newz;
fixed_t newy;
fixed_t ground; fixed_t ground;
mobj_t *flame; mobj_t *flame;
angle_t travelangle; angle_t travelangle;
@ -3349,7 +3348,7 @@ void K_SpawnBoostTrail(player_t *player)
return; return;
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
ground = player->mo->ceilingz - FixedMul(mobjinfo[MT_SNEAKERTRAIL].height, player->mo->scale); ground = player->mo->ceilingz;
else else
ground = player->mo->floorz; ground = player->mo->floorz;
@ -3362,14 +3361,13 @@ void K_SpawnBoostTrail(player_t *player)
{ {
newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
#ifdef ESLOPE newz = P_GetZAt(player->mo->standingslope, newx, newy, ground);
if (player->mo->standingslope)
if (player->mo->eflags & MFE_VERTICALFLIP)
{ {
ground = P_GetZAt(player->mo->standingslope, newx, newy); newz -= FixedMul(mobjinfo[MT_SNEAKERTRAIL].height, player->mo->scale);
if (player->mo->eflags & MFE_VERTICALFLIP)
ground -= FixedMul(mobjinfo[MT_SNEAKERTRAIL].height, player->mo->scale);
} }
#endif
flame = P_SpawnMobj(newx, newy, ground, MT_SNEAKERTRAIL); flame = P_SpawnMobj(newx, newy, ground, MT_SNEAKERTRAIL);
P_SetTarget(&flame->target, player->mo); P_SetTarget(&flame->target, player->mo);
@ -4238,9 +4236,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
if (mo->eflags & MFE_SPRUNG) if (mo->eflags & MFE_SPRUNG)
return; return;
#ifdef ESLOPE
mo->standingslope = NULL; mo->standingslope = NULL;
#endif
mo->eflags |= MFE_SPRUNG; mo->eflags |= MFE_SPRUNG;
@ -4633,7 +4629,7 @@ void K_RepairOrbitChain(mobj_t *orbit)
} }
// Simplified version of a code bit in P_MobjFloorZ // Simplified version of a code bit in P_MobjFloorZ
static fixed_t K_BananaSlopeZ(pslope_t *slope, fixed_t x, fixed_t y, fixed_t radius, boolean ceiling) static fixed_t K_BananaSlopeZ(pslope_t *slope, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, boolean ceiling)
{ {
fixed_t testx, testy; fixed_t testx, testy;
@ -4656,42 +4652,26 @@ static fixed_t K_BananaSlopeZ(pslope_t *slope, fixed_t x, fixed_t y, fixed_t rad
testx += x; testx += x;
testy += y; testy += y;
return P_GetZAt(slope, testx, testy); return P_GetZAt(slope, testx, testy, z);
} }
static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t height, boolean flip, boolean player) static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t height, boolean flip, boolean player)
{ {
fixed_t newz; fixed_t newz;
sector_t *sec; sector_t *sec;
#ifdef ESLOPE
pslope_t *slope = NULL; pslope_t *slope = NULL;
#endif
sec = R_PointInSubsector(x, y)->sector; sec = R_PointInSubsector(x, y)->sector;
if (flip) if (flip)
{ {
#ifdef ESLOPE slope = sec->c_slope ? sec->c_slope : NULL;
if (sec->c_slope) newz = K_BananaSlopeZ(slope, x, y, sec->ceilingheight, radius, true);
{
slope = sec->c_slope;
newz = K_BananaSlopeZ(slope, x, y, radius, true);
}
else
#endif
newz = sec->ceilingheight;
} }
else else
{ {
#ifdef ESLOPE slope = sec->f_slope ? sec->f_slope : NULL;
if (sec->f_slope) newz = K_BananaSlopeZ(slope, x, y, sec->floorheight, radius, true);
{
slope = sec->f_slope;
newz = K_BananaSlopeZ(slope, x, y, radius, false);
}
else
#endif
newz = sec->floorheight;
} }
// Check FOFs for a better suited slope // Check FOFs for a better suited slope
@ -4713,19 +4693,8 @@ static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z
|| (rover->flags & FF_SWIMMABLE))) || (rover->flags & FF_SWIMMABLE)))
continue; continue;
#ifdef ESLOPE top = K_BananaSlopeZ(*rover->t_slope, x, y, *rover->topheight, radius, false);
if (*rover->t_slope) bottom = K_BananaSlopeZ(*rover->b_slope, x, y, *rover->bottomheight, radius, true);
top = K_BananaSlopeZ(*rover->t_slope, x, y, radius, false);
else
#endif
top = *rover->topheight;
#ifdef ESLOPE
if (*rover->b_slope)
bottom = K_BananaSlopeZ(*rover->b_slope, x, y, radius, true);
else
#endif
bottom = *rover->bottomheight;
if (flip) if (flip)
{ {
@ -4748,10 +4717,7 @@ static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z
if (bottom < newz && abs(d1) < abs(d2)) if (bottom < newz && abs(d1) < abs(d2))
{ {
newz = bottom; newz = bottom;
#ifdef ESLOPE slope = *rover->b_slope ? *rover->b_slope : NULL;
if (*rover->b_slope)
slope = *rover->b_slope;
#endif
} }
} }
else else
@ -4775,18 +4741,13 @@ static void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z
if (top > newz && abs(d1) < abs(d2)) if (top > newz && abs(d1) < abs(d2))
{ {
newz = top; newz = top;
#ifdef ESLOPE slope = *rover->t_slope ? *rover->t_slope : NULL;
if (*rover->t_slope)
slope = *rover->t_slope;
#endif
} }
} }
} }
} }
#if 0 //mobj->standingslope = slope;
mobj->standingslope = slope;
#endif
#ifdef HWRENDER #ifdef HWRENDER
mobj->modeltilt = slope; mobj->modeltilt = slope;
@ -4988,13 +4949,11 @@ static void K_MoveHeldObjects(player_t *player)
if (R_PointToDist2(cur->x, cur->y, targx, targy) > 768*FRACUNIT) if (R_PointToDist2(cur->x, cur->y, targx, targy) > 768*FRACUNIT)
P_TeleportMove(cur, targx, targy, cur->z); P_TeleportMove(cur, targx, targy, cur->z);
#ifdef ESLOPE
if (P_IsObjectOnGround(cur)) if (P_IsObjectOnGround(cur))
{ {
K_CalculateBananaSlope(cur, cur->x, cur->y, cur->z, K_CalculateBananaSlope(cur, cur->x, cur->y, cur->z,
cur->radius, cur->height, (cur->eflags & MFE_VERTICALFLIP), false); cur->radius, cur->height, (cur->eflags & MFE_VERTICALFLIP), false);
} }
#endif
cur = cur->hnext; cur = cur->hnext;
} }

View file

@ -46,7 +46,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
void K_StealBumper(player_t *player, player_t *victim, boolean force); void K_StealBumper(player_t *player, player_t *victim, boolean force);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source); void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
void K_SpawnMineExplosion(mobj_t *source, UINT8 color); void K_SpawnMineExplosion(mobj_t *source, UINT8 color);
UINT8 K_DriftSparkColor(player_t *player, INT32 charge); UINT16 K_DriftSparkColor(player_t *player, INT32 charge);
void K_SpawnBoostTrail(player_t *player); void K_SpawnBoostTrail(player_t *player);
void K_SpawnSparkleTrail(mobj_t *mo); void K_SpawnSparkleTrail(mobj_t *mo);
void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent); void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent);
@ -69,6 +69,7 @@ void K_SpawnDriftBoostExplosion(player_t *player, int stage);
void K_KartUpdatePosition(player_t *player); void K_KartUpdatePosition(player_t *player);
void K_DropItems(player_t *player); void K_DropItems(player_t *player);
void K_DropRocketSneaker(player_t *player); void K_DropRocketSneaker(player_t *player);
void K_DropKitchenSink(player_t *player);
void K_StripItems(player_t *player); void K_StripItems(player_t *player);
void K_StripOther(player_t *player); void K_StripOther(player_t *player);
void K_MomentumToFacing(player_t *player); void K_MomentumToFacing(player_t *player);

View file

@ -110,7 +110,7 @@ void K_DoIngameRespawn(player_t *player)
if (leveltime < starttime) // FAULT if (leveltime < starttime) // FAULT
{ {
player->powers[pw_nocontrol] = (starttime - leveltime) + 50; player->powers[pw_nocontrol] = (starttime - leveltime) + 50;
player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse player->pflags |= PF_WPNDOWN; // cheeky pflag reuse
S_StartSound(player->mo, sfx_s3k83); S_StartSound(player->mo, sfx_s3k83);
player->karthud[khud_fault] = 1; player->karthud[khud_fault] = 1;
} }
@ -134,11 +134,11 @@ void K_DoIngameRespawn(player_t *player)
mapthing_t *beststart = NULL; mapthing_t *beststart = NULL;
UINT8 numstarts = 0; UINT8 numstarts = 0;
if (G_RaceGametype()) if (gametype == GT_RACE)
{ {
numstarts = numcoopstarts; numstarts = numcoopstarts;
} }
else if (G_BattleGametype()) else if (gametype == GT_BATTLE)
{ {
numstarts = numdmstarts; numstarts = numdmstarts;
} }
@ -152,11 +152,11 @@ void K_DoIngameRespawn(player_t *player)
UINT32 dist = UINT32_MAX; UINT32 dist = UINT32_MAX;
mapthing_t *checkstart = NULL; mapthing_t *checkstart = NULL;
if (G_RaceGametype()) if (gametype == GT_RACE)
{ {
checkstart = playerstarts[i]; checkstart = playerstarts[i];
} }
else if (G_BattleGametype()) else if (gametype == GT_BATTLE)
{ {
checkstart = deathmatchstarts[i]; checkstart = deathmatchstarts[i];
} }
@ -281,7 +281,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
const fixed_t realstepamt = (64 * mapobjectscale); const fixed_t realstepamt = (64 * mapobjectscale);
fixed_t stepamt = realstepamt; fixed_t stepamt = realstepamt;
vertex_t dest, step, laser; vector3_t dest, step, laser;
angle_t stepha, stepva; angle_t stepha, stepva;
fixed_t dist, fulldist; fixed_t dist, fulldist;
@ -563,7 +563,7 @@ static void K_DropDashWait(player_t *player)
for (i = 0; i < ns; i++) for (i = 0; i < ns; i++)
{ {
const angle_t newangle = sidediff * i; const angle_t newangle = sidediff * i;
vertex_t spawn; vector3_t spawn;
mobj_t *laser; mobj_t *laser;
spawn.x = player->mo->x + P_ReturnThrustX(player->mo, newangle, 31 * player->mo->scale); spawn.x = player->mo->x + P_ReturnThrustX(player->mo, newangle, 31 * player->mo->scale);
@ -674,7 +674,7 @@ static void K_HandleDropDash(player_t *player)
//P_PlayRinglossSound(player->mo); //P_PlayRinglossSound(player->mo);
P_PlayerRingBurst(player, 3); P_PlayerRingBurst(player, 3);
if (G_BattleGametype()) if (gametype == GT_BATTLE)
{ {
if (player->kartstuff[k_bumper] > 0) if (player->kartstuff[k_bumper] > 0)
{ {

View file

@ -19,6 +19,7 @@
#include "r_local.h" #include "r_local.h"
#include "z_zone.h" #include "z_zone.h"
#include "g_game.h" #include "g_game.h"
#include "p_slopes.h"
// The number of sparkles per waypoint connection in the waypoint visualisation // The number of sparkles per waypoint connection in the waypoint visualisation
static const UINT32 SPARKLES_PER_CONNECTION = 16U; static const UINT32 SPARKLES_PER_CONNECTION = 16U;
@ -425,10 +426,10 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c
fixed_t x, y, z; fixed_t x, y, z;
UINT32 waypointdist; UINT32 waypointdist;
INT32 n; INT32 n;
skincolors_t linkcolour = SKINCOLOR_GREEN; UINT16 linkcolour = SKINCOLOR_GREEN;
// This array is used to choose which colour should be on this connection // This array is used to choose which colour should be on this connection
const skincolors_t linkcolours[] = { const UINT16 linkcolours[] = {
SKINCOLOR_RED, SKINCOLOR_RED,
SKINCOLOR_BLUE, SKINCOLOR_BLUE,
SKINCOLOR_ORANGE, SKINCOLOR_ORANGE,
@ -437,7 +438,7 @@ static void K_DebugWaypointsSpawnLine(waypoint_t *const waypoint1, waypoint_t *c
SKINCOLOR_CYAN, SKINCOLOR_CYAN,
SKINCOLOR_WHITE, SKINCOLOR_WHITE,
}; };
const size_t linkcolourssize = sizeof(linkcolours) / sizeof(skincolors_t); const size_t linkcolourssize = sizeof(linkcolours) / sizeof(UINT16);
// Error conditions // Error conditions
I_Assert(waypoint1 != NULL); I_Assert(waypoint1 != NULL);
@ -1908,14 +1909,14 @@ static boolean K_RaiseWaypoint(
){ ){
if (descending) if (descending)
{ {
z = P_GetFOFBottomZAt(rover, x, y); z = P_GetZAt(*rover->b_slope, x, y, *rover->bottomheight);
if (z > riser->z && z < sort) if (z > riser->z && z < sort)
sort = z; sort = z;
} }
else else
{ {
z = P_GetFOFTopZAt(rover, x, y); z = P_GetZAt(*rover->t_slope, x, y, *rover->topheight);
if (z < riser->z && z > sort) if (z < riser->z && z > sort)
sort = z; sort = z;

View file

@ -1341,7 +1341,6 @@ static UINT8 ArchiveValueDemo(int TABLESINDEX, int myindex)
} }
break; break;
} }
#ifdef ESLOPE
case ARCH_SLOPE: case ARCH_SLOPE:
{ {
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex)); pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
@ -1353,7 +1352,6 @@ static UINT8 ArchiveValueDemo(int TABLESINDEX, int myindex)
} }
break; break;
} }
#endif
case ARCH_MAPHEADER: case ARCH_MAPHEADER:
{ {
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex)); mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
@ -1795,11 +1793,9 @@ static UINT8 UnArchiveValueDemo(int TABLESINDEX, char field[1024])
case ARCH_SECTOR: case ARCH_SECTOR:
LUA_PushUserdata(gL, &sectors[READUINT16(demo_p)], META_SECTOR); LUA_PushUserdata(gL, &sectors[READUINT16(demo_p)], META_SECTOR);
break; break;
#ifdef ESLOPE
case ARCH_SLOPE: case ARCH_SLOPE:
LUA_PushUserdata(gL, P_SlopeById(READUINT16(demo_p)), META_SLOPE); LUA_PushUserdata(gL, P_SlopeById(READUINT16(demo_p)), META_SLOPE);
break; break;
#endif
case ARCH_MAPHEADER: case ARCH_MAPHEADER:
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(demo_p)], META_MAPHEADER); LUA_PushUserdata(gL, mapheaderinfo[READUINT16(demo_p)], META_MAPHEADER);
break; break;

View file

@ -5206,12 +5206,9 @@ static void M_HandleAddons(INT32 choice)
M_AddonExec(KEY_ENTER); M_AddonExec(KEY_ENTER);
break; break;
case EXT_LUA: case EXT_LUA:
#ifndef HAVE_BLUA
S_StartSound(NULL, sfx_s26d); S_StartSound(NULL, sfx_s26d);
M_StartMessage(va("%c%s\x80\nThis version of SRB2Kart does not\nhave support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING); M_StartMessage(va("%c%s\x80\nThis version of SRB2Kart does not\nhave support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
break; break;
#endif
// else intentional fallthrough
case EXT_SOC: case EXT_SOC:
case EXT_WAD: case EXT_WAD:
#ifdef USE_KART #ifdef USE_KART

View file

@ -13231,7 +13231,7 @@ void A_Boss5FindWaypoint(mobj_t *actor)
} }
// allocate the table and reset count to zero // allocate the table and reset count to zero
fangwaypoints = Z_Calloc(sizeof(*waypoints)*numfangwaypoints, PU_STATIC, NULL); fangwaypoints = Z_Calloc(sizeof(*tubewaypoints)*numfangwaypoints, PU_STATIC, NULL);
numfangwaypoints = 0; numfangwaypoints = 0;
// now find them again and add them to the table! // now find them again and add them to the table!

View file

@ -4820,50 +4820,20 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
return floorz; return floorz;
} }
fixed_t
P_GetFOFTopZAt (ffloor_t *rover, fixed_t x, fixed_t y)
{
(void)x;
(void)y;
#ifdef ESLOPE
if (*rover->t_slope)
return P_GetZAt(*rover->t_slope, x, y);
else
#endif
return *rover->topheight;
}
fixed_t
P_GetFOFBottomZAt (ffloor_t *rover, fixed_t x, fixed_t y)
{
(void)x;
(void)y;
#ifdef ESLOPE
if (*rover->b_slope)
return P_GetZAt(*rover->b_slope, x, y);
else
#endif
return *rover->bottomheight;
}
fixed_t fixed_t
P_VeryTopOfFOF (ffloor_t *rover) P_VeryTopOfFOF (ffloor_t *rover)
{ {
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
return (*rover->t_slope)->highz; return (*rover->t_slope)->highz;
else else
#endif
return *rover->topheight; return *rover->topheight;
} }
fixed_t fixed_t
P_VeryBottomOfFOF (ffloor_t *rover) P_VeryBottomOfFOF (ffloor_t *rover)
{ {
#ifdef ESLOPE
if (*rover->b_slope) if (*rover->b_slope)
return (*rover->b_slope)->lowz; return (*rover->b_slope)->lowz;
else else
#endif
return *rover->bottomheight; return *rover->bottomheight;
} }

View file

@ -2738,7 +2738,6 @@ boolean P_SceneryZMovement(mobj_t *mo)
// set standingslope // set standingslope
P_TryMove(mo, mo->x, mo->y, true); P_TryMove(mo, mo->x, mo->y, true);
mo->momz = -mo->momz; mo->momz = -mo->momz;
#ifdef ESLOPE
if (mo->standingslope) if (mo->standingslope)
{ {
if (mo->flags & MF_NOCLIPHEIGHT) if (mo->flags & MF_NOCLIPHEIGHT)
@ -2746,7 +2745,6 @@ boolean P_SceneryZMovement(mobj_t *mo)
else if (!P_IsObjectOnGround(mo)) else if (!P_IsObjectOnGround(mo))
P_SlopeLaunch(mo); P_SlopeLaunch(mo);
} }
#endif
S_StartSound(mo, mo->info->activesound); S_StartSound(mo, mo->info->activesound);
} }
break; break;
@ -11160,7 +11158,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
UINT8 id = mthing->angle & 255; UINT8 id = mthing->angle & 255;
mobj->health = id; mobj->health = id;
mobj->threshold = sequence; mobj->threshold = sequence;
P_AddWaypoint(sequence, id, mobj); P_AddTubeWaypoint(sequence, id, mobj);
break; break;
} }
case MT_DSZSTALAGMITE: case MT_DSZSTALAGMITE:

View file

@ -34,6 +34,43 @@ void P_CalculateSlopeNormal(pslope_t *slope) {
slope->normal.y = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y); slope->normal.y = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
} }
// Calculate slope's high & low z
static void P_CalculateLineSlopeHighLow(pslope_t *slope, line_t *line, boolean ceiling, boolean back)
{
// To find the real highz/lowz of a slope, you need to check all the vertexes
// in the slope's sector with P_GetZAt to get the REAL lowz & highz
// Although these slopes are set by floorheights the ANGLE is what a slope is,
// so technically any slope can extend on forever (they are just bound by sectors)
// *You can use sourceline as a reference to see if two slopes really are the same
size_t l;
sector_t *checksector = back ? line->backsector : line->frontsector;
// Default points for high and low
fixed_t highest = INT32_MIN;
fixed_t lowest = INT32_MAX;
// Now check to see what the REAL high and low points of the slope inside the sector
// TODO: Is this really needed outside of FOFs? -Red
for (l = 0; l < checksector->linecount; l++)
{
pslope_t *checkslope = ceiling ? checksector->c_slope : checksector->f_slope;
fixed_t height = P_GetSlopeZAt(checkslope, checksector->lines[l]->v1->x, checksector->lines[l]->v1->y);
if (height > highest)
highest = height;
if (height < lowest)
lowest = height;
}
// Sets extra clipping data for the slope
slope->highz = highest;
slope->lowz = lowest;
}
/// Setup slope via 3 vertexes. /// Setup slope via 3 vertexes.
static void ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const vector3_t v2, const vector3_t v3) static void ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const vector3_t v2, const vector3_t v3)
{ {
@ -316,13 +353,15 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
// In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef
fslope = line->frontsector->f_slope = fslope = line->frontsector->f_slope =
MakeViaVectors(&point, &direction, dz, flags); MakeViaVectors(&point, &direction, dz, flags);
// Now remember that f_slope IS a vector // Now remember that f_slope IS a vector
// fslope->o = origin 3D point 1 of the vector // fslope->o = origin 3D point 1 of the vector
// fslope->d = destination 3D point 2 of the vector // fslope->d = destination 3D point 2 of the vector
// fslope->normal is a 3D line perpendicular to the 3D vector // fslope->normal is a 3D line perpendicular to the 3D vector
P_CalculateLineSlopeHighLow(fslope, line, false, false);
fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);
@ -338,7 +377,9 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
dz = FixedDiv(origin.z - point.z, extent); dz = FixedDiv(origin.z - point.z, extent);
cslope = line->frontsector->c_slope = cslope = line->frontsector->c_slope =
MakeViaVectors(&point, &direction, dz, flags); MakeViaVectors(&point, &direction, dz, flags);
P_CalculateLineSlopeHighLow(cslope, line, true, false);
cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);
@ -378,7 +419,9 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
dz = FixedDiv(origin.z - point.z, extent); dz = FixedDiv(origin.z - point.z, extent);
fslope = line->backsector->f_slope = fslope = line->backsector->f_slope =
MakeViaVectors(&point, &direction, dz, flags); MakeViaVectors(&point, &direction, dz, flags);
P_CalculateLineSlopeHighLow(fslope, line, false, true);
fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);
@ -395,7 +438,9 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
dz = FixedDiv(origin.z - point.z, extent); dz = FixedDiv(origin.z - point.z, extent);
cslope = line->backsector->c_slope = cslope = line->backsector->c_slope =
MakeViaVectors(&point, &direction, dz, flags); MakeViaVectors(&point, &direction, dz, flags);
P_CalculateLineSlopeHighLow(cslope, line, true, true);
cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);

View file

@ -5512,30 +5512,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
return fflr; return fflr;
} }
static fixed_t
Floor_height (sector_t *s, fixed_t x, fixed_t y)
{
#ifdef ESLOPE
return s->f_slope ? P_GetZAt(s->f_slope, x, y) : s->floorheight;
#else
(void)x;
(void)y;
return s->floorheight;
#endif
}
static fixed_t
Ceiling_height (sector_t *s, fixed_t x, fixed_t y)
{
#ifdef ESLOPE
return s->c_slope ? P_GetZAt(s->c_slope, x, y) : s->ceilingheight;
#else
(void)x;
(void)y;
return s->ceilingheight;
#endif
}
static void static void
P_RaiseTaggedThingsToFakeFloor ( P_RaiseTaggedThingsToFakeFloor (
UINT16 type, UINT16 type,
@ -5566,12 +5542,12 @@ P_RaiseTaggedThingsToFakeFloor (
if (( mo->flags2 & MF2_OBJECTFLIP )) if (( mo->flags2 & MF2_OBJECTFLIP ))
{ {
offset = ( mo->ceilingz - mo->info->height ) - mo->z; offset = ( mo->ceilingz - mo->info->height ) - mo->z;
mo->z = ( Floor_height(control, mo->x, mo->y) - mo->info->height ) - offset; mo->z = ( P_GetZAt(control->f_slope, mo->x, mo->y, control->floorheight) - mo->info->height ) - offset;
} }
else else
{ {
offset = mo->z - mo->floorz; offset = mo->z - mo->floorz;
mo->z = Ceiling_height(control, mo->x, mo->y) + offset; mo->z = P_GetZAt(control->c_slope, mo->x, mo->y, control->ceilingheight) + offset;
} }
} }
} }

View file

@ -244,6 +244,10 @@ typedef struct pslope_s
angle_t xydirection;/// Precomputed angle of the normal's projection on the XY plane. angle_t xydirection;/// Precomputed angle of the normal's projection on the XY plane.
UINT8 flags; // Slope options UINT8 flags; // Slope options
// SRB2Kart: For P_VeryTopOfFOF & P_VeryBottomOfFOF
fixed_t lowz;
fixed_t highz;
} pslope_t; } pslope_t;
typedef enum typedef enum

View file

@ -1967,21 +1967,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// frontsector->ceiling and backsector->floor to see if a door was closed. // frontsector->ceiling and backsector->floor to see if a door was closed.
// Without the following code, sprites get displayed behind closed doors. // Without the following code, sprites get displayed behind closed doors.
{ {
#ifdef ESLOPE
if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope))
#else
if (doorclosed || backsector->ceilingheight <= frontsector->floorheight)
#endif
{ {
ds_p->sprbottomclip = negonearray; ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = INT32_MAX; ds_p->bsilheight = INT32_MAX;
ds_p->silhouette |= SIL_BOTTOM; ds_p->silhouette |= SIL_BOTTOM;
} }
#ifdef ESLOPE
if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope))
#else
if (doorclosed || backsector->floorheight >= frontsector->ceilingheight)
#endif
{ // killough 1/17/98, 2/8/98 { // killough 1/17/98, 2/8/98
ds_p->sprtopclip = screenheightarray; ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = INT32_MIN; ds_p->tsilheight = INT32_MIN;