Unfinished V_HORZSCREEN revamp

This commit is contained in:
TehRealSalt 2017-12-22 10:16:41 -05:00
parent 59976d3ce8
commit 94a42d1bf6
3 changed files with 64 additions and 54 deletions

View file

@ -2026,8 +2026,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
pglMatrixMode(GL_PROJECTION); pglMatrixMode(GL_PROJECTION);
pglLoadIdentity(); pglLoadIdentity();
if (stransform->splitscreen == 1 && stransform->fovxangle == 90.0f); special_splitscreen = (stransform->splitscreen == 1 && stransform->fovxangle == 90.0f);
special_splitscreen = true;
if (special_splitscreen) if (special_splitscreen)
GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5) GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
else else

View file

@ -2876,6 +2876,7 @@ static void K_KartDrift(player_t *player, boolean onground)
static void K_KartUpdatePosition(player_t *player) static void K_KartUpdatePosition(player_t *player)
{ {
fixed_t position = 1; fixed_t position = 1;
fixed_t oldposition = player->kartstuff[k_position];
fixed_t i, ppcd, pncd, ipcd, incd; fixed_t i, ppcd, pncd, ipcd, incd;
fixed_t pmo, imo; fixed_t pmo, imo;
thinker_t *th; thinker_t *th;
@ -2972,6 +2973,12 @@ static void K_KartUpdatePosition(player_t *player)
} }
} }
if (leveltime < 4*TICRATE || oldposition == 0)
oldposition = position;
if (oldposition != position) // Changed places?
player->kartstuff[k_positiondelay] = 10; // and set up the timer.
player->kartstuff[k_position] = position; player->kartstuff[k_position] = position;
} }
// //
@ -3067,8 +3074,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
K_KartUpdatePosition(player); K_KartUpdatePosition(player);
// Previously was position taunt, now is used for growing the number while passing people! /*if (!player->kartstuff[k_positiondelay] && !player->exiting)
if (!player->kartstuff[k_positiondelay] && !player->exiting)
{ {
if (player->kartstuff[k_oldposition] <= player->kartstuff[k_position]) // But first, if you lost a place, if (player->kartstuff[k_oldposition] <= player->kartstuff[k_position]) // But first, if you lost a place,
player->kartstuff[k_oldposition] = player->kartstuff[k_position]; // then the other player taunts. player->kartstuff[k_oldposition] = player->kartstuff[k_position]; // then the other player taunts.
@ -3076,9 +3082,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{ {
//S_StartSound(player->mo, sfx_slow); // Say "YOU'RE TOO SLOW!" //S_StartSound(player->mo, sfx_slow); // Say "YOU'RE TOO SLOW!"
player->kartstuff[k_oldposition] = player->kartstuff[k_position]; // Restore the old position, player->kartstuff[k_oldposition] = player->kartstuff[k_position]; // Restore the old position,
player->kartstuff[k_positiondelay] = 15; // and set up a timer. player->kartstuff[k_positiondelay] = 5*TICRATE; // and set up a timer.
} }
} }*/
if (player->kartstuff[k_positiondelay]) if (player->kartstuff[k_positiondelay])
player->kartstuff[k_positiondelay]--; player->kartstuff[k_positiondelay]--;
@ -4021,10 +4028,9 @@ INT32 ITEM_X, ITEM_Y; // Item Window
INT32 TRIP_X, TRIP_Y; // Triple Item Icon INT32 TRIP_X, TRIP_Y; // Triple Item Icon
INT32 TIME_X, TIME_Y; // Time Sticker INT32 TIME_X, TIME_Y; // Time Sticker
INT32 LAPS_X, LAPS_Y; // Lap Sticker INT32 LAPS_X, LAPS_Y; // Lap Sticker
INT32 SPDM_X, SPDM_Y; // Lap Sticker INT32 SPDM_X, SPDM_Y; // Speedometer
INT32 POSI_X, POSI_Y; // Position Number INT32 POSI_X, POSI_Y; // Position Number
INT32 FACE_X, FACE_Y; // Top-four Faces INT32 FACE_X, FACE_Y; // Top-four Faces
INT32 METE_X, METE_Y; // Speed Meter
INT32 LAKI_X, LAKI_Y; // Lakitu INT32 LAKI_X, LAKI_Y; // Lakitu
INT32 CHEK_Y; // CHECK graphic INT32 CHEK_Y; // CHECK graphic
INT32 MINI_X, MINI_Y; // Minimap INT32 MINI_X, MINI_Y; // Minimap
@ -4068,12 +4074,12 @@ static void K_initKartHUD(void)
// Single Screen (defaults) // Single Screen (defaults)
// Item Window // Item Window
ITEM_X = BASEVIDWIDTH - 52; // 268 ITEM_X = BASEVIDWIDTH - 52; // 268
ITEM_Y = 34; // 34 ITEM_Y = 9; // 9
// Triple Item Object // Triple Item Object
TRIP_X = 143; // 143 TRIP_X = 143; // 143
TRIP_Y = BASEVIDHEIGHT- 34; // 166 TRIP_Y = BASEVIDHEIGHT- 34; // 166
// Level Timer // Level Timer
TIME_X = BASEVIDWIDTH -148; // 172 TIME_X = 9; // 172
TIME_Y = 9; // 9 TIME_Y = 9; // 9
// Level Laps // Level Laps
LAPS_X = 9; // 9 LAPS_X = 9; // 9
@ -4093,13 +4099,12 @@ static void K_initKartHUD(void)
// CHECK graphic // CHECK graphic
CHEK_Y = BASEVIDHEIGHT; // 200 CHEK_Y = BASEVIDHEIGHT; // 200
// Minimap // Minimap
MINI_X = 158; // 158 MINI_X = BASEVIDWIDTH - 58; // 262
MINI_Y = 50; // 50 MINI_Y = BASEVIDHEIGHT/2; // 100
if (splitscreen) // Splitscreen if (splitscreen) // Splitscreen
{ {
ITEM_X = 9; ITEM_Y = 4;
ITEM_Y = 24;
TIME_Y = 4; TIME_Y = 4;
@ -4117,7 +4122,8 @@ static void K_initKartHUD(void)
LAPS_X = 2; LAPS_X = 2;
LAPS_Y = (BASEVIDHEIGHT/2)-22; LAPS_Y = (BASEVIDHEIGHT/2)-22;
POSI_X = (BASEVIDWIDTH/2) - 45; POSI_X = 12;
POSI_Y = (BASEVIDHEIGHT/2)-24;
MINI_X = (3*BASEVIDWIDTH/4); MINI_X = (3*BASEVIDWIDTH/4);
MINI_Y = (3*BASEVIDHEIGHT/4); MINI_Y = (3*BASEVIDHEIGHT/4);
@ -4129,10 +4135,6 @@ static void K_initKartHUD(void)
} }
} }
} }
// To correct the weird render location
/*POSI_X = SCX(POSI_X);
POSI_Y = SCX(POSI_Y);*/
} }
static INT32 K_calcSplitFlags(INT32 snapflags) static INT32 K_calcSplitFlags(INT32 snapflags)
@ -4176,10 +4178,8 @@ static void K_drawKartItemClose(void)
// Why write V_DrawScaledPatch calls over and over when they're all the same? // Why write V_DrawScaledPatch calls over and over when they're all the same?
// Set to 'no draw' just in case. // Set to 'no draw' just in case.
patch_t *localpatch = kp_nodraw; patch_t *localpatch = kp_nodraw;
INT32 X = ITEM_X;
INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT);
if (!splitscreen)
splitflags = V_SNAPTOTOP|V_SNAPTORIGHT;
/*if () /*if ()
switch (stplyr->kartstuff[k_itemclose]) switch (stplyr->kartstuff[k_itemclose])
@ -4203,7 +4203,7 @@ static void K_drawKartItemClose(void)
} }
if (localpatch != kp_nodraw) if (localpatch != kp_nodraw)
V_DrawScaledPatch(ITEM_X, ITEM_Y, splitflags, localpatch); V_DrawScaledPatch(X, ITEM_Y, splitflags, localpatch);
} }
static void K_drawKartItemRoulette(void) static void K_drawKartItemRoulette(void)
@ -4214,7 +4214,7 @@ static void K_drawKartItemRoulette(void)
// Why write V_DrawScaledPatch calls over and over when they're all the same? // Why write V_DrawScaledPatch calls over and over when they're all the same?
// Set to 'no item' just in case. // Set to 'no item' just in case.
patch_t *localpatch = kp_nodraw; patch_t *localpatch = kp_nodraw;
INT32 X = ITEM_X;
INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
if (!splitscreen) if (!splitscreen)
splitflags = V_SNAPTOTOP|V_SNAPTORIGHT; splitflags = V_SNAPTOTOP|V_SNAPTORIGHT;
@ -4270,7 +4270,7 @@ static void K_drawKartItemRoulette(void)
default: break; default: break;
} }
V_DrawScaledPatch(ITEM_X, ITEM_Y, splitflags, localpatch); V_DrawScaledPatch(X, ITEM_Y, splitflags, localpatch);
} }
static void K_drawKartRetroItem(void) static void K_drawKartRetroItem(void)
@ -4281,7 +4281,7 @@ static void K_drawKartRetroItem(void)
// Why write V_DrawScaledPatch calls over and over when they're all the same? // Why write V_DrawScaledPatch calls over and over when they're all the same?
// Set to 'no item' just in case. // Set to 'no item' just in case.
patch_t *localpatch = kp_nodraw; patch_t *localpatch = kp_nodraw;
INT32 X = ITEM_X;
INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
if (!splitscreen) if (!splitscreen)
splitflags = V_SNAPTOTOP|V_SNAPTORIGHT; splitflags = V_SNAPTOTOP|V_SNAPTORIGHT;
@ -4319,7 +4319,7 @@ static void K_drawKartRetroItem(void)
else if (stplyr->kartstuff[k_boo] == 1) localpatch = kp_boo; else if (stplyr->kartstuff[k_boo] == 1) localpatch = kp_boo;
else if (stplyr->kartstuff[k_magnet] == 1) localpatch = kp_magnet; else if (stplyr->kartstuff[k_magnet] == 1) localpatch = kp_magnet;
V_DrawScaledPatch(ITEM_X, ITEM_Y, splitflags, localpatch); V_DrawScaledPatch(X, ITEM_Y, splitflags, localpatch);
} }
/* /*
@ -4483,14 +4483,24 @@ static void K_DrawKartPositionNum(INT32 num)
// POSI_X = BASEVIDWIDTH - 51; // 269 // POSI_X = BASEVIDWIDTH - 51; // 269
// POSI_Y = BASEVIDHEIGHT- 64; // 136 // POSI_Y = BASEVIDHEIGHT- 64; // 136
INT32 X = POSI_X+43; // +43 to offset where it's being drawn if there are more than one INT32 X = POSI_X;
INT32 W = SHORT(kp_positionnum[0][0]->width); INT32 W = SHORT(kp_positionnum[0][0]->width);
fixed_t scale = FRACUNIT; fixed_t scale = FRACUNIT;
patch_t *localpatch = kp_positionnum[0][0]; patch_t *localpatch = kp_positionnum[0][0];
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT); INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT);
if (splitscreen > 1) if ((stplyr->kartstuff[k_positiondelay] || stplyr->exiting) && !splitscreen)
scale = FRACUNIT/2; scale *= 2;
else if (!(stplyr->kartstuff[k_positiondelay] || stplyr->exiting) && splitscreen)
scale /= 2;
W = FixedMul(W<<FRACBITS, scale)>>FRACBITS;
if ((splitscreen < 2) && !(splitflags & V_HORZSCREEN))
{
X -= W;
splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
}
// Special case for 0 // Special case for 0
if (!num) if (!num)
@ -4566,9 +4576,6 @@ static void K_DrawKartPositionNum(INT32 num)
else else
localpatch = kp_positionnum[num % 10][0]; localpatch = kp_positionnum[num % 10][0];
if (stplyr->kartstuff[k_positiondelay] || stplyr->exiting)
scale *= 2;
V_DrawFixedPatch(X<<FRACBITS, POSI_Y<<FRACBITS, scale, V_TRANSLUCENT|splitflags, localpatch, NULL); V_DrawFixedPatch(X<<FRACBITS, POSI_Y<<FRACBITS, scale, V_TRANSLUCENT|splitflags, localpatch, NULL);
X -= W; X -= W;
@ -4717,13 +4724,14 @@ static void K_drawKartPositionFaces(void)
static void K_drawKartLaps(void) static void K_drawKartLaps(void)
{ {
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
INT32 X = LAPS_X;
V_DrawScaledPatch(LAPS_X, LAPS_Y, splitflags, kp_lapsticker); V_DrawScaledPatch(X, LAPS_Y, splitflags, kp_lapsticker);
if (stplyr->exiting) if (stplyr->exiting)
V_DrawKartString(LAPS_X+33, LAPS_Y+3, splitflags, "FIN"); V_DrawKartString(X+33, LAPS_Y+3, splitflags, "FIN");
else else
V_DrawKartString(LAPS_X+33, LAPS_Y+3, splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value)); V_DrawKartString(X+33, LAPS_Y+3, splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
} }
static void K_drawKartSpeedometer(void) static void K_drawKartSpeedometer(void)
@ -5182,11 +5190,11 @@ void K_drawKartHUD(void)
if (stplyr->kartstuff[k_lapanimation]) if (stplyr->kartstuff[k_lapanimation])
K_drawLapLakitu(); K_drawLapLakitu();
}
// Draw the CHECK indicator before the other items too, so it's overlapped by everything else // Draw the CHECK indicator before the other items too, so it's overlapped by everything else
if (cv_kartcheck.value) if (cv_kartcheck.value)
K_drawKartPlayerCheck(); K_drawKartPlayerCheck();
}
// If the item window is closing, draw it closing! // If the item window is closing, draw it closing!
if (stplyr->kartstuff[k_itemclose]) if (stplyr->kartstuff[k_itemclose])
@ -5204,21 +5212,24 @@ void K_drawKartHUD(void)
//K_DrawKartTripleItem(); //K_DrawKartTripleItem();
// If not splitscreen, draw... // If not splitscreen, draw...
if (splitscreen < 2) // Tiny screen, don't clutter it too much if (!splitscreen && !modeattacking)
{ {
// Draw the timestamp
K_drawKartTimestamp();
}
if (!splitscreen && !modeattacking) // Unnecessary stuff
{
// The little triple-item icons at the bottom
// The top-four faces on the left
K_drawKartPositionFaces();
// Draw the speedometer // Draw the speedometer
// TODO: Make a better speedometer. // TODO: Make a better speedometer.
K_drawKartSpeedometer(); K_drawKartSpeedometer();
if (!modeattacking)
{
// The little triple-item icons at the bottom
// The top-four faces on the left
K_drawKartPositionFaces();
}
}
if (splitscreen < 2) // 3P/4P have tiny screens, don't clutter them too much
{
// Draw the timestamp
K_drawKartTimestamp();
} }
if (gametype == GT_RACE) // Race-only elements if (gametype == GT_RACE) // Race-only elements

View file

@ -428,7 +428,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
y += (BASEVIDHEIGHT/2)<<FRACBITS; y += (BASEVIDHEIGHT/2)<<FRACBITS;
if (scrn & V_HORZSCREEN) if (scrn & V_HORZSCREEN)
x += (BASEVIDWIDTH/2)<<FRACBITS; x = ((BASEVIDWIDTH<<FRACBITS) - x) - (FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale));
desttop = screens[scrn&V_PARAMMASK]; desttop = screens[scrn&V_PARAMMASK];
@ -458,7 +458,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
{ {
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
// so center this imaginary screen // so center this imaginary screen
if ((scrn & (V_HORZSCREEN|V_SNAPTORIGHT)) == (V_HORZSCREEN|V_SNAPTORIGHT)) if ((scrn & (V_HORZSCREEN|V_SNAPTOLEFT)) == (V_HORZSCREEN|V_SNAPTOLEFT))
desttop += (vid.width/2 - (BASEVIDWIDTH/2 * dupx)); desttop += (vid.width/2 - (BASEVIDWIDTH/2 * dupx));
else if (scrn & V_SNAPTORIGHT) else if (scrn & V_SNAPTORIGHT)
desttop += (vid.width - (BASEVIDWIDTH * dupx)); desttop += (vid.width - (BASEVIDWIDTH * dupx));