mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- sky code cleanup and transitioning of Duke's.
This commit is contained in:
parent
4598cf13d7
commit
2fd2ad2212
20 changed files with 127 additions and 273 deletions
|
@ -29,7 +29,6 @@ set( PCH_SOURCES
|
||||||
src/blood.cpp
|
src/blood.cpp
|
||||||
src/callback.cpp
|
src/callback.cpp
|
||||||
src/choke.cpp
|
src/choke.cpp
|
||||||
src/common.cpp
|
|
||||||
src/config.cpp
|
src/config.cpp
|
||||||
src/controls.cpp
|
src/controls.cpp
|
||||||
src/credits.cpp
|
src/credits.cpp
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
||||||
Copyright (C) 2019 Nuke.YKT
|
|
||||||
|
|
||||||
This file is part of NBlood.
|
|
||||||
|
|
||||||
NBlood is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License version 2
|
|
||||||
as published by the Free Software Foundation.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//
|
|
||||||
// Common non-engine code/data for EDuke32 and Mapster32
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "ns.h" // Must come before everything else!
|
|
||||||
|
|
||||||
#include "compat.h"
|
|
||||||
#include "build.h"
|
|
||||||
#include "baselayer.h"
|
|
||||||
#include "cmdlib.h"
|
|
||||||
#include "palette.h"
|
|
||||||
#include "gamecvars.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "common_game.h"
|
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
|
||||||
|
|
||||||
void G_SetupGlobalPsky(void)
|
|
||||||
{
|
|
||||||
int skyIdx = 0;
|
|
||||||
|
|
||||||
// NOTE: Loop must be running backwards for the same behavior as the game
|
|
||||||
// (greatest sector index with matching parallaxed sky takes precedence).
|
|
||||||
for (bssize_t i = numsectors - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (sector[i].ceilingstat & 1)
|
|
||||||
{
|
|
||||||
skyIdx = getpskyidx(sector[i].ceilingpicnum);
|
|
||||||
if (skyIdx > 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pskyidx = skyIdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END_BLD_NS
|
|
|
@ -717,15 +717,11 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
||||||
mapHeader.at23 = B_LITTLE16(mapHeader.at23);
|
mapHeader.at23 = B_LITTLE16(mapHeader.at23);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
psky_t *pSky = tileSetupSky(0);
|
|
||||||
pSky->horizfrac = 65536;
|
|
||||||
|
|
||||||
*pX = mapHeader.at0;
|
*pX = mapHeader.at0;
|
||||||
*pY = mapHeader.at4;
|
*pY = mapHeader.at4;
|
||||||
*pZ = mapHeader.at8;
|
*pZ = mapHeader.at8;
|
||||||
*pAngle = mapHeader.atc;
|
*pAngle = mapHeader.atc;
|
||||||
*pSector = mapHeader.ate;
|
*pSector = mapHeader.ate;
|
||||||
pSky->lognumtiles = mapHeader.at10;
|
|
||||||
gVisibility = g_visibility = mapHeader.at12;
|
gVisibility = g_visibility = mapHeader.at12;
|
||||||
gSongId = mapHeader.at16;
|
gSongId = mapHeader.at16;
|
||||||
if (byte_1A76C8)
|
if (byte_1A76C8)
|
||||||
|
@ -770,16 +766,21 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
|
||||||
{
|
{
|
||||||
memset(&byte_19AE44, 0, 128);
|
memset(&byte_19AE44, 0, 128);
|
||||||
}
|
}
|
||||||
gSkyCount = 1<<pSky->lognumtiles;
|
gSkyCount = 1<< mapHeader.at10;
|
||||||
IOBuffer1.Read(tpskyoff, gSkyCount*sizeof(tpskyoff[0]));
|
IOBuffer1.Read(tpskyoff, gSkyCount*sizeof(tpskyoff[0]));
|
||||||
if (byte_1A76C8)
|
if (byte_1A76C8)
|
||||||
{
|
{
|
||||||
dbCrypt((char*)tpskyoff, gSkyCount*sizeof(tpskyoff[0]), gSkyCount*2);
|
dbCrypt((char*)tpskyoff, gSkyCount*sizeof(tpskyoff[0]), gSkyCount*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||||
|
pSky->horizfrac = 65536;
|
||||||
|
pSky->lognumtiles = mapHeader.at10;
|
||||||
for (int i = 0; i < ClipHigh(gSkyCount, MAXPSKYTILES); i++)
|
for (int i = 0; i < ClipHigh(gSkyCount, MAXPSKYTILES); i++)
|
||||||
{
|
{
|
||||||
pSky->tileofs[i] = B_LITTLE16(tpskyoff[i]);
|
pSky->tileofs[i] = B_LITTLE16(tpskyoff[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numsectors; i++)
|
for (int i = 0; i < numsectors; i++)
|
||||||
{
|
{
|
||||||
sectortype *pSector = §or[i];
|
sectortype *pSector = §or[i];
|
||||||
|
|
|
@ -626,7 +626,7 @@ public:
|
||||||
|
|
||||||
void MyLoadSave::Load(void)
|
void MyLoadSave::Load(void)
|
||||||
{
|
{
|
||||||
psky_t *pSky = tileSetupSky(0);
|
psky_t *pSky = tileSetupSky(DEFAULTPSKY);
|
||||||
int id;
|
int id;
|
||||||
Read(&id, sizeof(id));
|
Read(&id, sizeof(id));
|
||||||
if (id != 0x5653424e/*'VSBN'*/)
|
if (id != 0x5653424e/*'VSBN'*/)
|
||||||
|
@ -706,10 +706,9 @@ void MyLoadSave::Load(void)
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
Read(&gModernMap, sizeof(gModernMap));
|
Read(&gModernMap, sizeof(gModernMap));
|
||||||
#endif
|
#endif
|
||||||
psky_t skyInfo;
|
psky_t *skyInfo = tileSetupSky(DEFAULTPSKY);
|
||||||
Read(&skyInfo, sizeof(skyInfo));
|
Read(skyInfo, sizeof(*skyInfo));
|
||||||
|
skyInfo->combinedtile = -1;
|
||||||
*tileSetupSky(0) = skyInfo;
|
|
||||||
gCheatMgr.sub_5BCF4();
|
gCheatMgr.sub_5BCF4();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -797,8 +796,8 @@ void MyLoadSave::Save(void)
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
Write(&gModernMap, sizeof(gModernMap));
|
Write(&gModernMap, sizeof(gModernMap));
|
||||||
#endif
|
#endif
|
||||||
psky_t skyInfo = *tileSetupSky(0);
|
psky_t *skyInfo = tileSetupSky(DEFAULTPSKY);
|
||||||
Write(&skyInfo, sizeof(skyInfo));
|
Write(skyInfo, sizeof(*skyInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSavedInfo(void)
|
void LoadSavedInfo(void)
|
||||||
|
|
|
@ -400,6 +400,7 @@ EXTERN vec2_t windowxy1, windowxy2;
|
||||||
#define DEFAULTPSKY -1
|
#define DEFAULTPSKY -1
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
int tilenum;
|
||||||
// The proportion at which looking up/down affects the apparent 'horiz' of
|
// 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
|
// a parallaxed sky, scaled by 65536 (so, a value of 65536 makes it align
|
||||||
// with the drawn surrounding scene):
|
// with the drawn surrounding scene):
|
||||||
|
@ -410,32 +411,27 @@ typedef struct {
|
||||||
int32_t yoffs;
|
int32_t yoffs;
|
||||||
|
|
||||||
int8_t lognumtiles; // 1<<lognumtiles: number of tiles in multi-sky
|
int8_t lognumtiles; // 1<<lognumtiles: number of tiles in multi-sky
|
||||||
int8_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<lognumtiles): tile offset relative to basetile
|
int16_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<lognumtiles): tile offset relative to basetile
|
||||||
|
|
||||||
int32_t yscale;
|
int32_t yscale;
|
||||||
int combinedtile;
|
int combinedtile;
|
||||||
} psky_t;
|
} psky_t;
|
||||||
|
|
||||||
// Index of map-global (legacy) multi-sky:
|
// Index of map-global (legacy) multi-sky:
|
||||||
EXTERN int32_t g_pskyidx;
|
|
||||||
// New multi-psky
|
// New multi-psky
|
||||||
EXTERN int32_t pskynummultis;
|
EXTERN TArray<psky_t> multipskies;
|
||||||
EXTERN psky_t * multipsky;
|
|
||||||
// Mapping of multi-sky index to base sky tile number:
|
|
||||||
EXTERN int32_t * multipskytile;
|
|
||||||
|
|
||||||
static FORCE_INLINE int32_t getpskyidx(int32_t picnum)
|
static FORCE_INLINE psky_t *getpskyidx(int32_t picnum)
|
||||||
{
|
{
|
||||||
int32_t j;
|
for (auto& sky : multipskies)
|
||||||
|
if (picnum == sky.tilenum) return &sky;
|
||||||
|
|
||||||
for (j=pskynummultis-1; j>0; j--) // NOTE: j==0 on non-early loop end
|
return &multipskies[0];
|
||||||
if (picnum == multipskytile[j])
|
|
||||||
break; // Have a match.
|
|
||||||
|
|
||||||
return j;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EXTERN psky_t * tileSetupSky(int32_t tilenum);
|
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);
|
||||||
|
|
||||||
EXTERN char parallaxtype;
|
EXTERN char parallaxtype;
|
||||||
EXTERN int32_t parallaxyoffs_override, parallaxyscale_override;
|
EXTERN int32_t parallaxyoffs_override, parallaxyscale_override;
|
||||||
|
|
|
@ -1024,22 +1024,51 @@ int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy,
|
||||||
|
|
||||||
psky_t * tileSetupSky(int32_t const tilenum)
|
psky_t * tileSetupSky(int32_t const tilenum)
|
||||||
{
|
{
|
||||||
for (bssize_t i = 0; i < pskynummultis; i++)
|
for (auto& sky : multipskies)
|
||||||
if (multipskytile[i] == tilenum)
|
if (tilenum == sky.tilenum)
|
||||||
return &multipsky[i];
|
{
|
||||||
|
sky.combinedtile = -1; // invalidate the old content
|
||||||
|
return &sky;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t const newPskyID = pskynummultis++;
|
multipskies.Reserve(1);
|
||||||
multipsky = (psky_t *)Xrealloc(multipsky, pskynummultis * sizeof(psky_t));
|
multipskies.Last() = {};
|
||||||
multipskytile = (int32_t *)Xrealloc(multipskytile, pskynummultis * sizeof(int32_t));
|
multipskies.Last().tilenum = tilenum;
|
||||||
|
multipskies.Last().combinedtile = -1;
|
||||||
psky_t * const newPsky = &multipsky[newPskyID];
|
multipskies.Last().yscale = 65536;
|
||||||
Bmemset(newPsky, 0, sizeof(psky_t));
|
return &multipskies.Last();
|
||||||
multipskytile[newPskyID] = tilenum;
|
|
||||||
newPsky->yscale = 65536;
|
|
||||||
|
|
||||||
return newPsky;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psky_t * defineSky(int32_t const tilenum, int horiz, int lognumtiles, const uint16_t *tileofs, int yoff)
|
||||||
|
{
|
||||||
|
auto sky = tileSetupSky(tilenum);
|
||||||
|
sky->horizfrac = horiz;
|
||||||
|
sky->lognumtiles = lognumtiles;
|
||||||
|
sky->yoffs = yoff;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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 = psky->yoffs + parallaxyoffs_override;
|
||||||
|
if (daptileyscale)
|
||||||
|
*daptileyscale = psky->yscale;
|
||||||
|
|
||||||
|
return psky->tileofs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// preinitengine
|
// preinitengine
|
||||||
//
|
//
|
||||||
|
@ -1174,10 +1203,6 @@ void engineUnInit(void)
|
||||||
}
|
}
|
||||||
DO_FREE_AND_NULL(usermaphacks);
|
DO_FREE_AND_NULL(usermaphacks);
|
||||||
num_usermaphacks = 0;
|
num_usermaphacks = 0;
|
||||||
|
|
||||||
DO_FREE_AND_NULL(multipsky);
|
|
||||||
DO_FREE_AND_NULL(multipskytile);
|
|
||||||
pskynummultis = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -160,21 +160,7 @@ static FORCE_INLINE void setgotpic(int32_t tilenume)
|
||||||
|
|
||||||
// Get properties of parallaxed sky to draw.
|
// Get properties of parallaxed sky to draw.
|
||||||
// Returns: pointer to tile offset array. Sets-by-pointer the other three.
|
// Returns: pointer to tile offset array. Sets-by-pointer the other three.
|
||||||
static FORCE_INLINE const int8_t *getpsky(int32_t picnum, int32_t *dapyscale, int32_t *dapskybits, int32_t *dapyoffs, int32_t *daptileyscale)
|
const int16_t* getpsky(int32_t picnum, int32_t* dapyscale, int32_t* dapskybits, int32_t* dapyoffs, int32_t* daptileyscale);
|
||||||
{
|
|
||||||
psky_t const * const psky = &multipsky[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 = psky->yoffs + parallaxyoffs_override;
|
|
||||||
if (daptileyscale)
|
|
||||||
*daptileyscale = psky->yscale;
|
|
||||||
|
|
||||||
return psky->tileofs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t const z)
|
static FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t const z)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1300,7 +1300,7 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
|
||||||
|
|
||||||
float const fglobalang = fix16_to_float(qglobalang);
|
float const fglobalang = fix16_to_float(qglobalang);
|
||||||
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
|
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
|
||||||
int8_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
||||||
|
|
||||||
ghoriz = (qglobalhoriz*(1.f/65536.f)-float(ydimen>>1))*dapyscale*(1.f/65536.f)+float(ydimen>>1)+ghorizcorrect;
|
ghoriz = (qglobalhoriz*(1.f/65536.f)-float(ydimen>>1))*dapyscale*(1.f/65536.f)+float(ydimen>>1)+ghorizcorrect;
|
||||||
|
|
||||||
|
@ -1574,7 +1574,7 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
tileUpdatePicnum(&globalpicnum, sectnum);
|
tileUpdatePicnum(&globalpicnum, sectnum);
|
||||||
|
|
||||||
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
|
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
|
||||||
int8_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
||||||
|
|
||||||
global_cf_fogpal = sec->fogpal;
|
global_cf_fogpal = sec->fogpal;
|
||||||
global_cf_shade = sec->floorshade, global_cf_pal = sec->floorpal; global_cf_z = sec->floorz; // REFACT
|
global_cf_shade = sec->floorshade, global_cf_pal = sec->floorpal; global_cf_z = sec->floorz; // REFACT
|
||||||
|
|
|
@ -1668,4 +1668,3 @@ void S_SoundReset()
|
||||||
soundEngine->Reset();
|
soundEngine->Reset();
|
||||||
S_RestartMusic();
|
S_RestartMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ uint8_t LoadLevel(int nMap)
|
||||||
PlayerList[i].nSprite = -1;
|
PlayerList[i].nSprite = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
psky_t* pSky = tileSetupSky(0);
|
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||||
|
|
||||||
pSky->tileofs[0] = 0;
|
pSky->tileofs[0] = 0;
|
||||||
pSky->tileofs[1] = 0;
|
pSky->tileofs[1] = 0;
|
||||||
|
|
|
@ -54,7 +54,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
|
||||||
FinishSavegameRead();
|
FinishSavegameRead();
|
||||||
|
|
||||||
// reset the sky in case it hasn't been done yet.
|
// reset the sky in case it hasn't been done yet.
|
||||||
psky_t* pSky = tileSetupSky(0);
|
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||||
pSky->tileofs[0] = 0;
|
pSky->tileofs[0] = 0;
|
||||||
pSky->tileofs[1] = 0;
|
pSky->tileofs[1] = 0;
|
||||||
pSky->tileofs[2] = 0;
|
pSky->tileofs[2] = 0;
|
||||||
|
|
|
@ -44,7 +44,6 @@ set( PCH_SOURCES
|
||||||
src/spawn.cpp
|
src/spawn.cpp
|
||||||
src/spawn_d.cpp
|
src/spawn_d.cpp
|
||||||
src/spawn_r.cpp
|
src/spawn_r.cpp
|
||||||
src/zz_common.cpp
|
|
||||||
src/zz_game.cpp
|
src/zz_game.cpp
|
||||||
src/zz_global.cpp
|
src/zz_global.cpp
|
||||||
src/zz_player.cpp
|
src/zz_player.cpp
|
||||||
|
|
|
@ -84,8 +84,7 @@ static inline void G_NewGame_EnterLevel(MapRecord *map, int skill)
|
||||||
G_BackToMenu();
|
G_BackToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN, int LA__DYN);
|
extern void setupbackdrop();
|
||||||
extern void G_SetupGlobalPsky(void);
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
|
|
|
@ -863,5 +863,58 @@ int startrts(int lumpNum, int localPlayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Define sky layouts.
|
||||||
|
// This one's easy - the other games are a total mess
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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 };
|
||||||
|
|
||||||
|
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);
|
||||||
|
if (isWorldTour())
|
||||||
|
{
|
||||||
|
defineSky(5284, 65536, 3, defoff);
|
||||||
|
defineSky(5412, 65536, 3, defoff, 48);
|
||||||
|
defineSky(5420, 65536, 3, defoff, 48);
|
||||||
|
defineSky(5450, 65536, 3, defoff7, 48);
|
||||||
|
defineSky(5548, 65536, 3, defoff, 48);
|
||||||
|
defineSky(5556, 65536, 3, defoff1, 48);
|
||||||
|
defineSky(5720, 65536, 3, defoff4, 48);
|
||||||
|
defineSky(5814, 65536, 3, defoff, 48);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 (tilesiz[i].x == 512)
|
||||||
|
{
|
||||||
|
defineSky(i, 32768, 1, pskyoff);
|
||||||
|
}
|
||||||
|
else if (tilesiz[i].x == 1024)
|
||||||
|
{
|
||||||
|
defineSky(i, 32768, 0, pskyoff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
||||||
|
|
|
@ -888,8 +888,6 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
|
||||||
if (isRR()) prelevel_r(gamemode);
|
if (isRR()) prelevel_r(gamemode);
|
||||||
else prelevel_d(gamemode);
|
else prelevel_d(gamemode);
|
||||||
|
|
||||||
G_InitRRRASkies();
|
|
||||||
|
|
||||||
if (isRRRA() && mi->levelNumber == levelnum(2, 0))
|
if (isRRRA() && mi->levelNumber == levelnum(2, 0))
|
||||||
{
|
{
|
||||||
for (int i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
for (int i = PISTOL_WEAPON; i < MAX_WEAPONS; i++)
|
||||||
|
|
|
@ -31,7 +31,6 @@ extern int16_t ambientlotag[64];
|
||||||
extern int16_t ambienthitag[64];
|
extern int16_t ambienthitag[64];
|
||||||
void P_ResetPlayer(int pn);
|
void P_ResetPlayer(int pn);
|
||||||
void G_ResetInterpolations(void);
|
void G_ResetInterpolations(void);
|
||||||
void G_InitRRRASkies(void);
|
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -342,14 +342,14 @@ void GameInterface::set_hud_layout(int layout)
|
||||||
ud.screen_size = isRR()? screen_size_vals_rr[layout] : screen_size_vals[layout];
|
ud.screen_size = isRR()? screen_size_vals_rr[layout] : screen_size_vals[layout];
|
||||||
ud.statusbarmode = layout >= 8;
|
ud.statusbarmode = layout >= 8;
|
||||||
ud.althud = layout >= 10;
|
ud.althud = layout >= 10;
|
||||||
updateviewport();
|
if (xdim > 0 && ydim > 0) updateviewport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::set_hud_scale(int scale)
|
void GameInterface::set_hud_scale(int scale)
|
||||||
{
|
{
|
||||||
ud.statusbarscale = clamp(scale, 36, 100);
|
ud.statusbarscale = clamp(scale, 36, 100);
|
||||||
updateviewport();
|
if (xdim > 0 && ydim > 0) updateviewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::UpdateScreenSize()
|
void GameInterface::UpdateScreenSize()
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
//
|
|
||||||
// Common non-engine code/data for EDuke32 and Mapster32
|
|
||||||
//
|
|
||||||
#include "ns.h" // Must come before everything else!
|
|
||||||
|
|
||||||
#include "compat.h"
|
|
||||||
#include "build.h"
|
|
||||||
#include "baselayer.h"
|
|
||||||
#include "palette.h"
|
|
||||||
#include "cmdlib.h"
|
|
||||||
#include "gamecvars.h"
|
|
||||||
#include "rts.h"
|
|
||||||
#include "gamecontrol.h"
|
|
||||||
#include "palettecontainer.h"
|
|
||||||
#include "names.h"
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
|
||||||
|
|
||||||
//////////
|
|
||||||
|
|
||||||
// Set up new-style multi-psky handling.
|
|
||||||
void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN, int LA__DYN)
|
|
||||||
{
|
|
||||||
// When adding other multi-skies, take care that the tileofs[] values are
|
|
||||||
// <= PSKYOFF_MAX. (It can be increased up to MAXPSKYTILES, but should be
|
|
||||||
// set as tight as possible.)
|
|
||||||
|
|
||||||
// The default sky properties (all others are implicitly zero):
|
|
||||||
psky_t *sky = tileSetupSky(DEFAULTPSKY);
|
|
||||||
sky->lognumtiles = 3;
|
|
||||||
sky->horizfrac = 32768;
|
|
||||||
|
|
||||||
// TILE_CLOUDYOCEAN
|
|
||||||
// Aligns with the drawn scene horizon because it has one itself.
|
|
||||||
sky = tileSetupSky(CLOUDYOCEAN__DYN);
|
|
||||||
sky->lognumtiles = 3;
|
|
||||||
sky->horizfrac = 65536;
|
|
||||||
|
|
||||||
// TILE_MOONSKY1
|
|
||||||
// earth mountain mountain sun
|
|
||||||
sky = tileSetupSky(MOONSKY1__DYN);
|
|
||||||
sky->lognumtiles = 3;
|
|
||||||
sky->horizfrac = 32768;
|
|
||||||
sky->tileofs[6] = 1;
|
|
||||||
sky->tileofs[1] = 2;
|
|
||||||
sky->tileofs[4] = 2;
|
|
||||||
sky->tileofs[2] = 3;
|
|
||||||
|
|
||||||
// TILE_BIGORBIT1 // orbit
|
|
||||||
// earth1 2 3 moon/sun
|
|
||||||
sky = tileSetupSky(BIGORBIT1__DYN);
|
|
||||||
sky->lognumtiles = 3;
|
|
||||||
sky->horizfrac = 32768;
|
|
||||||
sky->tileofs[5] = 1;
|
|
||||||
sky->tileofs[6] = 2;
|
|
||||||
sky->tileofs[7] = 3;
|
|
||||||
sky->tileofs[2] = 4;
|
|
||||||
|
|
||||||
// TILE_LA // la city
|
|
||||||
// earth1 2 3 moon/sun
|
|
||||||
sky = tileSetupSky(LA__DYN);
|
|
||||||
sky->lognumtiles = 3;
|
|
||||||
sky->horizfrac = 16384 + 1024;
|
|
||||||
sky->tileofs[0] = 1;
|
|
||||||
sky->tileofs[1] = 2;
|
|
||||||
sky->tileofs[2] = 1;
|
|
||||||
sky->tileofs[3] = 3;
|
|
||||||
sky->tileofs[4] = 4;
|
|
||||||
sky->tileofs[5] = 0;
|
|
||||||
sky->tileofs[6] = 2;
|
|
||||||
sky->tileofs[7] = 3;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// This assertion should hold. See note above.
|
|
||||||
for (bssize_t i=0; i<pskynummultis; ++i)
|
|
||||||
for (bssize_t j=0; j<(1<<multipsky[i].lognumtiles); ++j)
|
|
||||||
Bassert(multipsky[i].tileofs[j] <= PSKYOFF_MAX);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void G_SetupGlobalPsky(void)
|
|
||||||
{
|
|
||||||
int skyIdx = 0;
|
|
||||||
|
|
||||||
// NOTE: Loop must be running backwards for the same behavior as the game
|
|
||||||
// (greatest sector index with matching parallaxed sky takes precedence).
|
|
||||||
for (bssize_t i = numsectors - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (sector[i].ceilingstat & 1)
|
|
||||||
{
|
|
||||||
skyIdx = getpskyidx(sector[i].ceilingpicnum);
|
|
||||||
if (skyIdx > 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pskyidx = skyIdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
void G_InitRRRASkies(void)
|
|
||||||
{
|
|
||||||
if (!isRRRA())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < MAXSECTORS; i++)
|
|
||||||
{
|
|
||||||
if (sector[i].ceilingpicnum != TILE_LA && sector[i].ceilingpicnum != TILE_MOONSKY1 && sector[i].ceilingpicnum != TILE_BIGORBIT1)
|
|
||||||
{
|
|
||||||
int const picnum = sector[i].ceilingpicnum;
|
|
||||||
if (tileWidth(picnum) == 512)
|
|
||||||
{
|
|
||||||
psky_t *sky = tileSetupSky(picnum);
|
|
||||||
sky->horizfrac = 32768;
|
|
||||||
sky->lognumtiles = 1;
|
|
||||||
sky->tileofs[0] = 0;
|
|
||||||
sky->tileofs[1] = 0;
|
|
||||||
}
|
|
||||||
else if (tileWidth(picnum) == 1024)
|
|
||||||
{
|
|
||||||
psky_t *sky = tileSetupSky(picnum);
|
|
||||||
sky->horizfrac = 32768;
|
|
||||||
sky->lognumtiles = 0;
|
|
||||||
sky->tileofs[0] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
|
|
@ -361,7 +361,7 @@ static void G_Startup(void)
|
||||||
G_FatalEngineError();
|
G_FatalEngineError();
|
||||||
|
|
||||||
// These depend on having the dynamic tile and/or sound mappings set up:
|
// These depend on having the dynamic tile and/or sound mappings set up:
|
||||||
G_InitMultiPsky(TILE_CLOUDYOCEAN, TILE_MOONSKY1, TILE_BIGORBIT1, TILE_LA);
|
setupbackdrop();
|
||||||
//Net_SendClientInfo();
|
//Net_SendClientInfo();
|
||||||
|
|
||||||
if (userConfig.CommandMap.IsNotEmpty())
|
if (userConfig.CommandMap.IsNotEmpty())
|
||||||
|
@ -560,8 +560,6 @@ int GameInterface::app_main()
|
||||||
ud.camera_time = 0;//4;
|
ud.camera_time = 0;//4;
|
||||||
playerteam = 0;
|
playerteam = 0;
|
||||||
|
|
||||||
hud_size.Callback();
|
|
||||||
hud_scale.Callback();
|
|
||||||
S_InitSound();
|
S_InitSound();
|
||||||
|
|
||||||
|
|
||||||
|
@ -616,6 +614,8 @@ int GameInterface::app_main()
|
||||||
userConfig.AddDefs.reset();
|
userConfig.AddDefs.reset();
|
||||||
|
|
||||||
enginePostInit();
|
enginePostInit();
|
||||||
|
hud_size.Callback();
|
||||||
|
hud_scale.Callback();
|
||||||
|
|
||||||
tileDelete(TILE_MIRROR);
|
tileDelete(TILE_MIRROR);
|
||||||
skiptile = TILE_W_FORCEFIELD + 1;
|
skiptile = TILE_W_FORCEFIELD + 1;
|
||||||
|
|
|
@ -624,7 +624,6 @@ static const dataspec_t svgm_anmisc[] =
|
||||||
{ 0, &clouds[0], sizeof(clouds), 1 },
|
{ 0, &clouds[0], sizeof(clouds), 1 },
|
||||||
{ 0, &cloudx, sizeof(cloudx), 1 },
|
{ 0, &cloudx, sizeof(cloudx), 1 },
|
||||||
{ 0, &cloudy, sizeof(cloudy), 1 },
|
{ 0, &cloudy, sizeof(cloudy), 1 },
|
||||||
{ 0, &g_pskyidx, sizeof(g_pskyidx), 1 }, // DS_NOCHK?
|
|
||||||
{ 0, &g_earthquakeTime, sizeof(g_earthquakeTime), 1 },
|
{ 0, &g_earthquakeTime, sizeof(g_earthquakeTime), 1 },
|
||||||
|
|
||||||
// RR stuff
|
// RR stuff
|
||||||
|
@ -1142,7 +1141,6 @@ static void postloadplayer(int32_t savegamep)
|
||||||
for (i=0; i<MAXPLAYERS; i++)
|
for (i=0; i<MAXPLAYERS; i++)
|
||||||
g_player[i].ps->drug_timer = 0;
|
g_player[i].ps->drug_timer = 0;
|
||||||
|
|
||||||
G_InitRRRASkies();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////// END GENERIC SAVING/LOADING SYSTEM //////////
|
////////// END GENERIC SAVING/LOADING SYSTEM //////////
|
||||||
|
|
Loading…
Reference in a new issue