mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'sky-improvements' into 'master'
Sky improvements See merge request KartKrew/Kart!174
This commit is contained in:
commit
39115db560
14 changed files with 48 additions and 43 deletions
|
|
@ -1230,8 +1230,9 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
}
|
||||
else if (fastcmp(word, "WEATHER"))
|
||||
mapheaderinfo[num-1]->weather = (UINT8)get_number(word2);
|
||||
else if (fastcmp(word, "SKYNUM"))
|
||||
mapheaderinfo[num-1]->skynum = (INT16)i;
|
||||
else if (fastcmp(word, "SKYTEXTURE"))
|
||||
deh_strlcpy(mapheaderinfo[num-1]->skytexture, word2,
|
||||
sizeof(mapheaderinfo[num-1]->skytexture), va("Level header %d: sky texture", num));
|
||||
else if (fastcmp(word, "INTERSCREEN"))
|
||||
strncpy(mapheaderinfo[num-1]->interscreen, word2, 8);
|
||||
else if (fastcmp(word, "PRECUTSCENENUM"))
|
||||
|
|
@ -9926,11 +9927,11 @@ static inline int lib_getenum(lua_State *L)
|
|||
} else if (fastcmp(word,"globalweather")) {
|
||||
lua_pushinteger(L, globalweather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"levelskynum")) {
|
||||
lua_pushinteger(L, levelskynum);
|
||||
} else if (fastcmp(word,"levelskytexture")) {
|
||||
lua_pushstring(L, levelskytexture);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globallevelskynum")) {
|
||||
lua_pushinteger(L, globallevelskynum);
|
||||
} else if (fastcmp(word,"globallevelskytexture")) {
|
||||
lua_pushstring(L, globallevelskytexture);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusname")) {
|
||||
lua_pushstring(L, mapmusname);
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ typedef struct
|
|||
UINT32 muspos; ///< Music position to jump to.
|
||||
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
|
||||
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
|
||||
INT16 skynum; ///< Sky number to use.
|
||||
char skytexture[9]; ///< Sky texture to use.
|
||||
INT16 skybox_scalex; ///< Skybox X axis scale. (0 = no movement, 1 = 1:1 movement, 16 = 16:1 slow movement, -4 = 1:4 fast movement, etc.)
|
||||
INT16 skybox_scaley; ///< Skybox Y axis scale.
|
||||
INT16 skybox_scalez; ///< Skybox Z axis scale.
|
||||
|
|
|
|||
|
|
@ -5922,13 +5922,15 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
static void HWR_DrawSkyBackground(void)
|
||||
{
|
||||
FOutVector v[4];
|
||||
texture_t *tex;
|
||||
angle_t angle;
|
||||
float dimensionmultiply;
|
||||
float aspectratio;
|
||||
float angleturn;
|
||||
|
||||
tex = textures[texturetranslation[skytexture]];
|
||||
HWR_GetTexture(texturetranslation[skytexture]);
|
||||
aspectratio = (float)vid.width/(float)vid.height;
|
||||
aspectratio = (float)vid.width / (float)vid.height;
|
||||
|
||||
//Hurdler: the sky is the only texture who need 4.0f instead of 1.0
|
||||
// because it's called just after clearing the screen
|
||||
|
|
@ -5952,22 +5954,22 @@ static void HWR_DrawSkyBackground(void)
|
|||
// software doesn't draw any further than 1024 for skies anyway, but this doesn't overlap properly
|
||||
// The only time this will probably be an issue is when a sky wider than 1024 is used as a sky AND a regular wall texture
|
||||
|
||||
angle = (dup_viewangle + gr_xtoviewangle[0]);
|
||||
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->width/256.0f);
|
||||
angle = -(dup_viewangle + gr_xtoviewangle[0]);
|
||||
dimensionmultiply = ((float)tex->width/256.0f);
|
||||
|
||||
if (atransform.mirror)
|
||||
{
|
||||
angle = InvAngle(angle);
|
||||
dimensionmultiply *= -1;
|
||||
dimensionmultiply = -dimensionmultiply;
|
||||
}
|
||||
|
||||
v[0].sow = v[3].sow = ((float) angle / ((ANGLE_90-1)*dimensionmultiply));
|
||||
v[2].sow = v[1].sow = (-1.0f/dimensionmultiply)+((float) angle / ((ANGLE_90-1)*dimensionmultiply));
|
||||
v[2].sow = v[1].sow = (1.0f/dimensionmultiply)+((float) angle / ((ANGLE_90-1)*dimensionmultiply));
|
||||
|
||||
// Y
|
||||
angle = aimingangle;
|
||||
|
||||
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->height/(128.0f*aspectratio));
|
||||
dimensionmultiply = ((float)tex->height/(128.0f*aspectratio));
|
||||
|
||||
if (splitscreen == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1405,15 +1405,15 @@ static int lib_pIsFlagAtBase(lua_State *L)
|
|||
|
||||
static int lib_pSetupLevelSky(lua_State *L)
|
||||
{
|
||||
INT32 skynum = (INT32)luaL_checkinteger(L, 1);
|
||||
const char *skytexname = luaL_checkstring(L, 1);
|
||||
player_t *user = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) // if a player, setup sky for only the player, otherwise setup sky for all players
|
||||
user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
if (!user) // global
|
||||
P_SetupLevelSky(skynum, true);
|
||||
P_SetupLevelSky(skytexname, true);
|
||||
else if (P_IsLocalPlayer(user))
|
||||
P_SetupLevelSky(skynum, false);
|
||||
P_SetupLevelSky(skytexname, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1487,8 +1487,8 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushstring(L, header->forcecharacter);
|
||||
else if (fastcmp(field,"weather"))
|
||||
lua_pushinteger(L, header->weather);
|
||||
else if (fastcmp(field,"skynum"))
|
||||
lua_pushinteger(L, header->skynum);
|
||||
else if (fastcmp(field,"skytexture"))
|
||||
lua_pushstring(L, header->skytexture);
|
||||
else if (fastcmp(field,"skybox_scalex"))
|
||||
lua_pushinteger(L, header->skybox_scalex);
|
||||
else if (fastcmp(field,"skybox_scaley"))
|
||||
|
|
|
|||
|
|
@ -577,14 +577,14 @@ void Command_Skynum_f(void)
|
|||
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf(M_GetText("skynum <sky#>: change the sky\n"));
|
||||
CONS_Printf(M_GetText("Current sky is %d\n"), levelskynum);
|
||||
CONS_Printf(M_GetText("skynum <texture name>: change the sky\n"));
|
||||
CONS_Printf(M_GetText("Current sky is %s\n"), levelskytexture);
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf(M_GetText("Previewing sky %s...\n"), COM_Argv(1));
|
||||
|
||||
P_SetupLevelSky(atoi(COM_Argv(1)), false);
|
||||
P_SetupLevelSky(COM_Argv(1), false);
|
||||
}
|
||||
|
||||
void Command_Weather_f(void)
|
||||
|
|
|
|||
|
|
@ -3096,7 +3096,7 @@ static inline void P_NetArchiveSpecials(void)
|
|||
WRITEUINT32(save_p, 0xffffffff);
|
||||
|
||||
// Sky number
|
||||
WRITEINT32(save_p, globallevelskynum);
|
||||
WRITESTRINGN(save_p, globallevelskytexture, 9);
|
||||
|
||||
// Current global weather type
|
||||
WRITEUINT8(save_p, globalweather);
|
||||
|
|
@ -3115,8 +3115,8 @@ static inline void P_NetArchiveSpecials(void)
|
|||
//
|
||||
static void P_NetUnArchiveSpecials(void)
|
||||
{
|
||||
char skytex[9];
|
||||
size_t i;
|
||||
INT32 j;
|
||||
|
||||
if (READUINT32(save_p) != ARCHIVEBLOCK_SPECIALS)
|
||||
I_Error("Bad $$$.sav at archive block Specials");
|
||||
|
|
@ -3129,9 +3129,9 @@ static void P_NetUnArchiveSpecials(void)
|
|||
itemrespawntime[iquehead++] = READINT32(save_p);
|
||||
}
|
||||
|
||||
j = READINT32(save_p);
|
||||
if (j != globallevelskynum)
|
||||
P_SetupLevelSky(j, true);
|
||||
READSTRINGN(save_p, skytex, sizeof(skytex));
|
||||
if (strcmp(skytex, globallevelskytexture))
|
||||
P_SetupLevelSky(skytex, true);
|
||||
|
||||
globalweather = READUINT8(save_p);
|
||||
|
||||
|
|
|
|||
|
|
@ -207,8 +207,9 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
mapheaderinfo[num]->forcecharacter[0] = '\0';
|
||||
DEH_WriteUndoline("WEATHER", va("%d", mapheaderinfo[num]->weather), UNDO_NONE);
|
||||
mapheaderinfo[num]->weather = 0;
|
||||
DEH_WriteUndoline("SKYNUM", va("%d", mapheaderinfo[num]->skynum), UNDO_NONE);
|
||||
mapheaderinfo[num]->skynum = 1;
|
||||
DEH_WriteUndoline("SKYTEXTURE", va("%d", mapheaderinfo[num]->skytexture), UNDO_NONE);
|
||||
snprintf(mapheaderinfo[num]->skytexture, 9, "SKY1");
|
||||
mapheaderinfo[num]->skytexture[8] = 0;
|
||||
DEH_WriteUndoline("SKYBOXSCALEX", va("%d", mapheaderinfo[num]->skybox_scalex), UNDO_NONE);
|
||||
mapheaderinfo[num]->skybox_scalex = 16;
|
||||
DEH_WriteUndoline("SKYBOXSCALEY", va("%d", mapheaderinfo[num]->skybox_scaley), UNDO_NONE);
|
||||
|
|
@ -2255,17 +2256,18 @@ static inline boolean P_CheckLevel(lumpnum_t lumpnum)
|
|||
/** Sets up a sky texture to use for the level.
|
||||
* The sky texture is used instead of F_SKY1.
|
||||
*/
|
||||
void P_SetupLevelSky(INT32 skynum, boolean global)
|
||||
void P_SetupLevelSky(const char *skytexname, boolean global)
|
||||
{
|
||||
char skytexname[12];
|
||||
char tex[9];
|
||||
strncpy(tex, skytexname, 9);
|
||||
tex[8] = 0;
|
||||
|
||||
sprintf(skytexname, "SKY%d", skynum);
|
||||
skytexture = R_TextureNumForName(skytexname);
|
||||
levelskynum = skynum;
|
||||
skytexture = R_TextureNumForName(tex);
|
||||
strncpy(levelskytexture, tex, 9);
|
||||
|
||||
// Global change
|
||||
if (global)
|
||||
globallevelskynum = levelskynum;
|
||||
strncpy(globallevelskytexture, tex, 9);
|
||||
|
||||
// Don't go beyond for dedicated servers
|
||||
if (dedicated)
|
||||
|
|
@ -2973,7 +2975,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
CON_SetupBackColormap();
|
||||
|
||||
// SRB2 determines the sky texture to be used depending on the map header.
|
||||
P_SetupLevelSky(mapheaderinfo[gamemap-1]->skynum, true);
|
||||
P_SetupLevelSky(mapheaderinfo[gamemap-1]->skytexture, true);
|
||||
|
||||
P_MakeMapMD5(lastloadedmaplumpnum, &mapmd5);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ INT32 P_CheckLevelFlat(const char *flatname);
|
|||
extern size_t nummapthings;
|
||||
extern mapthing_t *mapthings;
|
||||
|
||||
void P_SetupLevelSky(INT32 skynum, boolean global);
|
||||
void P_SetupLevelSky(const char *skytexname, boolean global);
|
||||
#ifdef SCANTHINGS
|
||||
void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2802,7 +2802,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
|
||||
case 423: // Change Sky
|
||||
if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || (line->flags & ML_NOCLIMB))
|
||||
P_SetupLevelSky(sides[line->sidenum[0]].textureoffset>>FRACBITS, (line->flags & ML_NOCLIMB));
|
||||
P_SetupLevelSky(sides[line->sidenum[0]].text, (line->flags & ML_NOCLIMB));
|
||||
break;
|
||||
|
||||
case 424: // Change Weather
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,7 @@ void R_PrecacheLevel(void)
|
|||
|
||||
// Sky texture is always present.
|
||||
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
|
||||
// while the sky texture is stored like a wall texture, with a skynum dependent name.
|
||||
// while the sky texture is stored like a wall texture, with a texture name set by the map.
|
||||
texturepresent[skytexture] = 1;
|
||||
|
||||
texturememory = 0;
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ void R_DrawPlanes(void)
|
|||
dc_x = x;
|
||||
dc_source =
|
||||
R_GetColumn(texturetranslation[skytexture],
|
||||
angle);
|
||||
-angle); // Negative because skies were being drawn horizontally flipped
|
||||
wallcolfunc();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ fixed_t skyscale;
|
|||
|
||||
/** \brief used for keeping track of the current sky
|
||||
*/
|
||||
INT32 levelskynum;
|
||||
INT32 globallevelskynum;
|
||||
char levelskytexture[9];
|
||||
char globallevelskytexture[9];
|
||||
|
||||
/** \brief The R_SetupSkyDraw function
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ extern INT32 skytexture, skytexturemid;
|
|||
extern fixed_t skyscale;
|
||||
|
||||
extern INT32 skyflatnum;
|
||||
extern INT32 levelskynum;
|
||||
extern INT32 globallevelskynum;
|
||||
extern char levelskytexture[9];
|
||||
extern char globallevelskytexture[9];
|
||||
|
||||
// call after skytexture is set to adapt for old/new skies
|
||||
void R_SetupSkyDraw(void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue