mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-20 00:11:19 +00:00
Merge branch 'next' into nospinmovecut
This commit is contained in:
commit
f68a95016e
18 changed files with 986 additions and 796 deletions
|
@ -760,6 +760,7 @@ linedeftypes
|
||||||
flags128text = "[7] Intangible";
|
flags128text = "[7] Intangible";
|
||||||
flags256text = "[8] Stopped by pushables";
|
flags256text = "[8] Stopped by pushables";
|
||||||
flags512text = "[9] Render flats";
|
flags512text = "[9] Render flats";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
}
|
}
|
||||||
|
|
||||||
30
|
30
|
||||||
|
@ -914,6 +915,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Render insides";
|
flags64text = "[6] Render insides";
|
||||||
flags128text = "[7] Only block non-players";
|
flags128text = "[7] Only block non-players";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "195F";
|
3dfloorflags = "195F";
|
||||||
flags643dfloorflagsadd = "7C80";
|
flags643dfloorflagsadd = "7C80";
|
||||||
|
@ -973,6 +975,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Don't cast shadow";
|
flags64text = "[6] Don't cast shadow";
|
||||||
flags128text = "[7] Render insides/block non-plr";
|
flags128text = "[7] Render insides/block non-plr";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "200191F";
|
3dfloorflags = "200191F";
|
||||||
flags1283dfloorflagsadd = "7C80";
|
flags1283dfloorflagsadd = "7C80";
|
||||||
|
@ -986,6 +989,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Don't cast shadow";
|
flags64text = "[6] Don't cast shadow";
|
||||||
flags128text = "[7] Render insides/block non-plr";
|
flags128text = "[7] Render insides/block non-plr";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "2001917";
|
3dfloorflags = "2001917";
|
||||||
flags1283dfloorflagsadd = "7C80";
|
flags1283dfloorflagsadd = "7C80";
|
||||||
|
@ -1013,6 +1017,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Don't cast shadow";
|
flags64text = "[6] Don't cast shadow";
|
||||||
flags128text = "[7] Render insides/block non-plr";
|
flags128text = "[7] Render insides/block non-plr";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "400191F";
|
3dfloorflags = "400191F";
|
||||||
flags1283dfloorflagsadd = "7C80";
|
flags1283dfloorflagsadd = "7C80";
|
||||||
|
@ -1026,6 +1031,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Don't cast shadow";
|
flags64text = "[6] Don't cast shadow";
|
||||||
flags128text = "[7] Render insides/block non-plr";
|
flags128text = "[7] Render insides/block non-plr";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "4001917";
|
3dfloorflags = "4001917";
|
||||||
flags1283dfloorflagsadd = "7C80";
|
flags1283dfloorflagsadd = "7C80";
|
||||||
|
@ -1071,6 +1077,7 @@ linedeftypes
|
||||||
flags64text = "[6] Use two light levels";
|
flags64text = "[6] Use two light levels";
|
||||||
flags512text = "[9] Use target light level";
|
flags512text = "[9] Use target light level";
|
||||||
flags1024text = "[10] Ripple effect";
|
flags1024text = "[10] Ripple effect";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "9F39";
|
3dfloorflags = "9F39";
|
||||||
flags643dfloorflagsadd = "20000";
|
flags643dfloorflagsadd = "20000";
|
||||||
|
@ -1099,6 +1106,7 @@ linedeftypes
|
||||||
flags64text = "[6] Use two light levels";
|
flags64text = "[6] Use two light levels";
|
||||||
flags512text = "[9] Use target light level";
|
flags512text = "[9] Use target light level";
|
||||||
flags1024text = "[10] Ripple effect";
|
flags1024text = "[10] Ripple effect";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "1F31";
|
3dfloorflags = "1F31";
|
||||||
flags643dfloorflagsadd = "20000";
|
flags643dfloorflagsadd = "20000";
|
||||||
|
@ -1114,6 +1122,7 @@ linedeftypes
|
||||||
flags64text = "[6] Use two light levels";
|
flags64text = "[6] Use two light levels";
|
||||||
flags512text = "[9] Use target light level";
|
flags512text = "[9] Use target light level";
|
||||||
flags1024text = "[10] Ripple effect";
|
flags1024text = "[10] Ripple effect";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "209F39";
|
3dfloorflags = "209F39";
|
||||||
flags643dfloorflagsadd = "20000";
|
flags643dfloorflagsadd = "20000";
|
||||||
|
@ -1128,6 +1137,7 @@ linedeftypes
|
||||||
flags64text = "[6] Use two light levels";
|
flags64text = "[6] Use two light levels";
|
||||||
flags512text = "[9] Use target light level";
|
flags512text = "[9] Use target light level";
|
||||||
flags1024text = "[10] Ripple effect";
|
flags1024text = "[10] Ripple effect";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "201F31";
|
3dfloorflags = "201F31";
|
||||||
flags643dfloorflagsadd = "20000";
|
flags643dfloorflagsadd = "20000";
|
||||||
|
@ -1150,6 +1160,7 @@ linedeftypes
|
||||||
prefix = "(221)";
|
prefix = "(221)";
|
||||||
flags8text = "[3] Slope skew sides";
|
flags8text = "[3] Slope skew sides";
|
||||||
flags64text = "[6] Cast shadow";
|
flags64text = "[6] Cast shadow";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "1B59";
|
3dfloorflags = "1B59";
|
||||||
flags643dfloorflagsremove = "40";
|
flags643dfloorflagsremove = "40";
|
||||||
|
@ -1273,6 +1284,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Spindash to move";
|
flags64text = "[6] Spindash to move";
|
||||||
flags128text = "[7] Only block non-players";
|
flags128text = "[7] Only block non-players";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "195F";
|
3dfloorflags = "195F";
|
||||||
}
|
}
|
||||||
|
@ -1312,6 +1324,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Spindash, no shadow";
|
flags64text = "[6] Spindash, no shadow";
|
||||||
flags128text = "[7] Only block non-players";
|
flags128text = "[7] Only block non-players";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "2009D1F";
|
3dfloorflags = "2009D1F";
|
||||||
flags643dfloorflagsadd = "40";
|
flags643dfloorflagsadd = "40";
|
||||||
|
@ -1378,6 +1391,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Don't cast shadow";
|
flags64text = "[6] Don't cast shadow";
|
||||||
flags128text = "[7] Only block non-players";
|
flags128text = "[7] Only block non-players";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "210959F";
|
3dfloorflags = "210959F";
|
||||||
flags643dfloorflagsadd = "40";
|
flags643dfloorflagsadd = "40";
|
||||||
|
@ -1391,6 +1405,7 @@ linedeftypes
|
||||||
flags32text = "[5] Only block player";
|
flags32text = "[5] Only block player";
|
||||||
flags64text = "[6] Don't cast shadow";
|
flags64text = "[6] Don't cast shadow";
|
||||||
flags128text = "[7] Only block non-players";
|
flags128text = "[7] Only block non-players";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "218959F";
|
3dfloorflags = "218959F";
|
||||||
flags643dfloorflagsadd = "40";
|
flags643dfloorflagsadd = "40";
|
||||||
|
@ -1529,6 +1544,7 @@ linedeftypes
|
||||||
flags8text = "[3] Slope skew sides";
|
flags8text = "[3] Slope skew sides";
|
||||||
flags512text = "[9] Shattered by pushables";
|
flags512text = "[9] Shattered by pushables";
|
||||||
flags1024text = "[10] Trigger linedef executor";
|
flags1024text = "[10] Trigger linedef executor";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "880101D";
|
3dfloorflags = "880101D";
|
||||||
}
|
}
|
||||||
|
@ -1570,6 +1586,7 @@ linedeftypes
|
||||||
flags128text = "[7] Only block non-players";
|
flags128text = "[7] Only block non-players";
|
||||||
flags512text = "[9] Shattered by pushables";
|
flags512text = "[9] Shattered by pushables";
|
||||||
flags1024text = "[10] Trigger linedef executor";
|
flags1024text = "[10] Trigger linedef executor";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "1080101F";
|
3dfloorflags = "1080101F";
|
||||||
}
|
}
|
||||||
|
@ -1591,6 +1608,7 @@ linedeftypes
|
||||||
prefix = "(258)";
|
prefix = "(258)";
|
||||||
flags8text = "[3] Slope skew sides";
|
flags8text = "[3] Slope skew sides";
|
||||||
flags32text = "[5] Don't damage bosses";
|
flags32text = "[5] Don't damage bosses";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorflags = "959";
|
3dfloorflags = "959";
|
||||||
}
|
}
|
||||||
|
@ -1604,6 +1622,7 @@ linedeftypes
|
||||||
flags128text = "[7] Only block non-players";
|
flags128text = "[7] Only block non-players";
|
||||||
flags512text = "[9] Shattered by pushables";
|
flags512text = "[9] Shattered by pushables";
|
||||||
flags1024text = "[10] Trigger linedef executor";
|
flags1024text = "[10] Trigger linedef executor";
|
||||||
|
flags8192text = "[13] Cut cyan flat pixels";
|
||||||
3dfloor = true;
|
3dfloor = true;
|
||||||
3dfloorcustom = true;
|
3dfloorcustom = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3862,20 +3862,21 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale
|
||||||
UINT8 lightlevel = 255;
|
UINT8 lightlevel = 255;
|
||||||
extracolormap_t *colormap = NULL;
|
extracolormap_t *colormap = NULL;
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
SINT8 flip = P_MobjFlip(thing);
|
||||||
|
|
||||||
INT32 light;
|
INT32 light;
|
||||||
fixed_t scalemul;
|
fixed_t scalemul;
|
||||||
UINT16 alpha;
|
UINT16 alpha;
|
||||||
fixed_t floordiff;
|
fixed_t floordiff;
|
||||||
fixed_t floorz;
|
fixed_t groundz;
|
||||||
fixed_t slopez;
|
fixed_t slopez;
|
||||||
pslope_t *floorslope;
|
pslope_t *groundslope;
|
||||||
|
|
||||||
floorz = R_GetShadowZ(thing, &floorslope);
|
groundz = R_GetShadowZ(thing, &groundslope);
|
||||||
|
|
||||||
//if (abs(floorz - gr_viewz) / tz > 4) return; // Prevent stretchy shadows and possible crashes
|
//if (abs(groundz - gr_viewz) / tz > 4) return; // Prevent stretchy shadows and possible crashes
|
||||||
|
|
||||||
floordiff = abs(thing->z - floorz);
|
floordiff = abs((flip < 0 ? thing->height : 0) + thing->z - groundz);
|
||||||
|
|
||||||
alpha = floordiff / (4*FRACUNIT) + 75;
|
alpha = floordiff / (4*FRACUNIT) + 75;
|
||||||
if (alpha >= 255) return;
|
if (alpha >= 255) return;
|
||||||
|
@ -3907,18 +3908,18 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale
|
||||||
shadowVerts[0].z = shadowVerts[1].z = fy - offset;
|
shadowVerts[0].z = shadowVerts[1].z = fy - offset;
|
||||||
shadowVerts[3].z = shadowVerts[2].z = fy + offset;
|
shadowVerts[3].z = shadowVerts[2].z = fy + offset;
|
||||||
|
|
||||||
if (floorslope)
|
if (groundslope)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
slopez = P_GetSlopeZAt(floorslope, FLOAT_TO_FIXED(shadowVerts[i].x), FLOAT_TO_FIXED(shadowVerts[i].z));
|
slopez = P_GetSlopeZAt(groundslope, FLOAT_TO_FIXED(shadowVerts[i].x), FLOAT_TO_FIXED(shadowVerts[i].z));
|
||||||
shadowVerts[i].y = FIXED_TO_FLOAT(slopez) + 0.05f;
|
shadowVerts[i].y = FIXED_TO_FLOAT(slopez) + flip * 0.05f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
shadowVerts[i].y = FIXED_TO_FLOAT(floorz) + 0.05f;
|
shadowVerts[i].y = FIXED_TO_FLOAT(groundz) + flip * 0.05f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->flip)
|
if (spr->flip)
|
||||||
|
@ -3946,7 +3947,7 @@ static void HWR_DrawDropShadow(mobj_t *thing, gr_vissprite_t *spr, fixed_t scale
|
||||||
|
|
||||||
if (thing->subsector->sector->numlights)
|
if (thing->subsector->sector->numlights)
|
||||||
{
|
{
|
||||||
light = R_GetPlaneLight(thing->subsector->sector, floorz, false); // Always use the light at the top instead of whatever I was doing before
|
light = R_GetPlaneLight(thing->subsector->sector, groundz, false); // Always use the light at the top instead of whatever I was doing before
|
||||||
|
|
||||||
if (*thing->subsector->sector->lightlist[light].lightlevel > 255)
|
if (*thing->subsector->sector->lightlist[light].lightlevel > 255)
|
||||||
lightlevel = 255;
|
lightlevel = 255;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -113,7 +113,8 @@ static int lib_fixeddiv(lua_State *L)
|
||||||
|
|
||||||
static int lib_fixedrem(lua_State *L)
|
static int lib_fixedrem(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushfixed(L, FixedRem(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
|
LUA_Deprecated(L, "FixedRem(a, b)", "a % b");
|
||||||
|
lua_pushfixed(L, luaL_checkfixed(L, 1) % luaL_checkfixed(L, 2));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,58 @@ FUNCNORETURN static int LUA_Panic(lua_State *L)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LEVELS1 12 // size of the first part of the stack
|
||||||
|
#define LEVELS2 10 // size of the second part of the stack
|
||||||
|
|
||||||
|
// Error handler used with pcall() when loading scripts or calling hooks
|
||||||
|
// Takes a string with the original error message,
|
||||||
|
// appends the traceback to it, and return the result
|
||||||
|
int LUA_GetErrorMessage(lua_State *L)
|
||||||
|
{
|
||||||
|
int level = 1;
|
||||||
|
int firstpart = 1; // still before eventual `...'
|
||||||
|
lua_Debug ar;
|
||||||
|
|
||||||
|
lua_pushliteral(L, "\nstack traceback:");
|
||||||
|
while (lua_getstack(L, level++, &ar))
|
||||||
|
{
|
||||||
|
if (level > LEVELS1 && firstpart)
|
||||||
|
{
|
||||||
|
// no more than `LEVELS2' more levels?
|
||||||
|
if (!lua_getstack(L, level + LEVELS2, &ar))
|
||||||
|
level--; // keep going
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lua_pushliteral(L, "\n ..."); // too many levels
|
||||||
|
while (lua_getstack(L, level + LEVELS2, &ar)) // find last levels
|
||||||
|
level++;
|
||||||
|
}
|
||||||
|
firstpart = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lua_pushliteral(L, "\n ");
|
||||||
|
lua_getinfo(L, "Snl", &ar);
|
||||||
|
lua_pushfstring(L, "%s:", ar.short_src);
|
||||||
|
if (ar.currentline > 0)
|
||||||
|
lua_pushfstring(L, "%d:", ar.currentline);
|
||||||
|
if (*ar.namewhat != '\0') // is there a name?
|
||||||
|
lua_pushfstring(L, " in function " LUA_QS, ar.name);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*ar.what == 'm') // main?
|
||||||
|
lua_pushfstring(L, " in main chunk");
|
||||||
|
else if (*ar.what == 'C' || *ar.what == 't')
|
||||||
|
lua_pushliteral(L, " ?"); // C function or tail call
|
||||||
|
else
|
||||||
|
lua_pushfstring(L, " in function <%s:%d>",
|
||||||
|
ar.short_src, ar.linedefined);
|
||||||
|
}
|
||||||
|
lua_concat(L, lua_gettop(L));
|
||||||
|
}
|
||||||
|
lua_concat(L, lua_gettop(L));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Moved here from lib_getenum.
|
// Moved here from lib_getenum.
|
||||||
int LUA_PushGlobals(lua_State *L, const char *word)
|
int LUA_PushGlobals(lua_State *L, const char *word)
|
||||||
{
|
{
|
||||||
|
@ -410,11 +462,13 @@ static inline void LUA_LoadFile(MYFILE *f, char *name)
|
||||||
|
|
||||||
lua_lumploading = true; // turn on loading flag
|
lua_lumploading = true; // turn on loading flag
|
||||||
|
|
||||||
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, 0)) {
|
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||||
|
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, lua_gettop(gL) - 1)) {
|
||||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
||||||
lua_pop(gL,1);
|
lua_pop(gL,1);
|
||||||
}
|
}
|
||||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
lua_gc(gL, LUA_GCCOLLECT, 0);
|
||||||
|
lua_pop(gL, 1); // Pop error handler
|
||||||
|
|
||||||
lua_lumploading = false; // turn off again
|
lua_lumploading = false; // turn off again
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ void LUA_ClearExtVars(void);
|
||||||
|
|
||||||
extern boolean lua_lumploading; // is LUA_LoadLump being called?
|
extern boolean lua_lumploading; // is LUA_LoadLump being called?
|
||||||
|
|
||||||
|
int LUA_GetErrorMessage(lua_State *L);
|
||||||
void LUA_LoadLump(UINT16 wad, UINT16 lump);
|
void LUA_LoadLump(UINT16 wad, UINT16 lump);
|
||||||
#ifdef LUA_ALLOW_BYTECODE
|
#ifdef LUA_ALLOW_BYTECODE
|
||||||
void LUA_DumpFile(const char *filename);
|
void LUA_DumpFile(const char *filename);
|
||||||
|
|
|
@ -204,18 +204,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b)
|
||||||
return FixedDiv2(a, b);
|
return FixedDiv2(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief The FixedRem function
|
|
||||||
|
|
||||||
\param x fixed_t number
|
|
||||||
\param y fixed_t number
|
|
||||||
|
|
||||||
\return remainder of dividing x by y
|
|
||||||
*/
|
|
||||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRem(fixed_t x, fixed_t y)
|
|
||||||
{
|
|
||||||
return x % y;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The FixedSqrt function
|
/** \brief The FixedSqrt function
|
||||||
|
|
||||||
\param x fixed_t number
|
\param x fixed_t number
|
||||||
|
|
263
src/p_map.c
263
src/p_map.c
|
@ -3291,9 +3291,128 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
static boolean PTR_LineIsBlocking(line_t *li)
|
||||||
// PTR_SlideTraverse
|
{
|
||||||
//
|
// one-sided linedefs are always solid to sliding movement.
|
||||||
|
if (!li->backsector)
|
||||||
|
return !P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
||||||
|
|
||||||
|
if (!(slidemo->flags & MF_MISSILE))
|
||||||
|
{
|
||||||
|
if (li->flags & ML_IMPASSIBLE)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set openrange, opentop, openbottom
|
||||||
|
P_LineOpening(li, slidemo);
|
||||||
|
|
||||||
|
if (openrange < slidemo->height)
|
||||||
|
return true; // doesn't fit
|
||||||
|
|
||||||
|
if (opentop - slidemo->z < slidemo->height)
|
||||||
|
return true; // mobj is too high
|
||||||
|
|
||||||
|
if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale))
|
||||||
|
return true; // too big a step up
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PTR_GlideClimbTraverse(line_t *li)
|
||||||
|
{
|
||||||
|
line_t *checkline = li;
|
||||||
|
ffloor_t *rover;
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
|
boolean fofline = false;
|
||||||
|
sector_t *checksector = (li->backsector && !P_PointOnLineSide(slidemo->x, slidemo->y, li)) ? li->backsector : li->frontsector;
|
||||||
|
|
||||||
|
if (checksector->ffloors)
|
||||||
|
{
|
||||||
|
for (rover = checksector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
topheight = P_GetFFloorTopZAt (rover, slidemo->x, slidemo->y);
|
||||||
|
bottomheight = P_GetFFloorBottomZAt(rover, slidemo->x, slidemo->y);
|
||||||
|
|
||||||
|
if (topheight < slidemo->z)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (bottomheight > slidemo->z + slidemo->height)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Got this far, so I guess it's climbable. // TODO: Climbing check, also, better method to do this?
|
||||||
|
if (rover->master->flags & ML_TFERLINE)
|
||||||
|
{
|
||||||
|
size_t linenum = li-checksector->lines[0];
|
||||||
|
checkline = rover->master->frontsector->lines[0] + linenum;
|
||||||
|
fofline = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// see about climbing on the wall
|
||||||
|
if (!(checkline->flags & ML_NOCLIMB) && checkline->special != HORIZONSPECIAL)
|
||||||
|
{
|
||||||
|
boolean canclimb;
|
||||||
|
angle_t climbangle, climbline;
|
||||||
|
INT32 whichside = P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
||||||
|
|
||||||
|
climbangle = climbline = R_PointToAngle2(li->v1->x, li->v1->y, li->v2->x, li->v2->y);
|
||||||
|
|
||||||
|
if (whichside) // on second side?
|
||||||
|
climbline += ANGLE_180;
|
||||||
|
|
||||||
|
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
|
||||||
|
|
||||||
|
canclimb = (li->backsector ? P_IsClimbingValid(slidemo->player, climbangle) : true);
|
||||||
|
|
||||||
|
if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|
||||||
|
|| (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135))
|
||||||
|
&& canclimb)
|
||||||
|
{
|
||||||
|
slidemo->angle = climbangle;
|
||||||
|
/*if (!demoplayback || P_ControlStyle(slidemo->player) == CS_LMAOGALOG)
|
||||||
|
{
|
||||||
|
if (slidemo->player == &players[consoleplayer])
|
||||||
|
localangle = slidemo->angle;
|
||||||
|
else if (slidemo->player == &players[secondarydisplayplayer])
|
||||||
|
localangle2 = slidemo->angle;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (!slidemo->player->climbing)
|
||||||
|
{
|
||||||
|
S_StartSound(slidemo->player->mo, sfx_s3k4a);
|
||||||
|
slidemo->player->climbing = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
slidemo->player->pflags &= ~(PF_GLIDING|PF_SPINNING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED);
|
||||||
|
slidemo->player->glidetime = 0;
|
||||||
|
slidemo->player->secondjump = 0;
|
||||||
|
|
||||||
|
if (slidemo->player->climbing > 1)
|
||||||
|
slidemo->momz = slidemo->momx = slidemo->momy = 0;
|
||||||
|
|
||||||
|
if (fofline)
|
||||||
|
whichside = 0;
|
||||||
|
|
||||||
|
if (!whichside)
|
||||||
|
{
|
||||||
|
slidemo->player->lastsidehit = checkline->sidenum[whichside];
|
||||||
|
slidemo->player->lastlinehit = (INT16)(checkline - lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
P_Thrust(slidemo, slidemo->angle, FixedMul(5*FRACUNIT, slidemo->scale));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static boolean PTR_SlideTraverse(intercept_t *in)
|
static boolean PTR_SlideTraverse(intercept_t *in)
|
||||||
{
|
{
|
||||||
line_t *li;
|
line_t *li;
|
||||||
|
@ -3302,146 +3421,20 @@ static boolean PTR_SlideTraverse(intercept_t *in)
|
||||||
|
|
||||||
li = in->d.line;
|
li = in->d.line;
|
||||||
|
|
||||||
// one-sided linedefs are always solid to sliding movement.
|
if (!PTR_LineIsBlocking(li))
|
||||||
// one-sided linedef
|
return true;
|
||||||
if (!li->backsector)
|
|
||||||
{
|
|
||||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
|
||||||
return true; // don't hit the back side
|
|
||||||
goto isblocking;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(slidemo->flags & MF_MISSILE))
|
// the line blocks movement,
|
||||||
{
|
|
||||||
if (li->flags & ML_IMPASSIBLE)
|
|
||||||
goto isblocking;
|
|
||||||
|
|
||||||
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
|
||||||
goto isblocking;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set openrange, opentop, openbottom
|
|
||||||
P_LineOpening(li, slidemo);
|
|
||||||
|
|
||||||
if (openrange < slidemo->height)
|
|
||||||
goto isblocking; // doesn't fit
|
|
||||||
|
|
||||||
if (opentop - slidemo->z < slidemo->height)
|
|
||||||
goto isblocking; // mobj is too high
|
|
||||||
|
|
||||||
if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale))
|
|
||||||
goto isblocking; // too big a step up
|
|
||||||
|
|
||||||
// this line doesn't block movement
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// the line does block movement,
|
|
||||||
// see if it is closer than best so far
|
// see if it is closer than best so far
|
||||||
isblocking:
|
|
||||||
if (li->polyobj && slidemo->player)
|
if (li->polyobj && slidemo->player)
|
||||||
{
|
{
|
||||||
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
|
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
|
||||||
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
|
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slidemo->player && (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing)
|
if (slidemo->player && slidemo->player->charability == CA_GLIDEANDCLIMB
|
||||||
&& slidemo->player->charability == CA_GLIDEANDCLIMB)
|
&& (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing))
|
||||||
{
|
PTR_GlideClimbTraverse(li);
|
||||||
line_t *checkline = li;
|
|
||||||
sector_t *checksector;
|
|
||||||
ffloor_t *rover;
|
|
||||||
fixed_t topheight, bottomheight;
|
|
||||||
boolean fofline = false;
|
|
||||||
INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
|
||||||
|
|
||||||
if (!side && li->backsector)
|
|
||||||
checksector = li->backsector;
|
|
||||||
else
|
|
||||||
checksector = li->frontsector;
|
|
||||||
|
|
||||||
if (checksector->ffloors)
|
|
||||||
{
|
|
||||||
for (rover = checksector->ffloors; rover; rover = rover->next)
|
|
||||||
{
|
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
topheight = P_GetFFloorTopZAt (rover, slidemo->x, slidemo->y);
|
|
||||||
bottomheight = P_GetFFloorBottomZAt(rover, slidemo->x, slidemo->y);
|
|
||||||
|
|
||||||
if (topheight < slidemo->z)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (bottomheight > slidemo->z + slidemo->height)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Got this far, so I guess it's climbable. // TODO: Climbing check, also, better method to do this?
|
|
||||||
if (rover->master->flags & ML_TFERLINE)
|
|
||||||
{
|
|
||||||
size_t linenum = li-checksector->lines[0];
|
|
||||||
checkline = rover->master->frontsector->lines[0] + linenum;
|
|
||||||
fofline = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// see about climbing on the wall
|
|
||||||
if (!(checkline->flags & ML_NOCLIMB) && checkline->special != HORIZONSPECIAL)
|
|
||||||
{
|
|
||||||
boolean canclimb;
|
|
||||||
angle_t climbangle, climbline;
|
|
||||||
INT32 whichside = P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
|
||||||
|
|
||||||
climbangle = climbline = R_PointToAngle2(li->v1->x, li->v1->y, li->v2->x, li->v2->y);
|
|
||||||
|
|
||||||
if (whichside) // on second side?
|
|
||||||
climbline += ANGLE_180;
|
|
||||||
|
|
||||||
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
|
|
||||||
|
|
||||||
canclimb = (li->backsector ? P_IsClimbingValid(slidemo->player, climbangle) : true);
|
|
||||||
|
|
||||||
if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|
|
||||||
|| (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135))
|
|
||||||
&& canclimb)
|
|
||||||
{
|
|
||||||
slidemo->angle = climbangle;
|
|
||||||
/*if (!demoplayback || P_ControlStyle(slidemo->player) == CS_LMAOGALOG)
|
|
||||||
{
|
|
||||||
if (slidemo->player == &players[consoleplayer])
|
|
||||||
localangle = slidemo->angle;
|
|
||||||
else if (slidemo->player == &players[secondarydisplayplayer])
|
|
||||||
localangle2 = slidemo->angle;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (!slidemo->player->climbing)
|
|
||||||
{
|
|
||||||
S_StartSound(slidemo->player->mo, sfx_s3k4a);
|
|
||||||
slidemo->player->climbing = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
slidemo->player->pflags &= ~(PF_GLIDING|PF_SPINNING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED);
|
|
||||||
slidemo->player->glidetime = 0;
|
|
||||||
slidemo->player->secondjump = 0;
|
|
||||||
|
|
||||||
if (slidemo->player->climbing > 1)
|
|
||||||
slidemo->momz = slidemo->momx = slidemo->momy = 0;
|
|
||||||
|
|
||||||
if (fofline)
|
|
||||||
whichside = 0;
|
|
||||||
|
|
||||||
if (!whichside)
|
|
||||||
{
|
|
||||||
slidemo->player->lastsidehit = checkline->sidenum[whichside];
|
|
||||||
slidemo->player->lastlinehit = (INT16)(checkline - lines);
|
|
||||||
}
|
|
||||||
|
|
||||||
P_Thrust(slidemo, slidemo->angle, FixedMul(5*FRACUNIT, slidemo->scale));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing))
|
if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing))
|
||||||
{
|
{
|
||||||
|
|
481
src/p_mobj.c
481
src/p_mobj.c
|
@ -1669,70 +1669,74 @@ static void P_PushableCheckBustables(mobj_t *mo)
|
||||||
|
|
||||||
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
{
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (!node->m_sector)
|
if (!node->m_sector)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (node->m_sector->ffloors)
|
if (!node->m_sector->ffloors)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
if (!(rover->flags & FF_EXISTS))
|
||||||
fixed_t topheight, bottomheight;
|
continue;
|
||||||
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
if (!(rover->flags & FF_BUSTUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Needs ML_EFFECT4 flag for pushables to break it
|
||||||
|
if (!(rover->master->flags & ML_EFFECT4))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (rover->master->frontsector->crumblestate != CRUMBLE_NONE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
||||||
|
bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
||||||
|
|
||||||
|
// Height checks
|
||||||
|
if (rover->flags & FF_SHATTERBOTTOM)
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS)) continue;
|
if (mo->z + mo->momz + mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!(rover->flags & FF_BUSTUP)) continue;
|
if (mo->z + mo->height > bottomheight)
|
||||||
|
continue;
|
||||||
// Needs ML_EFFECT4 flag for pushables to break it
|
|
||||||
if (!(rover->master->flags & ML_EFFECT4)) continue;
|
|
||||||
|
|
||||||
if (rover->master->frontsector->crumblestate == CRUMBLE_NONE)
|
|
||||||
{
|
|
||||||
topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
|
||||||
bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
|
||||||
// Height checks
|
|
||||||
if (rover->flags & FF_SHATTERBOTTOM)
|
|
||||||
{
|
|
||||||
if (mo->z+mo->momz + mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (mo->z+mo->height > bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (rover->flags & FF_SPINBUST)
|
|
||||||
{
|
|
||||||
if (mo->z+mo->momz > topheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (mo->z+mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (rover->flags & FF_SHATTER)
|
|
||||||
{
|
|
||||||
if (mo->z+mo->momz > topheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (mo->z+mo->momz + mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mo->z >= topheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (mo->z+mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
EV_CrumbleChain(NULL, rover); // node->m_sector
|
|
||||||
|
|
||||||
// Run a linedef executor??
|
|
||||||
if (rover->master->flags & ML_EFFECT5)
|
|
||||||
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector);
|
|
||||||
|
|
||||||
goto bustupdone;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (rover->flags & FF_SPINBUST)
|
||||||
|
{
|
||||||
|
if (mo->z + mo->momz > topheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mo->z + mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (rover->flags & FF_SHATTER)
|
||||||
|
{
|
||||||
|
if (mo->z + mo->momz > topheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mo->z + mo->momz + mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mo->z >= topheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mo->z + mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
EV_CrumbleChain(NULL, rover); // node->m_sector
|
||||||
|
|
||||||
|
// Run a linedef executor??
|
||||||
|
if (rover->master->flags & ML_EFFECT5)
|
||||||
|
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector);
|
||||||
|
|
||||||
|
goto bustupdone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bustupdone:
|
bustupdone:
|
||||||
|
@ -2793,6 +2797,94 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for "Mario" blocks to hit and bounce them
|
||||||
|
static void P_CheckMarioBlocks(mobj_t *mo)
|
||||||
|
{
|
||||||
|
msecnode_t *node;
|
||||||
|
|
||||||
|
if (netgame && mo->player->spectator)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
|
||||||
|
if (!node->m_sector->ffloors)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!(rover->flags & FF_MARIO))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
|
continue; // if you were flipped, your head isn't actually hitting your ceilingz is it?
|
||||||
|
|
||||||
|
if (*rover->bottomheight != mo->ceilingz)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (rover->flags & FF_SHATTERBOTTOM) // Brick block!
|
||||||
|
EV_CrumbleChain(node->m_sector, rover);
|
||||||
|
else // Question block!
|
||||||
|
EV_MarioBlock(rover, node->m_sector, mo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we're on a polyobject that triggers a linedef executor.
|
||||||
|
static boolean P_PlayerPolyObjectZMovement(mobj_t *mo)
|
||||||
|
{
|
||||||
|
msecnode_t *node;
|
||||||
|
boolean stopmovecut = false;
|
||||||
|
|
||||||
|
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
|
{
|
||||||
|
sector_t *sec = node->m_sector;
|
||||||
|
subsector_t *newsubsec;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < numsubsectors; i++)
|
||||||
|
{
|
||||||
|
polyobj_t *po;
|
||||||
|
sector_t *polysec;
|
||||||
|
newsubsec = &subsectors[i];
|
||||||
|
|
||||||
|
if (newsubsec->sector != sec)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (po = newsubsec->polyList; po; po = (polyobj_t *)(po->link.next))
|
||||||
|
{
|
||||||
|
if (!(po->flags & POF_SOLID))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!P_MobjInsidePolyobj(po, mo))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
polysec = po->lines[0]->backsector;
|
||||||
|
|
||||||
|
// Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red
|
||||||
|
if ((mo->z == polysec->ceilingheight || mo->z + mo->height == polysec->floorheight) && po->thinker)
|
||||||
|
stopmovecut = true;
|
||||||
|
|
||||||
|
if (!(po->flags & POF_LDEXEC))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mo->z != polysec->ceilingheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// We're landing on a PO, so check for a linedef executor.
|
||||||
|
// Trigger tags are 32000 + the PO's ID number.
|
||||||
|
P_LinedefExecute((INT16)(32000 + po->id), mo, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stopmovecut;
|
||||||
|
}
|
||||||
|
|
||||||
static void P_PlayerZMovement(mobj_t *mo)
|
static void P_PlayerZMovement(mobj_t *mo)
|
||||||
{
|
{
|
||||||
boolean onground;
|
boolean onground;
|
||||||
|
@ -2889,68 +2981,10 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||||
|
|
||||||
mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack
|
mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack
|
||||||
|
|
||||||
{
|
|
||||||
// Check if we're on a polyobject
|
|
||||||
// that triggers a linedef executor.
|
|
||||||
msecnode_t *node;
|
|
||||||
boolean stopmovecut = false;
|
|
||||||
|
|
||||||
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
|
||||||
{
|
|
||||||
sector_t *sec = node->m_sector;
|
|
||||||
subsector_t *newsubsec;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < numsubsectors; i++)
|
|
||||||
{
|
|
||||||
newsubsec = &subsectors[i];
|
|
||||||
|
|
||||||
if (newsubsec->sector != sec)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (newsubsec->polyList)
|
|
||||||
{
|
|
||||||
polyobj_t *po = newsubsec->polyList;
|
|
||||||
sector_t *polysec;
|
|
||||||
|
|
||||||
while(po)
|
|
||||||
{
|
|
||||||
if (!P_MobjInsidePolyobj(po, mo) || !(po->flags & POF_SOLID))
|
|
||||||
{
|
|
||||||
po = (polyobj_t *)(po->link.next);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We're inside it! Yess...
|
|
||||||
polysec = po->lines[0]->backsector;
|
|
||||||
|
|
||||||
// Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red
|
|
||||||
if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker)
|
|
||||||
stopmovecut = true;
|
|
||||||
|
|
||||||
if (!(po->flags & POF_LDEXEC))
|
|
||||||
{
|
|
||||||
po = (polyobj_t *)(po->link.next);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mo->z == polysec->ceilingheight)
|
|
||||||
{
|
|
||||||
// We're landing on a PO, so check for
|
|
||||||
// a linedef executor.
|
|
||||||
// Trigger tags are 32000 + the PO's ID number.
|
|
||||||
P_LinedefExecute((INT16)(32000 + po->id), mo, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
po = (polyobj_t *)(po->link.next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
clipmomz = P_PlayerHitFloor(mo->player, true);
|
clipmomz = P_PlayerHitFloor(mo->player, true);
|
||||||
|
|
||||||
if (!stopmovecut)
|
if (!P_PlayerPolyObjectZMovement(mo))
|
||||||
|
{
|
||||||
// Cut momentum in half when you hit the ground and
|
// Cut momentum in half when you hit the ground and
|
||||||
// aren't pressing any controls.
|
// aren't pressing any controls.
|
||||||
if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING))
|
if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING))
|
||||||
|
@ -3014,39 +3048,10 @@ nightsdone:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for "Mario" blocks to hit and bounce them
|
|
||||||
if (P_MobjFlip(mo)*mo->momz > 0)
|
if (P_MobjFlip(mo)*mo->momz > 0)
|
||||||
{
|
{
|
||||||
msecnode_t *node;
|
if (CheckForMarioBlocks)
|
||||||
|
P_CheckMarioBlocks(mo);
|
||||||
if (CheckForMarioBlocks && !(netgame && mo->player->spectator)) // Only let the player punch
|
|
||||||
{
|
|
||||||
// Search the touching sectors, from side-to-side...
|
|
||||||
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
|
||||||
{
|
|
||||||
ffloor_t *rover;
|
|
||||||
if (!node->m_sector->ffloors)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
|
||||||
{
|
|
||||||
if (!(rover->flags & FF_EXISTS))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Come on, it's time to go...
|
|
||||||
if (rover->flags & FF_MARIO
|
|
||||||
&& !(mo->eflags & MFE_VERTICALFLIP) // if you were flipped, your head isn't actually hitting your ceilingz is it?
|
|
||||||
&& *rover->bottomheight == mo->ceilingz) // The player's head hit the bottom!
|
|
||||||
{
|
|
||||||
// DO THE MARIO!
|
|
||||||
if (rover->flags & FF_SHATTERBOTTOM) // Brick block!
|
|
||||||
EV_CrumbleChain(node->m_sector, rover);
|
|
||||||
else // Question block!
|
|
||||||
EV_MarioBlock(rover, node->m_sector, mo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // Ugly ugly billions of braces! Argh!
|
|
||||||
}
|
|
||||||
|
|
||||||
// hit the ceiling
|
// hit the ceiling
|
||||||
if (mariomode)
|
if (mariomode)
|
||||||
|
@ -3750,13 +3755,114 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
static void P_CheckCrumblingPlatforms(mobj_t *mobj)
|
||||||
// P_PlayerMobjThinker
|
|
||||||
//
|
|
||||||
static void P_PlayerMobjThinker(mobj_t *mobj)
|
|
||||||
{
|
{
|
||||||
msecnode_t *node;
|
msecnode_t *node;
|
||||||
|
|
||||||
|
if (netgame && mobj->player->spectator)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
|
||||||
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!(rover->flags & FF_CRUMBLE))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||||
|
{
|
||||||
|
if (P_GetSpecialBottomZ(mobj, sectors + rover->secnum, node->m_sector) != mobj->z + mobj->height)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (P_GetSpecialTopZ(mobj, sectors + rover->secnum, node->m_sector) != mobj->z)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), mobj->player, rover->alpha, !(rover->flags & FF_NORETURN));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean P_MobjTouchesSectorWithWater(mobj_t *mobj)
|
||||||
|
{
|
||||||
|
msecnode_t *node;
|
||||||
|
|
||||||
|
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
|
||||||
|
if (!node->m_sector->ffloors)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!(rover->flags & FF_SWIMMABLE))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for floating water platforms and bounce them
|
||||||
|
static void P_CheckFloatbobPlatforms(mobj_t *mobj)
|
||||||
|
{
|
||||||
|
msecnode_t *node;
|
||||||
|
|
||||||
|
// Can't land on anything if you're not moving downwards
|
||||||
|
if (P_MobjFlip(mobj)*mobj->momz >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!P_MobjTouchesSectorWithWater(mobj))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
|
||||||
|
if (!node->m_sector->ffloors)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!(rover->flags & FF_FLOATBOB))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||||
|
{
|
||||||
|
if (abs(*rover->bottomheight - (mobj->z + mobj->height)) > abs(mobj->momz))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (abs(*rover->topheight - mobj->z) > abs(mobj->momz))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initiate a 'bouncy' elevator function which slowly diminishes.
|
||||||
|
EV_BounceSector(rover->master->frontsector, -mobj->momz, rover->master);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||||
|
{
|
||||||
I_Assert(mobj != NULL);
|
I_Assert(mobj != NULL);
|
||||||
I_Assert(mobj->player != NULL);
|
I_Assert(mobj->player != NULL);
|
||||||
I_Assert(!P_MobjWasRemoved(mobj));
|
I_Assert(!P_MobjWasRemoved(mobj));
|
||||||
|
@ -3809,77 +3915,10 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||||
else
|
else
|
||||||
P_TryMove(mobj, mobj->x, mobj->y, true);
|
P_TryMove(mobj, mobj->x, mobj->y, true);
|
||||||
|
|
||||||
if (!(netgame && mobj->player->spectator))
|
P_CheckCrumblingPlatforms(mobj);
|
||||||
{
|
|
||||||
// Crumbling platforms
|
|
||||||
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
|
||||||
{
|
|
||||||
fixed_t topheight, bottomheight;
|
|
||||||
ffloor_t *rover;
|
|
||||||
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
if (CheckForFloatBob)
|
||||||
{
|
P_CheckFloatbobPlatforms(mobj);
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_CRUMBLE))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
topheight = P_GetSpecialTopZ(mobj, sectors + rover->secnum, node->m_sector);
|
|
||||||
bottomheight = P_GetSpecialBottomZ(mobj, sectors + rover->secnum, node->m_sector);
|
|
||||||
|
|
||||||
if ((topheight == mobj->z && !(mobj->eflags & MFE_VERTICALFLIP))
|
|
||||||
|| (bottomheight == mobj->z + mobj->height && mobj->eflags & MFE_VERTICALFLIP)) // You nut.
|
|
||||||
EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), mobj->player, rover->alpha, !(rover->flags & FF_NORETURN));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for floating water platforms and bounce them
|
|
||||||
if (CheckForFloatBob && P_MobjFlip(mobj)*mobj->momz < 0)
|
|
||||||
{
|
|
||||||
boolean thereiswater = false;
|
|
||||||
|
|
||||||
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
|
||||||
{
|
|
||||||
if (node->m_sector->ffloors)
|
|
||||||
{
|
|
||||||
ffloor_t *rover;
|
|
||||||
// Get water boundaries first
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
|
||||||
{
|
|
||||||
if (!(rover->flags & FF_EXISTS))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (rover->flags & FF_SWIMMABLE) // Is there water?
|
|
||||||
{
|
|
||||||
thereiswater = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (thereiswater)
|
|
||||||
{
|
|
||||||
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
|
|
||||||
{
|
|
||||||
if (node->m_sector->ffloors)
|
|
||||||
{
|
|
||||||
ffloor_t *rover;
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
|
||||||
{
|
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_FLOATBOB))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((!(mobj->eflags & MFE_VERTICALFLIP) && abs(*rover->topheight-mobj->z) <= abs(mobj->momz)) // The player is landing on the cheese!
|
|
||||||
|| (mobj->eflags & MFE_VERTICALFLIP && abs(*rover->bottomheight-(mobj->z+mobj->height)) <= abs(mobj->momz)))
|
|
||||||
{
|
|
||||||
// Initiate a 'bouncy' elevator function
|
|
||||||
// which slowly diminishes.
|
|
||||||
EV_BounceSector(rover->master->frontsector, -mobj->momz, rover->master);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // Ugly ugly billions of braces! Argh!
|
|
||||||
}
|
|
||||||
|
|
||||||
// always do the gravity bit now, that's simpler
|
// always do the gravity bit now, that's simpler
|
||||||
// BUT CheckPosition only if wasn't done before.
|
// BUT CheckPosition only if wasn't done before.
|
||||||
|
|
|
@ -240,6 +240,9 @@ static void Polyobj_GetInfo(polyobj_t *po)
|
||||||
/*if (lines[i].flags & ML_EFFECT5)
|
/*if (lines[i].flags & ML_EFFECT5)
|
||||||
po->flags &= ~POF_CLIPPLANES;*/
|
po->flags &= ~POF_CLIPPLANES;*/
|
||||||
|
|
||||||
|
if (lines[i].flags & ML_EFFECT6)
|
||||||
|
po->flags |= POF_SPLAT;
|
||||||
|
|
||||||
if (lines[i].flags & ML_NOCLIMB) // Has a linedef executor
|
if (lines[i].flags & ML_NOCLIMB) // Has a linedef executor
|
||||||
po->flags |= POF_LDEXEC;
|
po->flags |= POF_LDEXEC;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef enum
|
||||||
POF_SOLID = 0x3, ///< Clips things.
|
POF_SOLID = 0x3, ///< Clips things.
|
||||||
POF_TESTHEIGHT = 0x4, ///< Test line collision with heights
|
POF_TESTHEIGHT = 0x4, ///< Test line collision with heights
|
||||||
POF_RENDERSIDES = 0x8, ///< Renders the sides.
|
POF_RENDERSIDES = 0x8, ///< Renders the sides.
|
||||||
POF_RENDERTOP = 0x10, ///< Renders the top..
|
POF_RENDERTOP = 0x10, ///< Renders the top.
|
||||||
POF_RENDERBOTTOM = 0x20, ///< Renders the bottom.
|
POF_RENDERBOTTOM = 0x20, ///< Renders the bottom.
|
||||||
POF_RENDERPLANES = 0x30, ///< Renders top and bottom.
|
POF_RENDERPLANES = 0x30, ///< Renders top and bottom.
|
||||||
POF_RENDERALL = 0x38, ///< Renders everything.
|
POF_RENDERALL = 0x38, ///< Renders everything.
|
||||||
|
@ -49,6 +49,7 @@ typedef enum
|
||||||
POF_LDEXEC = 0x400, ///< This PO triggers a linedef executor.
|
POF_LDEXEC = 0x400, ///< This PO triggers a linedef executor.
|
||||||
POF_ONESIDE = 0x800, ///< Only use the first side of the linedef.
|
POF_ONESIDE = 0x800, ///< Only use the first side of the linedef.
|
||||||
POF_NOSPECIALS = 0x1000, ///< Don't apply sector specials.
|
POF_NOSPECIALS = 0x1000, ///< Don't apply sector specials.
|
||||||
|
POF_SPLAT = 0x2000, ///< Use splat flat renderer (treat cyan pixels as invisible).
|
||||||
} polyobjflags_e;
|
} polyobjflags_e;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -717,6 +717,34 @@ static void P_NetUnArchiveColormaps(void)
|
||||||
net_colormaps = NULL;
|
net_colormaps = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void P_NetArchiveWaypoints(void)
|
||||||
|
{
|
||||||
|
INT32 i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < NUMWAYPOINTSEQUENCES; i++)
|
||||||
|
{
|
||||||
|
WRITEUINT16(save_p, numwaypoints[i]);
|
||||||
|
for (j = 0; j < numwaypoints[i]; j++)
|
||||||
|
WRITEUINT32(save_p, waypoints[i][j] ? waypoints[i][j]->mobjnum : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void P_NetUnArchiveWaypoints(void)
|
||||||
|
{
|
||||||
|
INT32 i, j;
|
||||||
|
UINT32 mobjnum;
|
||||||
|
|
||||||
|
for (i = 0; i < NUMWAYPOINTSEQUENCES; i++)
|
||||||
|
{
|
||||||
|
numwaypoints[i] = READUINT16(save_p);
|
||||||
|
for (j = 0; j < numwaypoints[i]; j++)
|
||||||
|
{
|
||||||
|
mobjnum = READUINT32(save_p);
|
||||||
|
waypoints[i][j] = (mobjnum == 0) ? NULL : P_FindNewPosition(mobjnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// World Archiving
|
/// World Archiving
|
||||||
///
|
///
|
||||||
|
@ -1995,6 +2023,7 @@ static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type)
|
||||||
WRITEINT32(save_p, ht->polyObjNum);
|
WRITEINT32(save_p, ht->polyObjNum);
|
||||||
WRITEINT32(save_p, ht->speed);
|
WRITEINT32(save_p, ht->speed);
|
||||||
WRITEINT32(save_p, ht->distance);
|
WRITEINT32(save_p, ht->distance);
|
||||||
|
WRITEUINT8(save_p, ht->turnobjs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SavePolymoveThinker(const thinker_t *th, const UINT8 type)
|
static void SavePolymoveThinker(const thinker_t *th, const UINT8 type)
|
||||||
|
@ -3127,6 +3156,7 @@ static inline thinker_t* LoadPolyrotatetThinker(actionf_p1 thinker)
|
||||||
ht->polyObjNum = READINT32(save_p);
|
ht->polyObjNum = READINT32(save_p);
|
||||||
ht->speed = READINT32(save_p);
|
ht->speed = READINT32(save_p);
|
||||||
ht->distance = READINT32(save_p);
|
ht->distance = READINT32(save_p);
|
||||||
|
ht->turnobjs = READUINT8(save_p);
|
||||||
return &ht->thinker;
|
return &ht->thinker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4042,6 +4072,7 @@ void P_SaveNetGame(void)
|
||||||
P_NetArchiveThinkers();
|
P_NetArchiveThinkers();
|
||||||
P_NetArchiveSpecials();
|
P_NetArchiveSpecials();
|
||||||
P_NetArchiveColormaps();
|
P_NetArchiveColormaps();
|
||||||
|
P_NetArchiveWaypoints();
|
||||||
}
|
}
|
||||||
LUA_Archive();
|
LUA_Archive();
|
||||||
|
|
||||||
|
@ -4080,6 +4111,7 @@ boolean P_LoadNetGame(void)
|
||||||
P_NetUnArchiveThinkers();
|
P_NetUnArchiveThinkers();
|
||||||
P_NetUnArchiveSpecials();
|
P_NetUnArchiveSpecials();
|
||||||
P_NetUnArchiveColormaps();
|
P_NetUnArchiveColormaps();
|
||||||
|
P_NetUnArchiveWaypoints();
|
||||||
P_RelinkPointers();
|
P_RelinkPointers();
|
||||||
P_FinishMobjs();
|
P_FinishMobjs();
|
||||||
}
|
}
|
||||||
|
|
441
src/p_user.c
441
src/p_user.c
|
@ -2521,6 +2521,72 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
|
||||||
return false; // No sand here, Captain!
|
return false; // No sand here, Captain!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean P_PlayerCanBust(player_t *player, ffloor_t *rover)
|
||||||
|
{
|
||||||
|
if (!(rover->flags & FF_EXISTS))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(rover->flags & FF_BUSTUP))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/*if (rover->master->frontsector->crumblestate != CRUMBLE_NONE)
|
||||||
|
return false;*/
|
||||||
|
|
||||||
|
// If it's an FF_SHATTER, you can break it just by touching it.
|
||||||
|
if (rover->flags & FF_SHATTER)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// If it's an FF_SPINBUST, you can break it if you are in your spinning frames
|
||||||
|
// (either from jumping or spindashing).
|
||||||
|
if (rover->flags & FF_SPINBUST)
|
||||||
|
{
|
||||||
|
if ((player->pflags & PF_SPINNING) && !(player->pflags & PF_STARTDASH))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ((player->pflags & PF_JUMPED) && !(player->pflags & PF_NOJUMPDAMAGE))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strong abilities can break even FF_STRONGBUST.
|
||||||
|
if (player->charability == CA_GLIDEANDCLIMB)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (player->pflags & PF_BOUNCING)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Everyone else is out of luck.
|
||||||
|
if (rover->flags & FF_STRONGBUST)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Spinning (and not jumping)
|
||||||
|
if ((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Super
|
||||||
|
if (player->powers[pw_super])
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Dashmode
|
||||||
|
if ((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE) && player->dashmode >= DASHMODE_THRESHOLD)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// NiGHTS drill
|
||||||
|
if (player->pflags & PF_DRILLING)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Recording for Metal Sonic
|
||||||
|
if (metalrecording)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void P_CheckBustableBlocks(player_t *player)
|
static void P_CheckBustableBlocks(player_t *player)
|
||||||
{
|
{
|
||||||
msecnode_t *node;
|
msecnode_t *node;
|
||||||
|
@ -2543,121 +2609,83 @@ static void P_CheckBustableBlocks(player_t *player)
|
||||||
|
|
||||||
for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
{
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (!node->m_sector)
|
if (!node->m_sector)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (node->m_sector->ffloors)
|
if (!node->m_sector->ffloors)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
if (!P_PlayerCanBust(player, rover))
|
||||||
fixed_t topheight, bottomheight;
|
continue;
|
||||||
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||||
|
bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||||
|
|
||||||
|
if (((player->charability == CA_TWINSPIN) && (player->panim == PA_ABILITY))
|
||||||
|
|| ((P_MobjFlip(player->mo)*player->mo->momz < 0) && (player->pflags & PF_BOUNCING || ((player->charability2 == CA2_MELEE) && (player->panim == PA_ABILITY2)))))
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS)) continue;
|
topheight -= player->mo->momz;
|
||||||
|
bottomheight -= player->mo->momz;
|
||||||
if ((rover->flags & FF_BUSTUP)/* && rover->master->frontsector->crumblestate == CRUMBLE_NONE*/)
|
|
||||||
{
|
|
||||||
// If it's an FF_SHATTER, you can break it just by touching it.
|
|
||||||
if (rover->flags & FF_SHATTER)
|
|
||||||
goto bust;
|
|
||||||
|
|
||||||
// If it's an FF_SPINBUST, you can break it if you are in your spinning frames
|
|
||||||
// (either from jumping or spindashing).
|
|
||||||
if (rover->flags & FF_SPINBUST
|
|
||||||
&& (((player->pflags & PF_SPINNING) && !(player->pflags & PF_STARTDASH))
|
|
||||||
|| (player->pflags & PF_JUMPED && !(player->pflags & PF_NOJUMPDAMAGE))))
|
|
||||||
goto bust;
|
|
||||||
|
|
||||||
// You can always break it if you have CA_GLIDEANDCLIMB
|
|
||||||
// or if you are bouncing on it
|
|
||||||
// or you are using CA_TWINSPIN/CA2_MELEE.
|
|
||||||
if (player->charability == CA_GLIDEANDCLIMB
|
|
||||||
|| (player->pflags & PF_BOUNCING)
|
|
||||||
|| ((player->charability == CA_TWINSPIN) && (player->panim == PA_ABILITY))
|
|
||||||
|| (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2))
|
|
||||||
goto bust;
|
|
||||||
|
|
||||||
if (rover->flags & FF_STRONGBUST)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// If it's not an FF_STRONGBUST, you can break if you are spinning (and not jumping)
|
|
||||||
// or you are super
|
|
||||||
// or you are in dashmode with SF_DASHMODE
|
|
||||||
// or you are drilling in NiGHTS
|
|
||||||
// or you are recording for Metal Sonic
|
|
||||||
if (!((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED))
|
|
||||||
&& !(player->powers[pw_super])
|
|
||||||
&& !(((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)) && (player->dashmode >= DASHMODE_THRESHOLD))
|
|
||||||
&& !(player->pflags & PF_DRILLING)
|
|
||||||
&& !metalrecording)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bust:
|
|
||||||
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
|
||||||
bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
|
||||||
|
|
||||||
if (((player->charability == CA_TWINSPIN) && (player->panim == PA_ABILITY))
|
|
||||||
|| ((P_MobjFlip(player->mo)*player->mo->momz < 0) && (player->pflags & PF_BOUNCING || ((player->charability2 == CA2_MELEE) && (player->panim == PA_ABILITY2)))))
|
|
||||||
{
|
|
||||||
topheight -= player->mo->momz;
|
|
||||||
bottomheight -= player->mo->momz;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Height checks
|
|
||||||
if (rover->flags & FF_SHATTERBOTTOM)
|
|
||||||
{
|
|
||||||
if (player->mo->z+player->mo->momz + player->mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (player->mo->z+player->mo->height > bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (rover->flags & FF_SPINBUST)
|
|
||||||
{
|
|
||||||
if (player->mo->z+player->mo->momz > topheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (player->mo->z + player->mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (rover->flags & FF_SHATTER)
|
|
||||||
{
|
|
||||||
if (player->mo->z + player->mo->momz > topheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (player->mo->z+player->mo->momz + player->mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (player->mo->z >= topheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (player->mo->z + player->mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Impede the player's fall a bit
|
|
||||||
if (((rover->flags & FF_SPINBUST) || (rover->flags & FF_SHATTER)) && player->mo->z >= topheight)
|
|
||||||
player->mo->momz >>= 1;
|
|
||||||
else if (rover->flags & FF_SHATTER)
|
|
||||||
{
|
|
||||||
player->mo->momx >>= 1;
|
|
||||||
player->mo->momy >>= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (metalrecording)
|
|
||||||
// G_RecordBustup(rover);
|
|
||||||
|
|
||||||
EV_CrumbleChain(NULL, rover); // node->m_sector
|
|
||||||
|
|
||||||
// Run a linedef executor??
|
|
||||||
if (rover->master->flags & ML_EFFECT5)
|
|
||||||
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector);
|
|
||||||
|
|
||||||
goto bustupdone;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Height checks
|
||||||
|
if (rover->flags & FF_SHATTERBOTTOM)
|
||||||
|
{
|
||||||
|
if (player->mo->z + player->mo->momz + player->mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (player->mo->z + player->mo->height > bottomheight)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (rover->flags & FF_SPINBUST)
|
||||||
|
{
|
||||||
|
if (player->mo->z + player->mo->momz > topheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (player->mo->z + player->mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (rover->flags & FF_SHATTER)
|
||||||
|
{
|
||||||
|
if (player->mo->z + player->mo->momz > topheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (player->mo->z + player->mo->momz + player->mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (player->mo->z >= topheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (player->mo->z + player->mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Impede the player's fall a bit
|
||||||
|
if (((rover->flags & FF_SPINBUST) || (rover->flags & FF_SHATTER)) && player->mo->z >= topheight)
|
||||||
|
player->mo->momz >>= 1;
|
||||||
|
else if (rover->flags & FF_SHATTER)
|
||||||
|
{
|
||||||
|
player->mo->momx >>= 1;
|
||||||
|
player->mo->momy >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (metalrecording)
|
||||||
|
// G_RecordBustup(rover);
|
||||||
|
|
||||||
|
EV_CrumbleChain(NULL, rover); // node->m_sector
|
||||||
|
|
||||||
|
// Run a linedef executor??
|
||||||
|
if (rover->master->flags & ML_EFFECT5)
|
||||||
|
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector);
|
||||||
|
|
||||||
|
goto bustupdone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bustupdone:
|
bustupdone:
|
||||||
|
@ -2690,122 +2718,109 @@ static void P_CheckBouncySectors(player_t *player)
|
||||||
|
|
||||||
for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
{
|
{
|
||||||
|
ffloor_t *rover;
|
||||||
|
|
||||||
if (!node->m_sector)
|
if (!node->m_sector)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (node->m_sector->ffloors)
|
if (!node->m_sector->ffloors)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
fixed_t bouncestrength;
|
||||||
boolean top = true;
|
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
if (!(rover->flags & FF_EXISTS))
|
||||||
|
continue; // FOFs should not be bouncy if they don't even "exist"
|
||||||
|
|
||||||
|
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != 15)
|
||||||
|
continue; // this sector type is required for FOFs to be bouncy
|
||||||
|
|
||||||
|
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||||
|
bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||||
|
|
||||||
|
if (player->mo->z > topheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (player->mo->z + player->mo->height < bottomheight)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bouncestrength = P_AproxDistance(rover->master->dx, rover->master->dy)/100;
|
||||||
|
|
||||||
|
if (oldz < P_GetFOFTopZ(player->mo, node->m_sector, rover, oldx, oldy, NULL)
|
||||||
|
&& oldz + player->mo->height > P_GetFOFBottomZ(player->mo, node->m_sector, rover, oldx, oldy, NULL))
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS))
|
player->mo->momx = -FixedMul(player->mo->momx,bouncestrength);
|
||||||
continue; // FOFs should not be bouncy if they don't even "exist"
|
player->mo->momy = -FixedMul(player->mo->momy,bouncestrength);
|
||||||
|
|
||||||
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != 15)
|
|
||||||
continue; // this sector type is required for FOFs to be bouncy
|
|
||||||
|
|
||||||
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
|
||||||
bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
|
||||||
|
|
||||||
if (player->mo->z > topheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (player->mo->z + player->mo->height < bottomheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (oldz < P_GetFOFTopZ(player->mo, node->m_sector, rover, oldx, oldy, NULL)
|
|
||||||
&& oldz + player->mo->height > P_GetFOFBottomZ(player->mo, node->m_sector, rover, oldx, oldy, NULL))
|
|
||||||
top = false;
|
|
||||||
|
|
||||||
|
if (player->pflags & PF_SPINNING)
|
||||||
{
|
{
|
||||||
fixed_t linedist;
|
player->pflags &= ~PF_SPINNING;
|
||||||
|
player->pflags |= P_GetJumpFlags(player);
|
||||||
linedist = P_AproxDistance(rover->master->v1->x-rover->master->v2->x, rover->master->v1->y-rover->master->v2->y);
|
player->pflags |= PF_THOKKED;
|
||||||
|
|
||||||
linedist = FixedDiv(linedist,100*FRACUNIT);
|
|
||||||
|
|
||||||
if (top)
|
|
||||||
{
|
|
||||||
fixed_t newmom;
|
|
||||||
|
|
||||||
pslope_t *slope;
|
|
||||||
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
|
|
||||||
slope = *rover->t_slope;
|
|
||||||
} else { // Hit bottom
|
|
||||||
slope = *rover->b_slope;
|
|
||||||
}
|
|
||||||
|
|
||||||
momentum.x = player->mo->momx;
|
|
||||||
momentum.y = player->mo->momy;
|
|
||||||
momentum.z = player->mo->momz*2;
|
|
||||||
|
|
||||||
if (slope)
|
|
||||||
P_ReverseQuantizeMomentumToSlope(&momentum, slope);
|
|
||||||
|
|
||||||
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
|
|
||||||
|
|
||||||
if (abs(newmom) < (linedist*2))
|
|
||||||
{
|
|
||||||
goto bouncydone;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(rover->master->flags & ML_BOUNCY))
|
|
||||||
{
|
|
||||||
if (newmom > 0)
|
|
||||||
{
|
|
||||||
if (newmom < 8*FRACUNIT)
|
|
||||||
newmom = 8*FRACUNIT;
|
|
||||||
}
|
|
||||||
else if (newmom > -8*FRACUNIT && newmom != 0)
|
|
||||||
newmom = -8*FRACUNIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newmom > P_GetPlayerHeight(player)/2)
|
|
||||||
newmom = P_GetPlayerHeight(player)/2;
|
|
||||||
else if (newmom < -P_GetPlayerHeight(player)/2)
|
|
||||||
newmom = -P_GetPlayerHeight(player)/2;
|
|
||||||
|
|
||||||
momentum.z = newmom*2;
|
|
||||||
|
|
||||||
if (slope)
|
|
||||||
P_QuantizeMomentumToSlope(&momentum, slope);
|
|
||||||
|
|
||||||
player->mo->momx = momentum.x;
|
|
||||||
player->mo->momy = momentum.y;
|
|
||||||
player->mo->momz = momentum.z/2;
|
|
||||||
|
|
||||||
if (player->pflags & PF_SPINNING)
|
|
||||||
{
|
|
||||||
player->pflags &= ~PF_SPINNING;
|
|
||||||
player->pflags |= P_GetJumpFlags(player);
|
|
||||||
player->pflags |= PF_THOKKED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player->mo->momx = -FixedMul(player->mo->momx,linedist);
|
|
||||||
player->mo->momy = -FixedMul(player->mo->momy,linedist);
|
|
||||||
|
|
||||||
if (player->pflags & PF_SPINNING)
|
|
||||||
{
|
|
||||||
player->pflags &= ~PF_SPINNING;
|
|
||||||
player->pflags |= P_GetJumpFlags(player);
|
|
||||||
player->pflags |= PF_THOKKED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((player->pflags & PF_SPINNING) && player->speed < FixedMul(1<<FRACBITS, player->mo->scale) && player->mo->momz)
|
|
||||||
{
|
|
||||||
player->pflags &= ~PF_SPINNING;
|
|
||||||
player->pflags |= P_GetJumpFlags(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
goto bouncydone;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fixed_t newmom;
|
||||||
|
pslope_t *slope = (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) ? *rover->t_slope : *rover->b_slope;
|
||||||
|
|
||||||
|
momentum.x = player->mo->momx;
|
||||||
|
momentum.y = player->mo->momy;
|
||||||
|
momentum.z = player->mo->momz*2;
|
||||||
|
|
||||||
|
if (slope)
|
||||||
|
P_ReverseQuantizeMomentumToSlope(&momentum, slope);
|
||||||
|
|
||||||
|
newmom = momentum.z = -FixedMul(momentum.z,bouncestrength)/2;
|
||||||
|
|
||||||
|
if (abs(newmom) < (bouncestrength*2))
|
||||||
|
goto bouncydone;
|
||||||
|
|
||||||
|
if (!(rover->master->flags & ML_BOUNCY))
|
||||||
|
{
|
||||||
|
if (newmom > 0)
|
||||||
|
{
|
||||||
|
if (newmom < 8*FRACUNIT)
|
||||||
|
newmom = 8*FRACUNIT;
|
||||||
|
}
|
||||||
|
else if (newmom < 0)
|
||||||
|
{
|
||||||
|
if (newmom > -8*FRACUNIT)
|
||||||
|
newmom = -8*FRACUNIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newmom > P_GetPlayerHeight(player)/2)
|
||||||
|
newmom = P_GetPlayerHeight(player)/2;
|
||||||
|
else if (newmom < -P_GetPlayerHeight(player)/2)
|
||||||
|
newmom = -P_GetPlayerHeight(player)/2;
|
||||||
|
|
||||||
|
momentum.z = newmom*2;
|
||||||
|
|
||||||
|
if (slope)
|
||||||
|
P_QuantizeMomentumToSlope(&momentum, slope);
|
||||||
|
|
||||||
|
player->mo->momx = momentum.x;
|
||||||
|
player->mo->momy = momentum.y;
|
||||||
|
player->mo->momz = momentum.z/2;
|
||||||
|
|
||||||
|
if (player->pflags & PF_SPINNING)
|
||||||
|
{
|
||||||
|
player->pflags &= ~PF_SPINNING;
|
||||||
|
player->pflags |= P_GetJumpFlags(player);
|
||||||
|
player->pflags |= PF_THOKKED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((player->pflags & PF_SPINNING) && player->speed < FixedMul(1<<FRACBITS, player->mo->scale) && player->mo->momz)
|
||||||
|
{
|
||||||
|
player->pflags &= ~PF_SPINNING;
|
||||||
|
player->pflags |= P_GetJumpFlags(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
goto bouncydone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bouncydone:
|
bouncydone:
|
||||||
|
|
|
@ -943,23 +943,23 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
#endif
|
#endif
|
||||||
spanfunc = spanfuncs[BASEDRAWFUNC];
|
spanfunc = spanfuncs[BASEDRAWFUNC];
|
||||||
|
|
||||||
if (pl->polyobj && pl->polyobj->translucency != 0)
|
if (pl->polyobj)
|
||||||
{
|
{
|
||||||
spanfunctype = SPANDRAWFUNC_TRANS;
|
|
||||||
|
|
||||||
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
||||||
if (pl->polyobj->translucency >= 10)
|
if (pl->polyobj->translucency >= 10)
|
||||||
return; // Don't even draw it
|
return; // Don't even draw it
|
||||||
else if (pl->polyobj->translucency > 0)
|
else if (pl->polyobj->translucency > 0)
|
||||||
|
{
|
||||||
|
spanfunctype = (pl->polyobj->flags & POF_SPLAT) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS;
|
||||||
ds_transmap = transtables + ((pl->polyobj->translucency-1)<<FF_TRANSSHIFT);
|
ds_transmap = transtables + ((pl->polyobj->translucency-1)<<FF_TRANSSHIFT);
|
||||||
else // Opaque, but allow transparent flat pixels
|
}
|
||||||
|
else if (pl->polyobj->flags & POF_SPLAT) // Opaque, but allow transparent flat pixels
|
||||||
spanfunctype = SPANDRAWFUNC_SPLAT;
|
spanfunctype = SPANDRAWFUNC_SPLAT;
|
||||||
|
|
||||||
if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG)))
|
if (pl->polyobj->translucency == 0 || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG)))
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||||
else
|
else
|
||||||
light = LIGHTLEVELS-1;
|
light = LIGHTLEVELS-1;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -984,7 +984,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
|
||||||
if (pl->ffloor->flags & FF_TRANSLUCENT)
|
if (pl->ffloor->flags & FF_TRANSLUCENT)
|
||||||
{
|
{
|
||||||
spanfunctype = SPANDRAWFUNC_TRANS;
|
spanfunctype = (pl->ffloor->master->flags & ML_EFFECT6) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS;
|
||||||
|
|
||||||
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
// Hacked up support for alpha value in software mode Tails 09-24-2002
|
||||||
if (pl->ffloor->alpha < 12)
|
if (pl->ffloor->alpha < 12)
|
||||||
|
|
|
@ -1096,27 +1096,29 @@ static void R_SplitSprite(vissprite_t *sprite)
|
||||||
//
|
//
|
||||||
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
|
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
|
||||||
{
|
{
|
||||||
fixed_t z, floorz = INT32_MIN;
|
boolean isflipped = thing->eflags & MFE_VERTICALFLIP;
|
||||||
pslope_t *slope, *floorslope = NULL;
|
fixed_t z, groundz = isflipped ? INT32_MAX : INT32_MIN;
|
||||||
|
pslope_t *slope, *groundslope = NULL;
|
||||||
msecnode_t *node;
|
msecnode_t *node;
|
||||||
sector_t *sector;
|
sector_t *sector;
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
#define CHECKZ (isflipped ? z > thing->z+thing->height/2 && z < groundz : z < thing->z+thing->height/2 && z > groundz)
|
||||||
|
|
||||||
for (node = thing->touching_sectorlist; node; node = node->m_sectorlist_next)
|
for (node = thing->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
{
|
{
|
||||||
sector = node->m_sector;
|
sector = node->m_sector;
|
||||||
|
|
||||||
slope = sector->heightsec != -1 ? NULL : sector->f_slope;
|
slope = sector->heightsec != -1 ? NULL : (isflipped ? sector->c_slope : sector->f_slope);
|
||||||
|
|
||||||
if (sector->heightsec != -1)
|
if (sector->heightsec != -1)
|
||||||
z = sectors[sector->heightsec].floorheight;
|
z = isflipped ? sectors[sector->heightsec].ceilingheight : sectors[sector->heightsec].floorheight;
|
||||||
else
|
else
|
||||||
z = P_GetSectorFloorZAt(sector, thing->x, thing->y);
|
z = isflipped ? P_GetSectorCeilingZAt(sector, thing->x, thing->y) : P_GetSectorFloorZAt(sector, thing->x, thing->y);
|
||||||
|
|
||||||
if (z < thing->z+thing->height/2 && z > floorz)
|
if CHECKZ
|
||||||
{
|
{
|
||||||
floorz = z;
|
groundz = z;
|
||||||
floorslope = slope;
|
groundslope = slope;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sector->ffloors)
|
if (sector->ffloors)
|
||||||
|
@ -1125,23 +1127,25 @@ fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || (rover->alpha < 90 && !(rover->flags & FF_SWIMMABLE)))
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || (rover->alpha < 90 && !(rover->flags & FF_SWIMMABLE)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
z = P_GetFFloorTopZAt(rover, thing->x, thing->y);
|
z = isflipped ? P_GetFFloorBottomZAt(rover, thing->x, thing->y) : P_GetFFloorTopZAt(rover, thing->x, thing->y);
|
||||||
if (z < thing->z+thing->height/2 && z > floorz)
|
if CHECKZ
|
||||||
{
|
{
|
||||||
floorz = z;
|
groundz = z;
|
||||||
floorslope = *rover->t_slope;
|
groundslope = isflipped ? *rover->b_slope : *rover->t_slope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thing->floorz > floorz + (!floorslope ? 0 : FixedMul(abs(floorslope->zdelta), thing->radius*3/2)))
|
if (isflipped ? (thing->ceilingz < groundz - (!groundslope ? 0 : FixedMul(abs(groundslope->zdelta), thing->radius*3/2)))
|
||||||
|
: (thing->floorz > groundz + (!groundslope ? 0 : FixedMul(abs(groundslope->zdelta), thing->radius*3/2))))
|
||||||
{
|
{
|
||||||
floorz = thing->floorz;
|
groundz = isflipped ? thing->ceilingz : thing->floorz;
|
||||||
floorslope = NULL;
|
groundslope = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // Unfortunately, this drops CEZ2 down to sub-17 FPS on my i7.
|
#if 0 // Unfortunately, this drops CEZ2 down to sub-17 FPS on my i7.
|
||||||
// Check polyobjects and see if floorz needs to be altered, for rings only because they don't update floorz
|
// NOTE: this section was not updated to reflect reverse gravity support
|
||||||
|
// Check polyobjects and see if groundz needs to be altered, for rings only because they don't update floorz
|
||||||
if (thing->type == MT_RING)
|
if (thing->type == MT_RING)
|
||||||
{
|
{
|
||||||
INT32 xl, xh, yl, yh, bx, by;
|
INT32 xl, xh, yl, yh, bx, by;
|
||||||
|
@ -1186,10 +1190,10 @@ fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
|
||||||
// We're inside it! Yess...
|
// We're inside it! Yess...
|
||||||
z = po->lines[0]->backsector->ceilingheight;
|
z = po->lines[0]->backsector->ceilingheight;
|
||||||
|
|
||||||
if (z < thing->z+thing->height/2 && z > floorz)
|
if (z < thing->z+thing->height/2 && z > groundz)
|
||||||
{
|
{
|
||||||
floorz = z;
|
groundz = z;
|
||||||
floorslope = NULL;
|
groundslope = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plink = (polymaplink_t *)(plink->link.next);
|
plink = (polymaplink_t *)(plink->link.next);
|
||||||
|
@ -1199,9 +1203,10 @@ fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shadowslope != NULL)
|
if (shadowslope != NULL)
|
||||||
*shadowslope = floorslope;
|
*shadowslope = groundslope;
|
||||||
|
|
||||||
return floorz;
|
return groundz;
|
||||||
|
#undef CHECKZ
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, fixed_t tx, fixed_t tz)
|
static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, fixed_t tx, fixed_t tz)
|
||||||
|
@ -1212,14 +1217,15 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
||||||
INT32 light = 0;
|
INT32 light = 0;
|
||||||
fixed_t scalemul; UINT8 trans;
|
fixed_t scalemul; UINT8 trans;
|
||||||
fixed_t floordiff;
|
fixed_t floordiff;
|
||||||
fixed_t floorz;
|
fixed_t groundz;
|
||||||
pslope_t *floorslope;
|
pslope_t *groundslope;
|
||||||
|
boolean isflipped = thing->eflags & MFE_VERTICALFLIP;
|
||||||
|
|
||||||
floorz = R_GetShadowZ(thing, &floorslope);
|
groundz = R_GetShadowZ(thing, &groundslope);
|
||||||
|
|
||||||
if (abs(floorz-viewz)/tz > 4) return; // Prevent stretchy shadows and possible crashes
|
if (abs(groundz-viewz)/tz > 4) return; // Prevent stretchy shadows and possible crashes
|
||||||
|
|
||||||
floordiff = abs(thing->z - floorz);
|
floordiff = abs((isflipped ? thing->height : 0) + thing->z - groundz);
|
||||||
|
|
||||||
trans = floordiff / (100*FRACUNIT) + 3;
|
trans = floordiff / (100*FRACUNIT) + 3;
|
||||||
if (trans >= 9) return;
|
if (trans >= 9) return;
|
||||||
|
@ -1230,23 +1236,23 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
||||||
xscale = FixedDiv(projection, tz);
|
xscale = FixedDiv(projection, tz);
|
||||||
yscale = FixedDiv(projectiony, tz);
|
yscale = FixedDiv(projectiony, tz);
|
||||||
shadowxscale = FixedMul(thing->radius*2, scalemul);
|
shadowxscale = FixedMul(thing->radius*2, scalemul);
|
||||||
shadowyscale = FixedMul(FixedMul(thing->radius*2, scalemul), FixedDiv(abs(floorz - viewz), tz));
|
shadowyscale = FixedMul(FixedMul(thing->radius*2, scalemul), FixedDiv(abs(groundz - viewz), tz));
|
||||||
shadowyscale = min(shadowyscale, shadowxscale) / SHORT(patch->height);
|
shadowyscale = min(shadowyscale, shadowxscale) / SHORT(patch->height);
|
||||||
shadowxscale /= SHORT(patch->width);
|
shadowxscale /= SHORT(patch->width);
|
||||||
shadowskew = 0;
|
shadowskew = 0;
|
||||||
|
|
||||||
if (floorslope)
|
if (groundslope)
|
||||||
{
|
{
|
||||||
// haha let's try some dumb stuff
|
// haha let's try some dumb stuff
|
||||||
fixed_t xslope, zslope;
|
fixed_t xslope, zslope;
|
||||||
angle_t sloperelang = (R_PointToAngle(thing->x, thing->y) - floorslope->xydirection) >> ANGLETOFINESHIFT;
|
angle_t sloperelang = (R_PointToAngle(thing->x, thing->y) - groundslope->xydirection) >> ANGLETOFINESHIFT;
|
||||||
|
|
||||||
xslope = FixedMul(FINESINE(sloperelang), floorslope->zdelta);
|
xslope = FixedMul(FINESINE(sloperelang), groundslope->zdelta);
|
||||||
zslope = FixedMul(FINECOSINE(sloperelang), floorslope->zdelta);
|
zslope = FixedMul(FINECOSINE(sloperelang), groundslope->zdelta);
|
||||||
|
|
||||||
//CONS_Printf("Shadow is sloped by %d %d\n", xslope, zslope);
|
//CONS_Printf("Shadow is sloped by %d %d\n", xslope, zslope);
|
||||||
|
|
||||||
if (viewz < floorz)
|
if (viewz < groundz)
|
||||||
shadowyscale += FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scalemul), zslope);
|
shadowyscale += FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scalemul), zslope);
|
||||||
else
|
else
|
||||||
shadowyscale -= FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scalemul), zslope);
|
shadowyscale -= FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scalemul), zslope);
|
||||||
|
@ -1271,7 +1277,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
||||||
shadow->heightsec = vis->heightsec;
|
shadow->heightsec = vis->heightsec;
|
||||||
|
|
||||||
shadow->thingheight = FRACUNIT;
|
shadow->thingheight = FRACUNIT;
|
||||||
shadow->pz = floorz;
|
shadow->pz = groundz + (isflipped ? -shadow->thingheight : 0);
|
||||||
shadow->pzt = shadow->pz + shadow->thingheight;
|
shadow->pzt = shadow->pz + shadow->thingheight;
|
||||||
|
|
||||||
shadow->mobjflags = 0;
|
shadow->mobjflags = 0;
|
||||||
|
@ -1279,7 +1285,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
||||||
shadow->dispoffset = vis->dispoffset - 5;
|
shadow->dispoffset = vis->dispoffset - 5;
|
||||||
shadow->gx = thing->x;
|
shadow->gx = thing->x;
|
||||||
shadow->gy = thing->y;
|
shadow->gy = thing->y;
|
||||||
shadow->gzt = shadow->pz + SHORT(patch->height) * shadowyscale / 2;
|
shadow->gzt = (isflipped ? shadow->pzt : shadow->pz) + SHORT(patch->height) * shadowyscale / 2;
|
||||||
shadow->gz = shadow->gzt - SHORT(patch->height) * shadowyscale;
|
shadow->gz = shadow->gzt - SHORT(patch->height) * shadowyscale;
|
||||||
shadow->texturemid = FixedMul(thing->scale, FixedDiv(shadow->gzt - viewz, shadowyscale));
|
shadow->texturemid = FixedMul(thing->scale, FixedDiv(shadow->gzt - viewz, shadowyscale));
|
||||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||||
|
|
|
@ -338,6 +338,7 @@
|
||||||
<ClCompile Include="..\blua\lfunc.c" />
|
<ClCompile Include="..\blua\lfunc.c" />
|
||||||
<ClCompile Include="..\blua\lgc.c" />
|
<ClCompile Include="..\blua\lgc.c" />
|
||||||
<ClCompile Include="..\blua\linit.c" />
|
<ClCompile Include="..\blua\linit.c" />
|
||||||
|
<ClCompile Include="..\blua\liolib.c" />
|
||||||
<ClCompile Include="..\blua\llex.c" />
|
<ClCompile Include="..\blua\llex.c" />
|
||||||
<ClCompile Include="..\blua\lmem.c" />
|
<ClCompile Include="..\blua\lmem.c" />
|
||||||
<ClCompile Include="..\blua\lobject.c" />
|
<ClCompile Include="..\blua\lobject.c" />
|
||||||
|
|
|
@ -534,6 +534,9 @@
|
||||||
<ClCompile Include="..\blua\linit.c">
|
<ClCompile Include="..\blua\linit.c">
|
||||||
<Filter>BLUA</Filter>
|
<Filter>BLUA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\blua\liolib.c">
|
||||||
|
<Filter>BLUA</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\blua\llex.c">
|
<ClCompile Include="..\blua\llex.c">
|
||||||
<Filter>BLUA</Filter>
|
<Filter>BLUA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -72,7 +72,7 @@ static FUNCMATH angle_t AngleAdj(const fixed_t fa, const fixed_t wf,
|
||||||
const angle_t adj = 0x77;
|
const angle_t adj = 0x77;
|
||||||
const boolean fan = fa < 0;
|
const boolean fan = fa < 0;
|
||||||
const fixed_t sl = FixedDiv(fa, wf*2);
|
const fixed_t sl = FixedDiv(fa, wf*2);
|
||||||
const fixed_t lb = FixedRem(fa, wf*2);
|
const fixed_t lb = fa % (wf*2);
|
||||||
const fixed_t lo = (wf*2)-lb;
|
const fixed_t lo = (wf*2)-lb;
|
||||||
|
|
||||||
if (ra == 0)
|
if (ra == 0)
|
||||||
|
|
Loading…
Reference in a new issue