Implement WT's widescreen tiles

From-SVN: r8789
# Conflicts:
#	source/duke3d/src/menus.cpp
#	source/duke3d/src/premap.cpp
#	source/duke3d/src/sbar.h
This commit is contained in:
Evan Ramos 2020-03-29 08:41:17 +00:00 committed by Christoph Oelckers
parent e6940cd591
commit 52eab0545b
6 changed files with 52 additions and 26 deletions

View file

@ -103,6 +103,8 @@ EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
// JBF 20040604: sync is a function on some platforms
#define sync dsync
#define WT_WIDE(x) (WORLDTOUR ? (x ## WIDE) : (x))
// Uncomment the following to remove calls to a.nasm functions with the GL renderers
// so that debugging with valgrind --smc-check=none is possible:
//#define DEBUG_VALGRIND_NO_SMC

View file

@ -2408,7 +2408,7 @@ void P_DisplayWeapon(void)
weaponX -= sintable[(768 + ((*weaponFrame) << 7)) & 2047] >> 11;
weaponYOffset += sintable[(768 + ((*weaponFrame) << 7)) & 2047] >> 11;
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING))
if (!WORLDTOUR && !(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING))
weaponBits |= 512;
if (*weaponFrame > 0)
@ -2428,7 +2428,7 @@ void P_DisplayWeapon(void)
}
}
G_DrawWeaponTileWithID(currentWeapon, weaponX + 164, (weaponY << 1) + 176 - weaponYOffset, RPGGUN, weaponShade,
G_DrawWeaponTileWithID(currentWeapon, weaponX + 164, (weaponY << 1) + 176 - weaponYOffset, WT_WIDE(RPGGUN), weaponShade,
weaponBits, weaponPal);
break;
@ -2667,6 +2667,7 @@ void P_DisplayWeapon(void)
break;
case PISTOL_WEAPON:
{
if ((*weaponFrame) < PWEAPON(screenpeek, PISTOL_WEAPON, TotalTime)+1)
{
static uint8_t pistolFrames[] = { 0, 1, 2 };
@ -2682,9 +2683,11 @@ void P_DisplayWeapon(void)
break;
}
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING) && DUKE)
if (!WORLDTOUR && !(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING) && DUKE)
weaponBits |= 512;
int32_t const FIRSTGUN_5 = WORLDTOUR ? FIRSTGUNRELOADWIDE : FIRSTGUN + 5;
if ((*weaponFrame) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload) - (NAM_WW2GI ? 40 : 17))
G_DrawWeaponTileWithID(currentWeapon, 194 - (pPlayer->look_ang >> 1), weaponY + 230 - weaponYOffset, FIRSTGUN + 4,
weaponShade, weaponBits, weaponPal);
@ -2693,7 +2696,7 @@ void P_DisplayWeapon(void)
G_DrawWeaponTileWithID(currentWeapon << 1, 244 - ((*weaponFrame) << 3) - (pPlayer->look_ang >> 1),
weaponY + 130 - weaponYOffset + ((*weaponFrame) << 4), FIRSTGUN + 6, weaponShade,
weaponBits, weaponPal);
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5,
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN_5,
weaponShade, weaponBits, weaponPal);
}
else if ((*weaponFrame) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload) - (NAM_WW2GI ? 30 : 7))
@ -2701,7 +2704,7 @@ void P_DisplayWeapon(void)
G_DrawWeaponTileWithID(currentWeapon << 1, 124 + ((*weaponFrame) << 1) - (pPlayer->look_ang >> 1),
weaponY + 430 - weaponYOffset - ((*weaponFrame) << 3), FIRSTGUN + 6, weaponShade,
weaponBits, weaponPal);
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5,
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN_5,
weaponShade, weaponBits, weaponPal);
}
@ -2709,21 +2712,22 @@ void P_DisplayWeapon(void)
{
G_DrawWeaponTileWithID(currentWeapon << 2, 184 - (pPlayer->look_ang >> 1), weaponY + 235 - weaponYOffset,
FIRSTGUN + 8, weaponShade, weaponBits, weaponPal);
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 210 - weaponYOffset, FIRSTGUN + 5,
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 210 - weaponYOffset, FIRSTGUN_5,
weaponShade, weaponBits, weaponPal);
}
else if ((*weaponFrame) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload) - (NAM_WW2GI ? 6 : 2))
{
G_DrawWeaponTileWithID(currentWeapon << 2, 164 - (pPlayer->look_ang >> 1), weaponY + 245 - weaponYOffset,
FIRSTGUN + 8, weaponShade, weaponBits, weaponPal);
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5,
G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN_5,
weaponShade, weaponBits, weaponPal);
}
else if ((*weaponFrame) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload))
G_DrawWeaponTileWithID(currentWeapon, 194 - (pPlayer->look_ang >> 1), weaponY + 235 - weaponYOffset, FIRSTGUN + 5,
G_DrawWeaponTileWithID(currentWeapon, 194 - (pPlayer->look_ang >> 1), weaponY + 235 - weaponYOffset, FIRSTGUN_5,
weaponShade, weaponBits, weaponPal);
break;
}
case HANDBOMB_WEAPON:
{
@ -2874,7 +2878,7 @@ void P_DisplayWeapon(void)
break;
case FREEZE_WEAPON:
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING) && DUKE)
if (!WORLDTOUR && !(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING) && DUKE)
weaponBits |= 512;
if ((*weaponFrame) < (PWEAPON(screenpeek, pPlayer->curr_weapon, TotalTime) + 1) && (*weaponFrame) > 0)
@ -2888,13 +2892,13 @@ void P_DisplayWeapon(void)
}
weaponYOffset -= 16;
G_DrawWeaponTileWithID(currentWeapon << 1, weaponX + 210 - (pPlayer->look_ang >> 1), weaponY + 261 - weaponYOffset,
FREEZE + 2, -32, weaponBits, weaponPal);
WORLDTOUR ? FREEZEFIREWIDE : FREEZE + 2, -32, weaponBits, weaponPal);
G_DrawWeaponTileWithID(currentWeapon, weaponX + 210 - (pPlayer->look_ang >> 1), weaponY + 235 - weaponYOffset,
FREEZE + 3 + freezerFrames[*weaponFrame % 6], -32, weaponBits, weaponPal);
}
else
G_DrawWeaponTileWithID(currentWeapon, weaponX + 210 - (pPlayer->look_ang >> 1), weaponY + 261 - weaponYOffset,
FREEZE, weaponShade, weaponBits, weaponPal);
WT_WIDE(FREEZE), weaponShade, weaponBits, weaponPal);
break;
case FLAMETHROWER_WEAPON:
@ -2997,7 +3001,7 @@ void P_DisplayWeapon(void)
G_DrawWeaponTileUnfadedWithID(currentWeapon << 1, weaponX + 184 - halfLookAng, weaponY + 240 - weaponYOffset,
SHRINKER + 3 + ((*weaponFrame) & 3), -32, weaponBits, currentWeapon == GROW_WEAPON ? 2 : 0);
G_DrawWeaponTileWithID(currentWeapon, weaponX + 188 - halfLookAng, weaponY + 240 - weaponYOffset,
currentWeapon == GROW_WEAPON ? SHRINKER - 1 : SHRINKER + 1, weaponShade, weaponBits, weaponPal);
WT_WIDE(SHRINKER) + (currentWeapon == GROW_WEAPON ? -1 : 1), weaponShade, weaponBits, weaponPal);
}
else
{
@ -3005,7 +3009,7 @@ void P_DisplayWeapon(void)
SHRINKER + 2, 16 - (sintable[pPlayer->random_club_frame & 2047] >> 10), weaponBits,
currentWeapon == GROW_WEAPON ? 2 : 0);
G_DrawWeaponTileWithID(currentWeapon, weaponX + 188 - halfLookAng, weaponY + 240 - weaponYOffset,
currentWeapon == GROW_WEAPON ? SHRINKER - 2 : SHRINKER, weaponShade, weaponBits, weaponPal);
WT_WIDE(SHRINKER) + (currentWeapon == GROW_WEAPON ? -2 : 0), weaponShade, weaponBits, weaponPal);
}
break;
}

View file

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "duke3d.h"
#include "menus.h"
#include "savegame.h"
#include "sbar.h"
#include "statistics.h"
#include "menu/menu.h"
#include "mapinfo.h"
@ -179,15 +180,22 @@ static void cacheTilesForSprite(int spriteNum)
for (int j=CHAINGUN; j<=CHAINGUN+7; j++) tloadtile(j,1);
break;
case RPGSPRITE__STATIC:
for (int j=RPGGUN; j<=RPGGUN+2; j++) tloadtile(j,1);
tloadtile(WT_WIDE(RPGGUN), 1);
for (int j=RPGGUN+1; j<=RPGGUN+2; j++) tloadtile(j,1);
break;
case FREEZESPRITE__STATIC:
for (int j=FREEZE; j<=FREEZE+5; j++) tloadtile(j,1);
tloadtile(WT_WIDE(FREEZE), 1);
tloadtile(WORLDTOUR ? FREEZEFIREWIDE : FREEZE+2, 1);
for (int j=FREEZE+3; j<=FREEZE+5; j++) tloadtile(j,1);
break;
case GROWSPRITEICON__STATIC:
case SHRINKERSPRITE__STATIC:
for (int j=SHRINKER-2; j<=SHRINKER+5; j++) tloadtile(j,1);
{
int32_t const tile = WT_WIDE(SHRINKER);
for (int j=tile-2; j<=tile+1; j++) tloadtile(j,1);
for (int j=SHRINKER+2; j<=SHRINKER+5; j++) tloadtile(j,1);
break;
}
case HBOMBAMMO__STATIC:
case HEAVYHBOMB__STATIC:
for (int j=HANDREMOTE; j<=HANDREMOTE+5; j++) tloadtile(j,1);
@ -212,7 +220,7 @@ static void cacheTilesForSprite(int spriteNum)
#ifndef EDUKE32_STANDALONE
static void cacheDukeTiles(void)
{
tloadtile(BOTTOMSTATUSBAR, 1);
tloadtile(sbartile(), 1);
if ((g_netServer || ud.multimode > 1))
tloadtile(FRAGBAR, 1);
@ -239,7 +247,11 @@ static void cacheDukeTiles(void)
for (int i = FIRSTGUN; i < FIRSTGUN+3; i++)
tloadtile(i, 1);
for (int i = FIRSTGUNRELOAD; i < FIRSTGUNRELOAD+8; i++)
tloadtile(FIRSTGUNRELOAD, 1);
tloadtile(WORLDTOUR ? FIRSTGUNRELOADWIDE : FIRSTGUNRELOAD+1, 1);
tloadtile(FIRSTGUNRELOAD+2, 1);
tloadtile(FIRSTGUNRELOAD+4, 1);
for (int i = SHELL; i < SHELL+2; i++)
tloadtile(i, 1);
for (int i = EXPLOSION2; i < EXPLOSION2+21; i++)
@ -508,7 +520,7 @@ void G_UpdateScreenArea(void)
renderFlushPerms();
int const screenSize = max(ud.screen_size - 8, 0);
int const bottomStatusY = tilesiz[BOTTOMSTATUSBAR].y;
int const bottomStatusY = tilesiz[sbartile()].y;
vec2_t v1 = { scale(screenSize, xdim, 160),
scale(screenSize, (200 * 100) - (bottomStatusY * ud.statusbarscale), 200 - bottomStatusY) };

View file

@ -67,15 +67,16 @@ int32_t sbary16(int32_t y)
static void G_PatchStatusBar(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
{
int32_t const statusTile = sbartile();
int32_t const scl = sbarsc(65536);
int32_t const tx = sbarx16((160<<16) - (tilesiz[BOTTOMSTATUSBAR].x<<15)); // centered
int32_t const ty = sbary(200-tilesiz[BOTTOMSTATUSBAR].y);
int32_t const tx = sbarx16((160<<16) - (tilesiz[statusTile].x<<15)); // centered
int32_t const ty = sbary(200-tilesiz[statusTile].y);
int32_t const clx1 = sbarsc(scale(x1, xdim, 320)), cly1 = sbarsc(scale(y1, ydim, 200));
int32_t const clx2 = sbarsc(scale(x2, xdim, 320)), cly2 = sbarsc(scale(y2, ydim, 200));
int32_t const clofx = (xdim - sbarsc(xdim)) >> 1, clofy = (ydim - sbarsc(ydim));
rotatesprite(tx, ty, scl, 0, BOTTOMSTATUSBAR, 4, 0, 10+16+64, clx1+clofx, cly1+clofy, clx2+clofx-1, cly2+clofy-1);
rotatesprite(tx, ty, scl, 0, statusTile, 4, 0, 10+16+64, clx1+clofx, cly1+clofy, clx2+clofx-1, cly2+clofy-1);
}
#define POLYMOSTTRANS (1)
@ -409,10 +410,12 @@ void G_DrawInventory(const DukePlayer_t *p)
}
else // full HUD
{
y = (200<<16) - (sbarsc(tilesiz[BOTTOMSTATUSBAR].y<<16) + (12<<16) + (tilesiz[BOTTOMSTATUSBAR].y<<(16-1)));
int32_t const statusTile = sbartile();
y = (200<<16) - (sbarsc(tilesiz[statusTile].y<<16) + (12<<16) + (tilesiz[statusTile].y<<(16-1)));
if (!ud.statusbarmode) // original non-overlay mode
y += sbarsc(tilesiz[BOTTOMSTATUSBAR].y<<16)>>1; // account for the viewport y-size as the HUD scales
y += sbarsc(tilesiz[statusTile].y<<16)>>1; // account for the viewport y-size as the HUD scales
}
if (ud.screen_size == 4 && !ud.althud) // classic mini-HUD
@ -558,7 +561,7 @@ void G_DrawStatusBar(int32_t snum)
const int32_t althud = ud.althud;
#endif
const int32_t SBY = (200-tilesiz[BOTTOMSTATUSBAR].y);
const int32_t SBY = (200-tilesiz[sbartile()].y);
const int32_t sb15 = sbarsc(32768), sb15h = sbarsc(49152);
const int32_t sb16 = sbarsc(65536);

View file

@ -34,4 +34,9 @@ int32_t sbary16(int32_t y);
void G_DrawInventory(const DukePlayer_t *p);
void G_DrawStatusBar(int32_t snum);
static FORCE_INLINE int32_t sbartile(void)
{
return WORLDTOUR ? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR;
}
END_DUKE_NS

View file

@ -916,7 +916,7 @@ void G_DisplayRest(int32_t smoothratio)
i -= sbarsc(ud.althud ? (tilesiz[BIGALPHANUM].y+8)<<16 : tilesiz[INVENTORYBOX].y<<16);
}
else if (ud.screen_size > 2)
i -= sbarsc(tilesiz[BOTTOMSTATUSBAR].y<<16);
i -= sbarsc(tilesiz[sbartile()].y<<16);
int32_t const xbetween = (tilesiz[MF_Bluefont.tilenum + 'A' - '!'].x<<16) + MF_Bluefont.between.x;