mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- sky management rework.
This commit is contained in:
parent
0beb91e17e
commit
3aff12cf4c
22 changed files with 267 additions and 250 deletions
|
@ -1041,6 +1041,7 @@ set (PCH_SOURCES
|
|||
core/secrets.cpp
|
||||
core/savegamehelp.cpp
|
||||
core/precache.cpp
|
||||
core/psky.cpp
|
||||
core/quotes.cpp
|
||||
core/screenshot.cpp
|
||||
core/sectorgeometry.cpp
|
||||
|
|
|
@ -45,7 +45,6 @@ enum
|
|||
MAXVOXELS = 1024,
|
||||
MAXSTATUS = 1024,
|
||||
// Maximum number of component tiles in a multi-psky:
|
||||
MAXPSKYTILES = 16,
|
||||
MAXSPRITESONSCREEN = 4096,
|
||||
MAXUNIQHUDID = 256, //Extra slots so HUD models can store animation state without messing game sprites
|
||||
|
||||
|
@ -123,53 +122,6 @@ inline int32_t g_visibility = 512, g_relvisibility = 0;
|
|||
|
||||
EXTERN vec2_t windowxy1, windowxy2;
|
||||
|
||||
// The maximum tile offset ever used in any tiled parallaxed multi-sky.
|
||||
#define PSKYOFF_MAX 16
|
||||
#define DEFAULTPSKY -1
|
||||
|
||||
typedef struct {
|
||||
int tilenum;
|
||||
// The proportion at which looking up/down affects the apparent 'horiz' of
|
||||
// a parallaxed sky, scaled by 65536 (so, a value of 65536 makes it align
|
||||
// with the drawn surrounding scene):
|
||||
int horizfrac;
|
||||
|
||||
// The texel index offset in the y direction of a parallaxed sky:
|
||||
// XXX: currently always 0.
|
||||
int yoffs;
|
||||
int yoffs2;
|
||||
|
||||
int lognumtiles; // 1<<lognumtiles: number of tiles in multi-sky
|
||||
int16_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<lognumtiles): tile offset relative to basetile
|
||||
|
||||
int32_t yscale;
|
||||
} psky_t;
|
||||
|
||||
// Index of map-global (legacy) multi-sky:
|
||||
// New multi-psky
|
||||
EXTERN TArray<psky_t> multipskies;
|
||||
|
||||
static inline psky_t *getpskyidx(int32_t picnum)
|
||||
{
|
||||
for (auto& sky : multipskies)
|
||||
if (picnum == sky.tilenum) return &sky;
|
||||
|
||||
return &multipskies[0];
|
||||
}
|
||||
|
||||
|
||||
EXTERN psky_t * tileSetupSky(int32_t tilenum);
|
||||
psky_t* defineSky(int32_t const tilenum, int horiz, int lognumtiles, const uint16_t* tileofs, int yoff = 0, int yoff2 = 0x7fffffff);
|
||||
|
||||
// Get properties of parallaxed sky to draw.
|
||||
// Returns: pointer to tile offset array. Sets-by-pointer the other three.
|
||||
const int16_t* getpsky(int32_t picnum, int32_t* dapyscale, int32_t* dapskybits, int32_t* dapyoffs, int32_t* daptileyscale, bool alt = false);
|
||||
|
||||
|
||||
EXTERN char parallaxtype;
|
||||
EXTERN int32_t parallaxyoffs_override, parallaxyscale_override;
|
||||
extern int16_t pskybits_override;
|
||||
|
||||
// last sprite in the freelist, that is the spritenum for which
|
||||
// .statnum==MAXSTATUS && nextspritestat[spritenum]==-1
|
||||
// (or -1 if freelist is empty):
|
||||
|
|
|
@ -48,7 +48,6 @@ float fydimen, fviewingrange;
|
|||
|
||||
uint8_t globalr = 255, globalg = 255, globalb = 255;
|
||||
|
||||
int16_t pskybits_override = -1;
|
||||
static int16_t radarang[1280];
|
||||
|
||||
// adapted from build.c
|
||||
|
@ -285,54 +284,6 @@ int32_t rintersect(int32_t x1, int32_t y1, int32_t z1,
|
|||
return t;
|
||||
}
|
||||
|
||||
//
|
||||
// multi-pskies
|
||||
//
|
||||
|
||||
psky_t * tileSetupSky(int32_t const tilenum)
|
||||
{
|
||||
for (auto& sky : multipskies)
|
||||
if (tilenum == sky.tilenum)
|
||||
{
|
||||
return &sky;
|
||||
}
|
||||
|
||||
multipskies.Reserve(1);
|
||||
multipskies.Last() = {};
|
||||
multipskies.Last().tilenum = tilenum;
|
||||
multipskies.Last().yscale = 65536;
|
||||
return &multipskies.Last();
|
||||
}
|
||||
|
||||
psky_t * defineSky(int32_t const tilenum, int horiz, int lognumtiles, const uint16_t *tileofs, int yoff, int yoff2)
|
||||
{
|
||||
auto sky = tileSetupSky(tilenum);
|
||||
sky->horizfrac = horiz;
|
||||
sky->lognumtiles = lognumtiles;
|
||||
sky->yoffs = yoff;
|
||||
sky->yoffs2 = yoff2 == 0x7fffffff ? yoff : yoff2;
|
||||
memcpy(sky->tileofs, tileofs, 2 << lognumtiles);
|
||||
return sky;
|
||||
}
|
||||
|
||||
// Get properties of parallaxed sky to draw.
|
||||
// Returns: pointer to tile offset array. Sets-by-pointer the other three.
|
||||
const int16_t* getpsky(int32_t picnum, int32_t* dapyscale, int32_t* dapskybits, int32_t* dapyoffs, int32_t* daptileyscale, bool alt)
|
||||
{
|
||||
psky_t const* const psky = getpskyidx(picnum);
|
||||
|
||||
if (dapskybits)
|
||||
*dapskybits = (pskybits_override == -1 ? psky->lognumtiles : pskybits_override);
|
||||
if (dapyscale)
|
||||
*dapyscale = (parallaxyscale_override == 0 ? psky->horizfrac : parallaxyscale_override);
|
||||
if (dapyoffs)
|
||||
*dapyoffs = (alt? psky->yoffs2 : psky->yoffs) + parallaxyoffs_override;
|
||||
if (daptileyscale)
|
||||
*daptileyscale = psky->yscale;
|
||||
|
||||
return psky->tileofs;
|
||||
}
|
||||
|
||||
//
|
||||
// inside
|
||||
//
|
||||
|
|
|
@ -28,6 +28,7 @@ Ken Silverman's official web site: http://www.advsys.net/ken
|
|||
#include "gamestruct.h"
|
||||
#include "hw_voxels.h"
|
||||
#include "coreactor.h"
|
||||
#include "psky.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// just make it shut up. Most of this file will go down the drain anyway soon.
|
||||
|
@ -1307,8 +1308,10 @@ static void polymost_flatskyrender(FVector2 const* const dpxy, int32_t const n,
|
|||
}
|
||||
|
||||
float const fglobalang = FixedToFloat(qglobalang);
|
||||
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
|
||||
int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
||||
auto sky = getSky(globalpicnum);
|
||||
int32_t dapskybits = sky.lognumtiles, dapyoffs = sky.pmoffset, daptileyscale = sky.scale * 65536;
|
||||
int16_t const * dapskyoff = sky.offsets;
|
||||
|
||||
int remap = TRANSLATION(Translation_Remap + curbasepal, globalpal);
|
||||
globalskytex = skytile? nullptr : GetSkyTexture(globalpicnum, dapskybits, dapskyoff, remap);
|
||||
int realskybits = dapskybits;
|
||||
|
@ -1317,7 +1320,8 @@ static void polymost_flatskyrender(FVector2 const* const dpxy, int32_t const n,
|
|||
dapskybits = 0;
|
||||
}
|
||||
|
||||
ghoriz = (qglobalhoriz*(1.f/65536.f)-float(ydimen>>1))*dapyscale*(1.f/65536.f)+float(ydimen>>1)+ghorizcorrect;
|
||||
dapyoffs = isDuke() && globalpicnum == 89 ? 17 * 1024 : 32 * 1024;
|
||||
ghoriz = (qglobalhoriz*(1.f/65536.f)-float(ydimen>>1))*dapyoffs*(1.f/65536.f)+float(ydimen>>1)+ghorizcorrect;
|
||||
|
||||
float const dd = fxdimen*.0000001f; //Adjust sky depth based on screen size!
|
||||
float vv[2];
|
||||
|
@ -1584,9 +1588,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
|
||||
tileUpdatePicnum(&globalpicnum, sectnum);
|
||||
|
||||
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
|
||||
int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
||||
|
||||
global_cf_fogpal = sec->fogpal;
|
||||
global_cf_shade = sec->floorshade, global_cf_pal = sec->floorpal; global_cf_z = sec->floorz; // REFACT
|
||||
global_cf_xpanning = sec->floorxpan_;
|
||||
|
@ -1638,8 +1639,6 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
tileUpdatePicnum(&globalpicnum, sectnum);
|
||||
|
||||
|
||||
dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
||||
|
||||
global_cf_fogpal = sec->fogpal;
|
||||
global_cf_shade = sec->ceilingshade, global_cf_pal = sec->ceilingpal; global_cf_z = sec->ceilingz; // REFACT
|
||||
global_cf_xpanning = sec->ceilingxpan_;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "palettecontainer.h"
|
||||
#include "mapinfo.h"
|
||||
#include "hw_voxels.h"
|
||||
#include "psky.h"
|
||||
|
||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed = false);
|
||||
int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed = false);
|
||||
|
@ -873,35 +874,48 @@ void parseEcho(FScanner& sc, FScriptPosition& pos)
|
|||
|
||||
void parseMultiPsky(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
usermaphack_t mhk;
|
||||
FScanner::SavedPos blockend;
|
||||
psky_t sky{};
|
||||
// The maximum tile offset ever used in any tiled parallaxed multi-sky.
|
||||
enum { PSKYOFF_MAX = 16 };
|
||||
|
||||
sky.yscale = 65536;
|
||||
if (!sc.GetNumber(sky.tilenum, true)) return;
|
||||
FScanner::SavedPos blockend;
|
||||
SkyDefinition sky{};
|
||||
|
||||
bool crc;
|
||||
sky.scale = 1.f;
|
||||
sky.baselineofs = INT_MIN;
|
||||
if (sc.CheckString("crc"))
|
||||
{
|
||||
if (!sc.GetNumber(sky.crc32, true)) return;
|
||||
crc = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sc.GetNumber(sky.tilenum, true)) return;
|
||||
crc = false;
|
||||
}
|
||||
|
||||
if (sc.StartBraces(&blockend)) return;
|
||||
while (!sc.FoundEndBrace(blockend))
|
||||
{
|
||||
sc.MustGetString();
|
||||
if (sc.Compare("horizfrac")) sc.GetNumber(sky.horizfrac, true);
|
||||
else if (sc.Compare("yoffset")) sc.GetNumber(sky.yoffs, true);
|
||||
if (sc.Compare("horizfrac")) sc.GetNumber(true); // not used anymore
|
||||
else if (sc.Compare("yoffset")) sc.GetNumber(sky.pmoffset, true);
|
||||
else if (sc.Compare("baseline")) sc.GetNumber(sky.baselineofs, true);
|
||||
else if (sc.Compare("lognumtiles")) sc.GetNumber(sky.lognumtiles, true);
|
||||
else if (sc.Compare("yscale")) sc.GetNumber(sky.yscale, true);
|
||||
else if (sc.Compare("yscale")) { int intscale; sc.GetNumber(intscale, true); sky.scale = intscale * (1. / 65536.); }
|
||||
else if (sc.Compare({ "tile", "panel" }))
|
||||
{
|
||||
int panel = 0, offset = 0;
|
||||
sc.GetNumber(panel, true);
|
||||
sc.GetNumber(offset, true);
|
||||
if ((unsigned)panel < MAXPSKYTILES && (unsigned)offset <= PSKYOFF_MAX) sky.tileofs[panel] = offset;
|
||||
if ((unsigned)panel < MAXPSKYTILES && (unsigned)offset <= PSKYOFF_MAX) sky.offsets[panel] = offset;
|
||||
}
|
||||
}
|
||||
|
||||
if (sky.tilenum != DEFAULTPSKY && (unsigned)sky.tilenum >= MAXUSERTILES) return;
|
||||
if (sky.baselineofs == INT_MIN) sky.baselineofs = sky.pmoffset;
|
||||
if (!crc && sky.tilenum != DEFAULTPSKY && (unsigned)sky.tilenum >= MAXUSERTILES) return;
|
||||
if ((1 << sky.lognumtiles) > MAXPSKYTILES) return;
|
||||
sky.yoffs2 = sky.yoffs;
|
||||
auto psky = tileSetupSky(sky.tilenum);
|
||||
*psky = sky;
|
||||
if (crc) addSkyCRC(sky, sky.crc32);
|
||||
else addSky(sky, sky.tilenum);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
123
source/core/psky.cpp
Normal file
123
source/core/psky.cpp
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
** pskies.cpp
|
||||
** Handling Build skies
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2019 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
**
|
||||
*/
|
||||
|
||||
#include "psky.h"
|
||||
#include "buildtiles.h"
|
||||
#include "gamefuncs.h"
|
||||
#include "tarray.h"
|
||||
|
||||
|
||||
static TArray<SkyDefinition> skies;
|
||||
|
||||
static SkyDefinition *FindSky(int tilenum)
|
||||
{
|
||||
for (auto& sky : skies)
|
||||
if (tilenum == sky.tilenum) return &sky;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static SkyDefinition *FindSkyCRC(int64_t crc)
|
||||
{
|
||||
for (auto& sky : skies)
|
||||
if (crc == sky.crc32) return &sky;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void addSky(SkyDefinition& sky, int tilenum)
|
||||
{
|
||||
SkyDefinition* old = FindSky(tilenum);
|
||||
|
||||
sky.tilenum = tilenum;
|
||||
sky.crc32 = INT64_MAX;
|
||||
if (sky.scale == 0) sky.scale = 1.f;
|
||||
|
||||
if (old) *old = sky;
|
||||
else skies.Push(sky);
|
||||
}
|
||||
|
||||
void addSkyCRC(SkyDefinition& sky, int64_t crc32)
|
||||
{
|
||||
SkyDefinition* old = FindSkyCRC(crc32);
|
||||
|
||||
sky.tilenum = -1;
|
||||
sky.crc32 = crc32;
|
||||
if (sky.scale == 0) sky.scale = 1.f;
|
||||
|
||||
if (old) *old = sky;
|
||||
else skies.Push(sky);
|
||||
}
|
||||
|
||||
SkyDefinition getSky(int tilenum)
|
||||
{
|
||||
SkyDefinition result;
|
||||
auto sky = FindSky(tilenum);
|
||||
if (sky) result = *sky;
|
||||
else
|
||||
{
|
||||
// todo: handle CRC.
|
||||
|
||||
sky = FindSky(DEFAULTPSKY);
|
||||
if (sky)
|
||||
result = *sky;
|
||||
else
|
||||
{
|
||||
result = {};
|
||||
result.scale = 1.f;
|
||||
}
|
||||
int w = tileWidth(tilenum);
|
||||
if (result.lognumtiles == 0 || w >= 256)
|
||||
{
|
||||
int bits = sizeToBits(w);
|
||||
result.lognumtiles = 11 - bits;
|
||||
if ((1 << bits) < w) result.lognumtiles--; // round down if not a power of two
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void defineSky(int tilenum, int lognumtiles, const int16_t *tileofs, int yoff, float yscale, int yoff2)
|
||||
{
|
||||
SkyDefinition sky;
|
||||
sky.baselineofs = yoff2 == 0x7fffffff ? yoff : yoff2;
|
||||
sky.pmoffset = yoff;
|
||||
sky.lognumtiles = lognumtiles;
|
||||
sky.scale = yscale;
|
||||
memset(sky.offsets, 0, sizeof(sky.offsets));
|
||||
if (tileofs) memcpy(sky.offsets, tileofs, 2 << lognumtiles);
|
||||
addSky(sky, tilenum);
|
||||
}
|
28
source/core/psky.h
Normal file
28
source/core/psky.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum
|
||||
{
|
||||
DEFAULTPSKY = -1,
|
||||
MAXPSKYTILES = 16,
|
||||
};
|
||||
|
||||
struct SkyDefinition
|
||||
{
|
||||
int64_t crc32; // CRC32 of the master tile
|
||||
int tilenum;
|
||||
int baselineofs;
|
||||
float scale;
|
||||
int lognumtiles;
|
||||
int16_t offsets[MAXPSKYTILES];
|
||||
|
||||
int pmoffset; // offset for Polymost, should go away.
|
||||
};
|
||||
|
||||
void addSky(SkyDefinition& sky, int tilenum);
|
||||
void addSkyCRC(SkyDefinition& sky, int64_t crc32);
|
||||
void SetSkyOverride(float scale, int bits);
|
||||
SkyDefinition getSky(int tilenum);
|
||||
void defineSky(int tilenum, int lognumtiles, const int16_t *tileofs, int yoff = 0, float yscale = 1.f, int yoff2 = 0x7fffffff);
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
#include "gamefuncs.h"
|
||||
#include "build.h"
|
||||
#include "cmdlib.h"
|
||||
#include "psky.h"
|
||||
|
||||
CVAR(Bool,gl_noskyboxes, false, 0)
|
||||
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilemap, int remap);
|
||||
|
@ -46,39 +47,41 @@ void initSkyInfo(HWDrawInfo *di, HWSkyInfo* sky, sectortype* sector, int plane)
|
|||
tileUpdatePicnum(&picnum, 0, 0);
|
||||
int palette = plane == plane_ceiling ? sector->ceilingpal : sector->floorpal;
|
||||
|
||||
int32_t dapyscale = 0, dapskybits = 0, dapyoffs = 0, daptileyscale = 0;
|
||||
FGameTexture* skytex = SkyboxReplacement(tileGetTexture(picnum)->GetID(), palette);
|
||||
int realskybits = 0;
|
||||
// todo: check for skybox replacement.
|
||||
SkyDefinition skydef;
|
||||
if (!skytex)
|
||||
{
|
||||
int remap = TRANSLATION(Translation_Remap + curbasepal, palette);
|
||||
|
||||
int16_t const* dapskyoff = getpsky(picnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale, true);
|
||||
skydef = getSky(picnum);
|
||||
int tw = tileWidth(picnum);
|
||||
if ((1 << sizeToBits(tw)) < tw) dapskybits--; // Build math is weird.
|
||||
|
||||
skytex = GetSkyTexture(picnum, dapskybits, dapskyoff, remap);
|
||||
realskybits = dapskybits;
|
||||
if (skytex) dapskybits = 0;
|
||||
skytex = GetSkyTexture(picnum, skydef.lognumtiles, skydef.offsets, remap);
|
||||
realskybits = skydef.lognumtiles;
|
||||
if (skytex) skydef.lognumtiles = 0;
|
||||
else skytex = tileGetTexture(picnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
skydef = {};
|
||||
skydef.scale = 1.f;
|
||||
}
|
||||
|
||||
float xpanning = plane == plane_ceiling ? sector->ceilingxpan_ : sector->floorxpan_;
|
||||
float ypanning = plane == plane_ceiling ? sector->ceilingypan_ : sector->floorypan_;
|
||||
|
||||
// dapyscale is not relvant for a sky dome.
|
||||
sky->y_scale = FixedToFloat(daptileyscale);
|
||||
sky->y_scale = skydef.scale;
|
||||
sky->cloudy = !!(sector->exflags & SECTOREX_CLOUDSCROLL);
|
||||
if (!sky->cloudy)
|
||||
{
|
||||
sky->y_offset = dapyoffs * 1.5;
|
||||
sky->x_offset = xpanning / (1 << (realskybits - dapskybits));
|
||||
sky->y_offset = skydef.baselineofs * 1.5;
|
||||
sky->x_offset = xpanning / (1 << (realskybits - skydef.lognumtiles));
|
||||
}
|
||||
else
|
||||
{
|
||||
sky->y_offset = ypanning;
|
||||
sky->x_offset = 2 * xpanning / (1 << (realskybits - dapskybits));
|
||||
sky->x_offset = 2 * xpanning / (1 << (realskybits - skydef.lognumtiles));
|
||||
}
|
||||
|
||||
PalEntry pe = GlobalMapFog ? GlobalMapFog : lookups.getFade(palette);
|
||||
|
|
|
@ -696,10 +696,6 @@ void SerializeMap(FSerializer& arc)
|
|||
("numshades", numshades) // is this really needed?
|
||||
("visibility", g_visibility)
|
||||
("relvisibility", g_relvisibility)
|
||||
("parallaxtype", parallaxtype)
|
||||
("parallaxyo", parallaxyoffs_override)
|
||||
("parallaxys", parallaxyscale_override)
|
||||
("pskybits", pskybits_override)
|
||||
("numsprites", Numsprites)
|
||||
("gamesetinput", gamesetinput)
|
||||
("allportals", allPortals);
|
||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "gamefuncs.h"
|
||||
#include "hw_sections.h"
|
||||
#include "sectorgeometry.h"
|
||||
#include "psky.h"
|
||||
|
||||
#include "blood.h"
|
||||
|
||||
|
@ -215,7 +216,6 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
|
|||
{
|
||||
I_Error("%s: Corrupted Map file", mapname.GetChars());
|
||||
}
|
||||
parallaxtype = mapHeader.parallax;
|
||||
gMapRev = mapHeader.revision;
|
||||
allocateMapArrays(mapHeader.numwalls, mapHeader.numsectors, mapHeader.numsprites);
|
||||
#if 1 // bad, bad hack, just for making Polymost happy...
|
||||
|
@ -242,15 +242,13 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
|
|||
{
|
||||
dbCrypt((char*)tpskyoff, gSkyCount * sizeof(tpskyoff[0]), gSkyCount * 2);
|
||||
}
|
||||
|
||||
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||
pSky->horizfrac = 65536;
|
||||
pSky->lognumtiles = mapHeader.pskybits;
|
||||
for (int i = 0; i < ClipHigh(gSkyCount, MAXPSKYTILES); i++)
|
||||
{
|
||||
pSky->tileofs[i] = LittleShort(tpskyoff[i]);
|
||||
tpskyoff[i] = LittleShort(tpskyoff[i]);
|
||||
}
|
||||
|
||||
defineSky(DEFAULTPSKY, mapHeader.pskybits, tpskyoff);
|
||||
|
||||
for (unsigned i = 0; i < sector.Size(); i++)
|
||||
{
|
||||
sectortype* pSector = §or[i];
|
||||
|
|
|
@ -698,8 +698,6 @@ void SerializeState(FSerializer& arc)
|
|||
}
|
||||
if (arc.BeginObject("state"))
|
||||
{
|
||||
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||
|
||||
arc("visibility", gVisibility)
|
||||
("frameclock", PlayClock)
|
||||
("framecount", gFrameCount)
|
||||
|
@ -709,12 +707,6 @@ void SerializeState(FSerializer& arc)
|
|||
("modern", gModernMap)
|
||||
#endif
|
||||
("cheating", bPlayerCheated)
|
||||
("skyhoriz", pSky->horizfrac)
|
||||
("skyy", pSky->yoffs)
|
||||
("skyy2", pSky->yoffs2)
|
||||
("scale", pSky->yscale)
|
||||
.Array("tileofs", pSky->tileofs, countof(pSky->tileofs))
|
||||
("numtiles", pSky->lognumtiles)
|
||||
("gameoptions", gGameOptions);
|
||||
|
||||
arc.EndObject();
|
||||
|
|
|
@ -40,6 +40,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|||
#include "prediction.h"
|
||||
#include "gamestate.h"
|
||||
#include "razefont.h"
|
||||
#include "psky.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -227,58 +228,41 @@ static void genspriteremaps(void)
|
|||
|
||||
static void setupbackdrop()
|
||||
{
|
||||
static const uint16_t pskyoff[8] = {};
|
||||
static const uint16_t moonoff[8] = { 0, 2, 3, 0, 2, 0, 1, 0 };
|
||||
static const uint16_t orbitoff[8] = { 0, 0, 4, 0, 0, 1, 2, 3 };
|
||||
static const uint16_t laoff[8] = { 1, 2, 1, 3, 4, 0, 2, 3 };
|
||||
static const uint16_t defoff[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||
static const uint16_t defoff1[8] = { 1, 2, 3, 4, 5, 6, 7, 0 };
|
||||
static const uint16_t defoff4[8] = { 4, 5, 6, 7, 0, 1, 2, 3 };
|
||||
static const uint16_t defoff7[8] = { 7, 0, 1, 2, 3, 4, 5, 6 };
|
||||
static const int16_t moonoff[8] = { 0, 2, 3, 0, 2, 0, 1, 0 };
|
||||
static const int16_t orbitoff[8] = { 0, 0, 4, 0, 0, 1, 2, 3 };
|
||||
static const int16_t laoff[8] = { 1, 2, 1, 3, 4, 0, 2, 3 };
|
||||
static const int16_t defoff[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||
static const int16_t defoff1[8] = { 1, 2, 3, 4, 5, 6, 7, 0 };
|
||||
static const int16_t defoff4[8] = { 4, 5, 6, 7, 0, 1, 2, 3 };
|
||||
static const int16_t defoff7[8] = { 7, 0, 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
defineSky(DEFAULTPSKY, 32768, 3, pskyoff);
|
||||
defineSky(TILE_CLOUDYOCEAN, 65536, 3, pskyoff);
|
||||
defineSky(TILE_MOONSKY1, 32768, 3, moonoff);
|
||||
defineSky(TILE_BIGORBIT1, 32768, 3, orbitoff);
|
||||
defineSky(TILE_LA, 16384 + 1024, 3, laoff);
|
||||
defineSky(DEFAULTPSKY, 3, nullptr);
|
||||
defineSky(TILE_CLOUDYOCEAN, 3, nullptr);
|
||||
defineSky(TILE_MOONSKY1, 3, moonoff);
|
||||
defineSky(TILE_BIGORBIT1, 3, orbitoff);
|
||||
defineSky(TILE_LA, 3, laoff);
|
||||
if (isWorldTour())
|
||||
{
|
||||
defineSky(5284, 65536, 3, defoff);
|
||||
defineSky(5412, 65536, 3, defoff, 80);
|
||||
defineSky(5420, 65536, 3, defoff, 80);
|
||||
defineSky(5450, 65536, 3, defoff7, 80);
|
||||
defineSky(5540, 65536, 3, defoff, 80);
|
||||
defineSky(5548, 65536, 3, defoff, 80);
|
||||
defineSky(5556, 65536, 3, defoff1, 80);
|
||||
defineSky(5720, 65536, 3, defoff4, 80);
|
||||
defineSky(5814, 65536, 3, defoff, 80);
|
||||
}
|
||||
|
||||
// Ugh... Since we do not know up front which of these tiles are skies we have to set them all...
|
||||
if (isRRRA())
|
||||
{
|
||||
for (int i = 0; i < MAXUSERTILES; i++)
|
||||
{
|
||||
if (tileWidth(i) == 512)
|
||||
{
|
||||
defineSky(i, 32768, 1, pskyoff);
|
||||
}
|
||||
else if (tileWidth(i) == 1024)
|
||||
{
|
||||
defineSky(i, 32768, 0, pskyoff);
|
||||
}
|
||||
}
|
||||
defineSky(5284, 3, defoff);
|
||||
defineSky(5412, 3, defoff, 80);
|
||||
defineSky(5420, 3, defoff, 80);
|
||||
defineSky(5450, 3, defoff7, 80);
|
||||
defineSky(5540, 3, defoff, 80);
|
||||
defineSky(5548, 3, defoff, 80);
|
||||
defineSky(5556, 3, defoff1, 80);
|
||||
defineSky(5720, 3, defoff4, 80);
|
||||
defineSky(5814, 3, defoff, 80);
|
||||
}
|
||||
|
||||
if (isNam())
|
||||
{
|
||||
defineSky(212, 65536, 3, pskyoff, 0, 140);
|
||||
defineSky(225, 65536, 3, pskyoff, 0, 140);
|
||||
defineSky(212, 3, nullptr, 0, 1, 140);
|
||||
defineSky(225, 3, nullptr, 0, 1, 140);
|
||||
}
|
||||
|
||||
if (isWW2GI() && (g_gameType & GAMEFLAG_ADDON))
|
||||
{
|
||||
defineSky(1086, 65536, 3, pskyoff, 0, 140);
|
||||
defineSky(1086, 3, nullptr, 0, 1, 140);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -415,7 +415,6 @@ void resetprestat(int snum,int g)
|
|||
numanimwalls = 0;
|
||||
numcyclers = 0;
|
||||
animatecnt = 0;
|
||||
parallaxtype = 0;
|
||||
randomseed = 17L;
|
||||
paused = 0;
|
||||
ud.cameraactor =nullptr;
|
||||
|
|
|
@ -1751,7 +1751,6 @@ void checksectors_d(int snum)
|
|||
neartagsprite->spr.yvel = 1;
|
||||
camsprite = neartagsprite;
|
||||
|
||||
// parallaxtype = 2;
|
||||
p->newOwner = acti;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "razemenu.h"
|
||||
#include "v_draw.h"
|
||||
#include "interpolate.h"
|
||||
#include "psky.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -514,6 +515,7 @@ void GameInterface::app_init()
|
|||
}
|
||||
|
||||
SetTileNames();
|
||||
defineSky(DEFAULTPSKY, 2, nullptr, 256, 1.f);
|
||||
|
||||
InitFX();
|
||||
seq_LoadSequences();
|
||||
|
|
|
@ -155,18 +155,6 @@ uint8_t LoadLevel(MapRecord* map)
|
|||
PlayerList[i].pActor = nullptr;
|
||||
}
|
||||
|
||||
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||
|
||||
pSky->tileofs[0] = 0;
|
||||
pSky->tileofs[1] = 0;
|
||||
pSky->tileofs[2] = 0;
|
||||
pSky->tileofs[3] = 0;
|
||||
pSky->yoffs = 256;
|
||||
pSky->yoffs2 = 256;
|
||||
pSky->lognumtiles = 2;
|
||||
pSky->horizfrac = 65536;
|
||||
pSky->yscale = 65536;
|
||||
parallaxtype = 2;
|
||||
g_visibility = 1024;
|
||||
flash = 0;
|
||||
precache();
|
||||
|
|
|
@ -79,17 +79,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
{
|
||||
|
||||
// reset the sky in case it hasn't been done yet.
|
||||
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||
pSky->tileofs[0] = 0;
|
||||
pSky->tileofs[1] = 0;
|
||||
pSky->tileofs[2] = 0;
|
||||
pSky->tileofs[3] = 0;
|
||||
pSky->yoffs = 256;
|
||||
pSky->yoffs2 = 256;
|
||||
pSky->lognumtiles = 2;
|
||||
pSky->horizfrac = 65536;
|
||||
pSky->yscale = 65536;
|
||||
parallaxtype = 2;
|
||||
g_visibility = 1024;
|
||||
|
||||
if (currentLevel->gameflags & LEVEL_EX_ALTSOUND)
|
||||
|
|
|
@ -73,15 +73,6 @@ extern TILE_INFO_TYPE aVoxelArray[MAXTILES];
|
|||
|
||||
void PreDrawStackedWater(void);
|
||||
|
||||
void SW_InitMultiPsky(void)
|
||||
{
|
||||
// default
|
||||
psky_t* const defaultsky = tileSetupSky(DEFAULTPSKY);
|
||||
defaultsky->lognumtiles = 1;
|
||||
defaultsky->horizfrac = 8192;
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
void ShadeSprite(tspritetype* tsp)
|
||||
{
|
||||
|
|
|
@ -47,6 +47,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "texturemanager.h"
|
||||
#include "st_start.h"
|
||||
#include "i_interface.h"
|
||||
#include "psky.h"
|
||||
|
||||
|
||||
|
||||
|
@ -267,8 +268,7 @@ void GameInterface::app_init()
|
|||
|
||||
//Connect();
|
||||
SortBreakInfo();
|
||||
parallaxtype = 1;
|
||||
SW_InitMultiPsky();
|
||||
defineSky(DEFAULTPSKY, 1, nullptr);
|
||||
|
||||
memset(Track, 0, sizeof(Track));
|
||||
memset(Player, 0, sizeof(Player));
|
||||
|
|
|
@ -1867,7 +1867,6 @@ void LoadSaveMsg(const char *msg);
|
|||
|
||||
void UpdateStatusBar();
|
||||
int32_t registerosdcommands(void);
|
||||
void SW_InitMultiPsky(void);
|
||||
|
||||
extern short LevelSecrets;
|
||||
extern int TotalKillable;
|
||||
|
|
|
@ -58,6 +58,8 @@ BEGIN_SW_NS
|
|||
// This cannot have a namespace declaration
|
||||
#include "saveable.h"
|
||||
|
||||
extern int parallaxyscale_override, pskybits_override;
|
||||
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
TO DO
|
||||
|
@ -1128,11 +1130,11 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
pspAsArray.Clear();
|
||||
Saveable_Init();
|
||||
|
||||
if (arc.BeginObject("state"))
|
||||
{
|
||||
preSerializePanelSprites(arc);
|
||||
if (arc.BeginObject("state"))
|
||||
{
|
||||
preSerializePanelSprites(arc);
|
||||
so_serializeinterpolations(arc);
|
||||
arc ("numplayers", numplayers)
|
||||
arc("numplayers", numplayers)
|
||||
.Array("players", Player, numplayers)
|
||||
("skill", Skill)
|
||||
("screenpeek", screenpeek)
|
||||
|
@ -1170,35 +1172,38 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
("FinishTimer", FinishTimer)
|
||||
("FinishAnim", FinishAnim)
|
||||
.Array("bosswasseen", bosswasseen, 3)
|
||||
.Array("BossSpriteNum", BossSpriteNum, 3);
|
||||
arc.Array("tracks", Track, countof(Track))
|
||||
.Array("BossSpriteNum", BossSpriteNum, 3)
|
||||
.Array("tracks", Track, countof(Track))
|
||||
("minenemyskill", MinEnemySkill)
|
||||
;
|
||||
postSerializePanelSprites(arc);
|
||||
arc.EndObject();
|
||||
}
|
||||
("parallaxys", parallaxyscale_override)
|
||||
("pskybits", pskybits_override)
|
||||
;
|
||||
postSerializePanelSprites(arc);
|
||||
arc.EndObject();
|
||||
}
|
||||
|
||||
if (arc.isReading())
|
||||
{
|
||||
DoTheCache();
|
||||
{
|
||||
DoTheCache();
|
||||
|
||||
int SavePlayClock = PlayClock;
|
||||
InitTimingVars();
|
||||
PlayClock = SavePlayClock;
|
||||
InitNetVars();
|
||||
int SavePlayClock = PlayClock;
|
||||
InitTimingVars();
|
||||
PlayClock = SavePlayClock;
|
||||
defineSky(DEFAULTPSKY, pskybits_override, nullptr, 0, parallaxyscale_override / 65536.f);
|
||||
InitNetVars();
|
||||
|
||||
screenpeek = myconnectindex;
|
||||
screenpeek = myconnectindex;
|
||||
|
||||
Mus_ResumeSaved();
|
||||
if (snd_ambience)
|
||||
StartAmbientSound();
|
||||
Mus_ResumeSaved();
|
||||
if (snd_ambience)
|
||||
StartAmbientSound();
|
||||
|
||||
// this is not a new game
|
||||
ShadowWarrior::NewGame = false;
|
||||
// this is not a new game
|
||||
ShadowWarrior::NewGame = false;
|
||||
|
||||
DoPlayerDivePalette(Player + myconnectindex);
|
||||
DoPlayerNightVisionPalette(Player + myconnectindex);
|
||||
InitLevelGlobals();
|
||||
InitLevelGlobals();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
BEGIN_SW_NS
|
||||
|
||||
// ugly hack stuff.
|
||||
int parallaxyscale_override, pskybits_override;
|
||||
|
||||
|
||||
int SetupCoolie(DSWActor*);
|
||||
int SetupNinja(DSWActor*);
|
||||
|
@ -1807,6 +1810,7 @@ void SpriteSetup(void)
|
|||
pskybits_override = actor->spr.lotag;
|
||||
if (SP_TAG4(actor) > 2048)
|
||||
parallaxyscale_override = SP_TAG4(actor);
|
||||
defineSky(DEFAULTPSKY, pskybits_override, nullptr, 0, parallaxyscale_override / 65536.f);
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue