diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index b1426bc45..03c479a36 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -371,8 +371,8 @@ SW_EDITOR ?= voidsw-editor SW_TARGET:=$(SW)$(EXESUFFIX) SW_EDITOR_TARGET:=$(SW_EDITOR)$(EXESUFFIX) -SW_OBJS=actor ai anim border break bunny cache cheats colormap config console coolg coolie copysect demo draw eel game girlninj goro grpscan hornet interp interpsh inv jplayer jsector jweapon lava light mclip mdastr menus miscactr morph net ninja panel player predict quake ripper ripper2 rooms rotator rts save scrip2 sector serp setup skel skull slidor sounds spike sprite sumo swconfig sync text track vator vis wallmove warp weapon zilla zombie saveable -SW_EDITOR_OBJS=jnstub brooms bldscript jbhlp colormap grpscan +SW_OBJS=actor ai anim border break bunny cache cheats colormap common config console coolg coolie copysect demo draw eel game girlninj goro grpscan hornet interp interpsh inv jplayer jsector jweapon lava light mclip mdastr menus miscactr morph net ninja panel player predict quake ripper ripper2 rooms rotator rts save scrip2 sector serp setup skel skull slidor sounds spike sprite sumo swconfig sync text track vator vis wallmove warp weapon zilla zombie saveable +SW_EDITOR_OBJS=jnstub brooms bldscript jbhlp colormap grpscan common ifeq ($(RENDERTYPE),SDL) ifeq (1,$(HAVE_GTK2)) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 36190b16a..f335a7013 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -749,6 +749,8 @@ FORCE_INLINE int32_t getpskyidx(int32_t picnum) } 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 diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 3a5be80bc..051aba3e8 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -140,6 +140,8 @@ static void drawpixel_safe(void *s, char a) #endif } +int16_t pskybits_override = -1; + //void loadvoxel(int32_t voxindex) { UNREFERENCED_PARAMATER(voxindex); } int16_t tiletovox[MAXTILES]; int32_t usevoxels = 1; @@ -4679,14 +4681,14 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i globaltilesizy = tsizy; globalyscale = 65536 / tsizy; globalshiftval = 0; - globalzd = divscale32(((tsizy>>1)/*+g_psky.yoffs*/), tsizy) + ((uint32_t)globalypanning<<24); + globalzd = divscale32(((tsizy>>1)+parallaxyoffs_override/*+g_psky.yoffs*/), tsizy) + ((uint32_t)globalypanning<<24); } else #endif { globalshiftval = 32-globalshiftval; globalyscale = (8<<(globalshiftval-19)); - globalzd = (((tsizy>>1)/*+g_psky.yoffs*/)<>1)+parallaxyoffs_override/*+g_psky.yoffs*/)<>1)/*+g_psky.yoffs*/)) - vv[1]*ghoriz; + vv[0] = dd*((float) ((tilesiz[globalpicnum].y>>1)+parallaxyoffs_override/*+g_psky.yoffs*/)) - vv[1]*ghoriz; int i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesiz[globalpicnum].y) i += i; //Hack to draw black rectangle below sky when looking down... @@ -2885,7 +2885,7 @@ static void polymost_drawalls(int32_t const bunch) float vv[2]; float t = (float)((1<<(picsiz[globalpicnum]&15))<>1)/*+g_psky.yoffs*/)) - vv[1]*ghoriz; + vv[0] = dd*((float)((tilesiz[globalpicnum].y>>1)+parallaxyoffs_override/*+g_psky.yoffs*/)) - vv[1]*ghoriz; int i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesiz[globalpicnum].y) i += i; //Hack to draw black rectangle below sky when looking down... diff --git a/polymer/eduke32/source/sw/src/common.c b/polymer/eduke32/source/sw/src/common.c new file mode 100644 index 000000000..636857cbd --- /dev/null +++ b/polymer/eduke32/source/sw/src/common.c @@ -0,0 +1,38 @@ + +#include "build.h" + +#include "common_game.h" + +#define NUMPSKYMULTIS 1 +EDUKE32_STATIC_ASSERT(NUMPSKYMULTIS <= MAXPSKYMULTIS); +EDUKE32_STATIC_ASSERT(PSKYOFF_MAX <= MAXPSKYTILES); + +// Set up new-style multi-psky handling. +void SW_InitMultiPsky(void) +{ + int32_t i; + + static int32_t inited; + if (inited) + return; + inited = 1; + + multipskytile[0] = -1; + + pskynummultis = NUMPSKYMULTIS; + + // 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): + multipsky[0].lognumtiles = 1; + multipsky[0].horizfrac = 8192; + + for (i=0; i 100) - parallaxyoffs = 0; + if (parallaxyoffs_override > 100) + parallaxyoffs_override = 0; } else { diff --git a/polymer/eduke32/source/sw/src/jnstub.c b/polymer/eduke32/source/sw/src/jnstub.c index 588e6f7a2..2fbb0eeda 100644 --- a/polymer/eduke32/source/sw/src/jnstub.c +++ b/polymer/eduke32/source/sw/src/jnstub.c @@ -36,6 +36,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "tags.h" #include "pal.h" +#include "common_game.h" + #define M_RED 102 #define M_BLUE 198 @@ -754,6 +756,7 @@ ExtInit(void) initmouse(); InitPalette(); + SW_InitMultiPsky(); defaultspritecstat = 0; // use old centering mode kensplayerheight = 58; diff --git a/polymer/eduke32/source/sw/src/save.c b/polymer/eduke32/source/sw/src/save.c index c689a4794..7d64317c8 100644 --- a/polymer/eduke32/source/sw/src/save.c +++ b/polymer/eduke32/source/sw/src/save.c @@ -587,9 +587,9 @@ int SaveGame(short save_num) MWRITE(&NormalVisibility,sizeof(NormalVisibility),1,fil); MWRITE(&g_visibility,sizeof(g_visibility),1,fil); MWRITE(¶llaxtype,sizeof(parallaxtype),1,fil); - MWRITE(¶llaxyoffs,sizeof(parallaxyoffs),1,fil); - MWRITE(pskyoff,sizeof(pskyoff),1,fil); - MWRITE(&pskybits,sizeof(pskybits),1,fil); + MWRITE(¶llaxyoffs_override,sizeof(parallaxyoffs_override),1,fil); + MWRITE(¶llaxyscale_override,sizeof(parallaxyscale_override),1,fil); + MWRITE(&pskybits_override,sizeof(pskybits_override),1,fil); MWRITE(&BorderInfo,sizeof(BorderInfo),1,fil); MWRITE(&MoveSkip2,sizeof(MoveSkip2),1,fil); @@ -1078,9 +1078,9 @@ int LoadGame(short save_num) MREAD(&NormalVisibility,sizeof(NormalVisibility),1,fil); MREAD(&g_visibility,sizeof(g_visibility),1,fil); MREAD(¶llaxtype,sizeof(parallaxtype),1,fil); - MREAD(¶llaxyoffs,sizeof(parallaxyoffs),1,fil); - MREAD(pskyoff,sizeof(pskyoff),1,fil); - MREAD(&pskybits,sizeof(pskybits),1,fil); + MREAD(¶llaxyoffs_override,sizeof(parallaxyoffs_override),1,fil); + MREAD(¶llaxyscale_override,sizeof(parallaxyscale_override),1,fil); + MREAD(&pskybits_override,sizeof(pskybits_override),1,fil); MREAD(&BorderInfo,sizeof(BorderInfo),1,fil); MREAD(&MoveSkip2,sizeof(MoveSkip2),1,fil); diff --git a/polymer/eduke32/source/sw/src/sprite.c b/polymer/eduke32/source/sw/src/sprite.c index 83a77bb9f..c04f1f787 100644 --- a/polymer/eduke32/source/sw/src/sprite.c +++ b/polymer/eduke32/source/sw/src/sprite.c @@ -1797,6 +1797,10 @@ SpriteSetup(void) sector[i].extra = 0; } + // Clear PARALLAX_LEVEL overrides + parallaxyscale_override = 0; + pskybits_override = -1; + // Call my little sprite setup routine first JS_SpriteSetup(); @@ -2053,9 +2057,10 @@ SpriteSetup(void) case PARALLAX_LEVEL: { - pskybits = sp->lotag; + parallaxyscale_override = 8192; + pskybits_override = sp->lotag; if (SP_TAG4(sp) > 2048) - parallaxyscale = SP_TAG4(sp); + parallaxyscale_override = SP_TAG4(sp); KillSprite(SpriteNum); break; } diff --git a/polymer/eduke32/source/testgame/src/common.c b/polymer/eduke32/source/testgame/src/common.c index d5af1a98a..bfab688e3 100644 --- a/polymer/eduke32/source/testgame/src/common.c +++ b/polymer/eduke32/source/testgame/src/common.c @@ -64,7 +64,7 @@ void Ken_InitMultiPsky(void) multipsky[1].lognumtiles = 1; multipsky[1].horizfrac = 65536; - // DAYSKY + // NIGHTSKY multipsky[2].lognumtiles = 3; multipsky[2].horizfrac = 65536;