Merge branch 'Saturn-Next' into retrySOCK
This commit is contained in:
commit
b89a3f1017
13 files changed
+429
-336
No files matched your search
+3
-2
@@ -357,12 +357,13 @@ void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_
|
||||
|
||||
if (2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("packet too large to fit NetXCmd, cannot add netcmd %d! (size: %s, max: %d)\n"), id, sizeu1(2+nparam), MAXTEXTCMD);
|
||||
CONS_Alert(CONS_ERROR, M_GetText("packet too large to fit NetXCmd, cannot add netcmd %s with id %d! (size: %s, max: %d)\n"), netxcmdnames[id-1], id, sizeu1(2+nparam), MAXTEXTCMD);
|
||||
return;
|
||||
}
|
||||
|
||||
// for future reference: if (cv_debug) != debug disabled.
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("NetXCmd buffer full, delaying netcmd %d... (size: %d, needed: %s)\n"), id, localtextcmd[playerid][0], sizeu1(nparam));
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("NetXCmd buffer full, delaying netcmd %s with id %d... (size: %d, needed: %s)\n"), netxcmdnames[id-1], id, localtextcmd[playerid][0], sizeu1(nparam));
|
||||
|
||||
if (buf == NULL)
|
||||
{
|
||||
textcmdbuf[playerid] = (textcmdbuf_t*)Z_Malloc(sizeof(textcmdbuf_t), PU_STATIC, NULL);
|
||||
|
||||
@@ -51,10 +51,6 @@ extern consvar_t cv_mousevisible;
|
||||
//WTF
|
||||
extern consvar_t cv_mouseturn;
|
||||
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
|
||||
#ifdef LJOYSTICK
|
||||
extern consvar_t cv_joyport;
|
||||
extern consvar_t cv_joyport2;
|
||||
#endif
|
||||
extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS
|
||||
|
||||
// normally in p_mobj but the .h is not read
|
||||
|
||||
+33
-19
@@ -167,7 +167,9 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
|
||||
continue;
|
||||
}
|
||||
|
||||
nameonly(strcpy(wadfilename, wadfiles[i]->filename));
|
||||
strncpy(wadfilename, wadfiles[i]->filename, MAX_WADPATH);
|
||||
wadfilename[MAX_WADPATH-1] = '\0';
|
||||
nameonly(wadfilename);
|
||||
|
||||
// Look below at the WRITE macros to understand what these numbers mean.
|
||||
const size_t len = strlen(wadfilename) + 1;
|
||||
@@ -257,9 +259,10 @@ void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
||||
*/
|
||||
boolean CL_CheckDownloadable(void)
|
||||
{
|
||||
UINT8 i,dlstatus = 0;
|
||||
UINT8 i, dlstatus = 0;
|
||||
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN)
|
||||
{
|
||||
if (fileneeded[i].willsend == 1)
|
||||
@@ -270,6 +273,7 @@ boolean CL_CheckDownloadable(void)
|
||||
else //if (fileneeded[i].willsend == 2)
|
||||
dlstatus = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Downloading locally disabled
|
||||
if (!dlstatus && M_CheckParm("-nodownload"))
|
||||
@@ -280,15 +284,17 @@ boolean CL_CheckDownloadable(void)
|
||||
|
||||
// not downloadable, put reason in console
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("You need additional files to connect to this server:\n"));
|
||||
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN)
|
||||
{
|
||||
CONS_Printf(" * \"%s\" (%dK)", fileneeded[i].filename, fileneeded[i].totalsize >> 10);
|
||||
|
||||
if (fileneeded[i].status == FS_MD5SUMBAD)
|
||||
CONS_Printf(M_GetText(" wrong version, md5: "));
|
||||
else
|
||||
CONS_Printf(M_GetText(" not found, md5: "));
|
||||
if (fileneeded[i].status == FS_MD5SUMBAD)
|
||||
CONS_Printf(M_GetText(" wrong version, md5: "));
|
||||
else
|
||||
CONS_Printf(M_GetText(" not found, md5: "));
|
||||
|
||||
{
|
||||
INT32 j;
|
||||
@@ -299,6 +305,7 @@ boolean CL_CheckDownloadable(void)
|
||||
}
|
||||
CONS_Printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
switch (dlstatus)
|
||||
{
|
||||
@@ -312,6 +319,7 @@ boolean CL_CheckDownloadable(void)
|
||||
CONS_Printf(M_GetText("All files downloadable, but you have chosen to disable downloading locally.\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -549,7 +557,7 @@ INT32 CL_CheckFiles(void)
|
||||
if (fileneeded[i].status != FS_OPEN)
|
||||
filestoload++;
|
||||
|
||||
if (fileneeded[i].status != FS_NOTCHECKED) //since we're running this over multiple tics now, its possible for us to come across files checked in previous tics
|
||||
if (fileneeded[i].status != FS_NOTCHECKED) // since we're running this over multiple tics now, its possible for us to come across files checked in previous tics
|
||||
continue;
|
||||
|
||||
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
||||
@@ -557,14 +565,18 @@ INT32 CL_CheckFiles(void)
|
||||
// Check in already loaded files
|
||||
for (j = mainwads+1; j < numwadfiles; j++)
|
||||
{
|
||||
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
||||
|
||||
if (fasticmp(wadfilename, fileneeded[i].filename) &&
|
||||
!memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
|
||||
if (!memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
|
||||
{
|
||||
CONS_Debug(DBG_NETPLAY, "already loaded\n");
|
||||
fileneeded[i].status = FS_OPEN;
|
||||
return 4;
|
||||
strncpy(wadfilename, wadfiles[j]->filename, MAX_WADPATH);
|
||||
wadfilename[MAX_WADPATH-1] = '\0';
|
||||
nameonly(wadfilename);
|
||||
|
||||
if (fasticmp(wadfilename, fileneeded[i].filename))
|
||||
{
|
||||
CONS_Debug(DBG_NETPLAY, "already loaded\n");
|
||||
fileneeded[i].status = FS_OPEN;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,7 +657,7 @@ boolean CL_LoadServerFiles(void)
|
||||
else
|
||||
{
|
||||
const char *s;
|
||||
switch(fileneeded[i].status)
|
||||
switch (fileneeded[i].status)
|
||||
{
|
||||
case FS_NOTFOUND:
|
||||
s = "FS_NOTFOUND";
|
||||
@@ -688,7 +700,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
||||
|
||||
char wadfilename[MAX_WADPATH];
|
||||
|
||||
if (cv_noticedownload.value)
|
||||
if (cv_noticedownload.value && I_GetNodeAddress)
|
||||
CONS_Printf("Sending file \"%s\" (id %d) to node %d (%s)\n", filename, fileid, node, I_GetNodeAddress(node));
|
||||
|
||||
// Find the last file in the list and set a pointer to its "next" field
|
||||
@@ -713,7 +725,9 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
||||
// Look for the requested file through all loaded files
|
||||
for (wadnum = 0; wadfiles[wadnum]; wadnum++)
|
||||
{
|
||||
strlcpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH);
|
||||
// im a certified strlcpy hater
|
||||
strncpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH);
|
||||
wadfilename[MAX_WADPATH-1] = '\0';
|
||||
nameonly(wadfilename);
|
||||
|
||||
if (fasticmp(wadfilename, p->id.filename))
|
||||
@@ -1066,7 +1080,7 @@ void Got_Filetxpak(void)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
switch(file->status)
|
||||
switch (file->status)
|
||||
{
|
||||
case FS_NOTFOUND:
|
||||
s = "FS_NOTFOUND";
|
||||
@@ -1194,7 +1208,7 @@ filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum)
|
||||
fhandle = fopen(filename, "rb");
|
||||
if (fhandle)
|
||||
{
|
||||
md5_stream(fhandle,md5sum);
|
||||
md5_stream(fhandle, md5sum);
|
||||
fclose(fhandle);
|
||||
if (!memcmp(wantedmd5sum, md5sum, 16))
|
||||
return FS_FOUND;
|
||||
|
||||
+95
-98
@@ -1222,7 +1222,7 @@ static void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
|
||||
wallVerts[0].s = wallVerts[3].s = 0;
|
||||
wallVerts[2].s = wallVerts[1].s = 0;
|
||||
|
||||
if (UNLIKELY(gl_collect_skywalls))
|
||||
if (gl_collect_skywalls)
|
||||
{
|
||||
HWR_SkyWallList_Add(wallVerts);
|
||||
}
|
||||
@@ -2323,7 +2323,7 @@ static inline void DoAddLine(seg_t* line, angle_t angle1, angle_t angle2)
|
||||
}
|
||||
}
|
||||
else
|
||||
return;// dont do anything with the other side i guess?
|
||||
return; // dont do anything with the other side i guess?
|
||||
}
|
||||
|
||||
doaddline:
|
||||
@@ -2829,21 +2829,21 @@ static void HWR_Subsector(size_t num)
|
||||
|
||||
if (anyMoved == false)
|
||||
{
|
||||
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
|
||||
if (sub->validcount != validcount)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
|
||||
continue;
|
||||
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
|
||||
continue;
|
||||
|
||||
if (sub->validcount == validcount)
|
||||
continue;
|
||||
const sector_t *controlSec = §ors[rover->secnum];
|
||||
|
||||
const sector_t *controlSec = §ors[rover->secnum];
|
||||
if (controlSec->moved != true)
|
||||
continue;
|
||||
|
||||
if (controlSec->moved != true)
|
||||
continue;
|
||||
|
||||
anyMoved = true;
|
||||
break;
|
||||
anyMoved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2900,106 +2900,103 @@ static void HWR_Subsector(size_t num)
|
||||
PF_Occlude, ceilinglightlevel, levelflats[gl_frontsector->ceilingpic].lumpnum, NULL, 255, ceilingcolormap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gl_frontsector->ffloors)
|
||||
{
|
||||
/// \todo fix light, xoffs, yoffs, extracolormap ?
|
||||
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
|
||||
if (gl_frontsector->ffloors)
|
||||
{
|
||||
fixed_t bottomCullHeight, topCullHeight, centerHeight;
|
||||
|
||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || !(rover->flags & FF_RENDERALL))
|
||||
continue;
|
||||
|
||||
if (sub->validcount == validcount)
|
||||
continue;
|
||||
|
||||
if (gl_frontsector->cullheight)
|
||||
/// \todo fix light, xoffs, yoffs, extracolormap ?
|
||||
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (HWR_DoCulling(gl_frontsector->cullheight, viewsector->cullheight, gl_viewz, FixedToFloat(*rover->bottomheight), FixedToFloat(*rover->topheight)))
|
||||
fixed_t bottomCullHeight, topCullHeight, centerHeight;
|
||||
|
||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || !(rover->flags & FF_RENDERALL))
|
||||
continue;
|
||||
}
|
||||
|
||||
auto render_plane = [&](boolean bottom, fixed_t cullheight) FUNCINLINE
|
||||
{
|
||||
fixed_t roverheight;
|
||||
lumpnum_t flatlump;
|
||||
|
||||
if (bottom)
|
||||
if (gl_frontsector->cullheight)
|
||||
{
|
||||
roverheight = *rover->bottomheight;
|
||||
flatlump = levelflats[*rover->bottompic].lumpnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
roverheight = *rover->topheight;
|
||||
flatlump = levelflats[*rover->toppic].lumpnum;
|
||||
if (HWR_DoCulling(gl_frontsector->cullheight, viewsector->cullheight, gl_viewz, FixedToFloat(*rover->bottomheight), FixedToFloat(*rover->topheight)))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rover->flags & FF_FOG)
|
||||
auto render_fof_plane = [&](boolean bottom, boolean underside) FUNCINLINE
|
||||
{
|
||||
UINT8 alpha;
|
||||
fixed_t roverheight;
|
||||
lumpnum_t flatlump;
|
||||
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < cullheight));
|
||||
if (bottom)
|
||||
{
|
||||
roverheight = *rover->bottomheight;
|
||||
flatlump = levelflats[*rover->bottompic].lumpnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
roverheight = *rover->topheight;
|
||||
flatlump = levelflats[*rover->toppic].lumpnum;
|
||||
}
|
||||
|
||||
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
if (rover->flags & FF_FOG)
|
||||
{
|
||||
UINT8 alpha;
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
!bottom,
|
||||
roverheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, rover->master->frontsector->extra_colormap);
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, underside);
|
||||
|
||||
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
!bottom,
|
||||
roverheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||
true, rover->master->frontsector->extra_colormap);
|
||||
}
|
||||
else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) // SoM: Flags are more efficient
|
||||
{
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, underside);
|
||||
|
||||
HWR_AddTransparentFloor(flatlump,
|
||||
&extrasubsectors[num],
|
||||
!bottom,
|
||||
roverheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
CLAMP(rover->alpha, 0, 255), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : static_cast<FBITFIELD>(PF_Translucent)),
|
||||
false, gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWR_GetFlat(flatlump, R_NoEncore(gl_frontsector, !bottom));
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, underside);
|
||||
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], !bottom, roverheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, flatlump,
|
||||
rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
};
|
||||
|
||||
// bottom plane
|
||||
centerHeight = P_GetFFloorBottomZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
||||
|
||||
if (centerHeight <= locCeilingHeight && centerHeight >= locFloorHeight)
|
||||
{
|
||||
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
|
||||
|
||||
if ((viewz < bottomCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz > bottomCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))
|
||||
{
|
||||
render_fof_plane(true, (viewz < bottomCullHeight));
|
||||
}
|
||||
}
|
||||
else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) // SoM: Flags are more efficient
|
||||
|
||||
// top plane
|
||||
centerHeight = P_GetFFloorTopZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
||||
|
||||
if (centerHeight >= locFloorHeight && centerHeight <= locCeilingHeight)
|
||||
{
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < cullheight));
|
||||
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
|
||||
|
||||
HWR_AddTransparentFloor(flatlump,
|
||||
&extrasubsectors[num],
|
||||
!bottom,
|
||||
roverheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
CLAMP(rover->alpha, 0, 255), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : static_cast<FBITFIELD>(PF_Translucent)),
|
||||
false, gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWR_GetFlat(flatlump, R_NoEncore(gl_frontsector, !bottom));
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < cullheight));
|
||||
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], !bottom, roverheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, flatlump,
|
||||
rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
};
|
||||
|
||||
// bottom plane
|
||||
centerHeight = P_GetFFloorBottomZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
||||
|
||||
if (centerHeight <= locCeilingHeight && centerHeight >= locFloorHeight)
|
||||
{
|
||||
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
|
||||
|
||||
if ((viewz < bottomCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz > bottomCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))
|
||||
{
|
||||
render_plane(true, bottomCullHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// top plane
|
||||
centerHeight = P_GetFFloorTopZAt(rover, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
||||
|
||||
if (centerHeight >= locFloorHeight && centerHeight <= locCeilingHeight)
|
||||
{
|
||||
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
|
||||
|
||||
if ((viewz > topCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz < topCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))
|
||||
{
|
||||
render_plane(false, topCullHeight);
|
||||
if ((viewz > topCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz < topCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))
|
||||
{
|
||||
render_fof_plane(false, (viewz < topCullHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -1215,14 +1215,14 @@ static void P_LoadSideChangeMusic(boolean firstside, mapsidedef_t *msd, side_t *
|
||||
|
||||
if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')
|
||||
{
|
||||
memcpy(process,msd->bottomtexture,8);
|
||||
memcpy(process, msd->bottomtexture, 8);
|
||||
process[8] = '\0';
|
||||
sd->bottomtexture = get_number(process);
|
||||
}
|
||||
|
||||
if (!(msd->midtexture[0] == '-' && msd->midtexture[1] == '\0') || msd->midtexture[1] != '\0')
|
||||
{
|
||||
memcpy(process,msd->midtexture,8);
|
||||
memcpy(process, msd->midtexture, 8);
|
||||
process[8] = '\0';
|
||||
sd->midtexture = get_number(process);
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ static void P_LoadSideChangeMusic(boolean firstside, mapsidedef_t *msd, side_t *
|
||||
|
||||
if (firstside || msd->toptexture[0] != '-' || msd->toptexture[1] != '\0')
|
||||
{
|
||||
memcpy(process,msd->toptexture,8);
|
||||
memcpy(process, msd->toptexture, 8);
|
||||
process[8] = '\0';
|
||||
|
||||
// If they type in O_ or D_ and their music name, just shrug,
|
||||
@@ -1272,7 +1272,7 @@ static void P_LoadSidedefs(void *data)
|
||||
// Colormaps!
|
||||
switch (sd->special)
|
||||
{
|
||||
case 63: // variable colormap via 242 linedef
|
||||
case 63: // variable colormap via 242 linedef
|
||||
case 606: //SoM: 4/4/2000: Just colormap transfer
|
||||
// SoM: R_CreateColormap will only create a colormap in software mode...
|
||||
// Perhaps we should just call it instead of doing the calculations here.
|
||||
@@ -1288,21 +1288,21 @@ static void P_LoadSidedefs(void *data)
|
||||
if (msd->toptexture[0] != '-' || msd->toptexture[1] != '\0')
|
||||
{
|
||||
char process[8+1];
|
||||
memcpy(process,msd->toptexture,8);
|
||||
memcpy(process, msd->toptexture, 8);
|
||||
process[8] = '\0';
|
||||
sd->toptexture = get_number(process);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 9: // Mace parameters
|
||||
case 14: // Bustable block parameters
|
||||
case 15: // Fan particle spawner parameters
|
||||
case 9: // Mace parameters
|
||||
case 14: // Bustable block parameters
|
||||
case 15: // Fan particle spawner parameters
|
||||
case 425: // Calls P_SetMobjState on calling mobj
|
||||
case 434: // Custom Power
|
||||
case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors
|
||||
{
|
||||
char process[8*3+1];
|
||||
memset(process,0,8*3+1);
|
||||
memset(process, 0, 8*3+1);
|
||||
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
|
||||
if (msd->toptexture[0] == '-' && msd->toptexture[1] == '\0')
|
||||
break;
|
||||
@@ -1319,7 +1319,7 @@ static void P_LoadSidedefs(void *data)
|
||||
case 443: // Calls a named Lua function
|
||||
{
|
||||
char process[8*3+1];
|
||||
memset(process,0,8*3+1);
|
||||
memset(process, 0, 8*3+1);
|
||||
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
|
||||
if (msd->toptexture[0] == '-' && msd->toptexture[1] == '\0')
|
||||
break;
|
||||
@@ -2927,7 +2927,7 @@ static size_t sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||
static boolean P_CheckSoundReplacements(UINT16 wadnum, char *name, size_t i)
|
||||
{
|
||||
size_t j;
|
||||
lumpnum_t lumpnum = (i|(wadnum<<16));
|
||||
lumpnum_t lumpnum = (i | (wadnum<<16));
|
||||
|
||||
if (name[0] == 'D')
|
||||
{
|
||||
@@ -2935,8 +2935,8 @@ static boolean P_CheckSoundReplacements(UINT16 wadnum, char *name, size_t i)
|
||||
{
|
||||
for (j = 1; j < NUMSFX; j++)
|
||||
{
|
||||
if (S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6)
|
||||
&& (S_sfx[j].lumpnum != lumpnum) && (S_sfx[j].lumpnum != LUMPERROR))
|
||||
if ((S_sfx[j].lumpnum != lumpnum) && (S_sfx[j].lumpnum != LUMPERROR) &&
|
||||
S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6))
|
||||
{
|
||||
// the sound will be reloaded when needed,
|
||||
// since sfx->data will be NULL
|
||||
|
||||
+114
-59
@@ -881,7 +881,7 @@ static boolean PolyDoor(line_t *line)
|
||||
|
||||
pdd.polyObjNum = line->tag; // polyobject id
|
||||
|
||||
switch(line->special)
|
||||
switch (line->special)
|
||||
{
|
||||
case 480: // Polyobj_DoorSlide
|
||||
pdd.doorType = POLY_DOOR_SLIDE;
|
||||
@@ -1338,6 +1338,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
else if (secspecial == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
{
|
||||
UINT8 lap;
|
||||
INT32 targlap;
|
||||
|
||||
if (actor && actor->player && triggerline->flags & ML_EFFECT4)
|
||||
{
|
||||
@@ -1348,19 +1349,21 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
lap = P_FindLowestLap();
|
||||
}
|
||||
|
||||
targlap = (INT32)(sides[triggerline->sidenum[0]].textureoffset >> FRACBITS);
|
||||
|
||||
if (triggerline->flags & ML_NOCLIMB) // Need higher than or equal to
|
||||
{
|
||||
if (lap < (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS))
|
||||
if (lap < targlap)
|
||||
return false;
|
||||
}
|
||||
else if (triggerline->flags & ML_BLOCKMONSTERS) // Need lower than or equal to
|
||||
{
|
||||
if (lap > (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS))
|
||||
if (lap > targlap)
|
||||
return false;
|
||||
}
|
||||
else // Need equal to
|
||||
{
|
||||
if (lap != (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS))
|
||||
if (lap != targlap)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1452,6 +1455,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
if (triggerline->flags & ML_EFFECT5) // disregard order for efficiency
|
||||
{
|
||||
for (i = 0; i < linecnt; i++)
|
||||
{
|
||||
if (ctlsector->lines[i]->special >= 400
|
||||
&& ctlsector->lines[i]->special < 500)
|
||||
{
|
||||
@@ -1460,6 +1464,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
else
|
||||
P_ProcessLineSpecial(ctlsector->lines[i], actor, caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // walk around the sector in a defined order
|
||||
{
|
||||
@@ -1467,11 +1472,13 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
size_t j, masterlineindex = (size_t)-1;
|
||||
|
||||
for (i = 0; i < linecnt; i++)
|
||||
{
|
||||
if (ctlsector->lines[i] == triggerline)
|
||||
{
|
||||
masterlineindex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (masterlineindex == (size_t)-1)
|
||||
@@ -1490,11 +1497,13 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
|
||||
if (ctlsector->lines[i]->v1 == ctlsector->lines[j]->v2)
|
||||
{
|
||||
i = j;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctlsector->lines[i]->v1 == ctlsector->lines[j]->v1)
|
||||
{
|
||||
i = j;
|
||||
@@ -1502,6 +1511,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j == linecnt)
|
||||
{
|
||||
const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes);
|
||||
@@ -1516,11 +1526,13 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
|
||||
if (ctlsector->lines[i]->v2 == ctlsector->lines[j]->v1)
|
||||
{
|
||||
i = j;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctlsector->lines[i]->v2 == ctlsector->lines[j]->v2)
|
||||
{
|
||||
i = j;
|
||||
@@ -1597,19 +1609,21 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||
if (lines[masterline].tag != tag)
|
||||
continue;
|
||||
|
||||
const INT16 specialtype = lines[masterline].special;
|
||||
|
||||
// "No More Enemies" and "Level Load" take care of themselves.
|
||||
if (lines[masterline].special == 313
|
||||
|| lines[masterline].special == 399
|
||||
|| lines[masterline].special == 328
|
||||
|| lines[masterline].special == 323
|
||||
if (specialtype == 313
|
||||
|| specialtype == 399
|
||||
|| specialtype == 328
|
||||
|| specialtype == 323
|
||||
// Each-time executors handle themselves, too
|
||||
|| lines[masterline].special == 301 // Each time
|
||||
|| lines[masterline].special == 306 // Character ability - Each time
|
||||
|| lines[masterline].special == 310 // CTF Red team - Each time
|
||||
|| lines[masterline].special == 312 // CTF Blue team - Each time
|
||||
|| lines[masterline].special == 322 // Trigger on X calls - Each Time
|
||||
|| lines[masterline].special < 300
|
||||
|| lines[masterline].special > 399)
|
||||
|| specialtype == 301 // Each time
|
||||
|| specialtype == 306 // Character ability - Each time
|
||||
|| specialtype == 310 // CTF Red team - Each time
|
||||
|| specialtype == 312 // CTF Blue team - Each time
|
||||
|| specialtype == 322 // Trigger on X calls - Each Time
|
||||
|| specialtype < 300
|
||||
|| specialtype > 399)
|
||||
continue;
|
||||
|
||||
if (!P_RunTriggerLinedef(&lines[masterline], actor, caller))
|
||||
@@ -2421,7 +2435,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
P_SetPlayerMobjState(mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
|
||||
|
||||
// Reset bot too.
|
||||
if (bot) {
|
||||
if (bot)
|
||||
{
|
||||
if (line->flags & ML_NOCLIMB)
|
||||
P_SetOrigin(bot, mo->x, mo->y, mo->z);
|
||||
bot->momx = bot->momy = bot->momz = 1;
|
||||
@@ -2504,6 +2519,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
P_SetTarget(&dummy->target, bot);
|
||||
A_CustomPower(dummy);
|
||||
}
|
||||
|
||||
P_RemoveMobj(dummy);
|
||||
}
|
||||
break;
|
||||
@@ -2567,11 +2583,15 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
if (mo && mo->player)
|
||||
{
|
||||
UINT16 fractime = (UINT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
|
||||
|
||||
if (fractime < 1)
|
||||
fractime = 1; //instantly wears off upon leaving
|
||||
|
||||
if (line->flags & ML_NOCLIMB)
|
||||
fractime |= 1<<15; //more crazy &ing, as if music stuff wasn't enough
|
||||
|
||||
mo->player->powers[pw_nocontrol] = fractime;
|
||||
|
||||
if (bot)
|
||||
bot->player->powers[pw_nocontrol] = fractime;
|
||||
}
|
||||
@@ -2581,8 +2601,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
if (mo)
|
||||
{
|
||||
mo->destscale = FixedDiv(P_AproxDistance(line->dx, line->dy), 100<<FRACBITS);
|
||||
|
||||
if (mo->destscale < FRACUNIT/100)
|
||||
mo->destscale = FRACUNIT/100;
|
||||
|
||||
if (mo->player && bot)
|
||||
bot->destscale = mo->destscale;
|
||||
}
|
||||
@@ -2667,9 +2689,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
{
|
||||
boolean tryagain;
|
||||
sec = sectors + secnum;
|
||||
|
||||
do {
|
||||
tryagain = false;
|
||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||
{
|
||||
if (thing->type == type)
|
||||
{
|
||||
if (state != NUMSTATES)
|
||||
@@ -2686,6 +2710,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (tryagain);
|
||||
}
|
||||
break;
|
||||
@@ -3261,6 +3286,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
case 3: // Linedef executor requires all players present // Trigger Linedef Exec (Floor Touch, All Players)
|
||||
/// \todo check continues for proper splitscreen support?
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].bot && players[i].mo && (gametype != GT_COOP || players[i].lives > 0))
|
||||
{
|
||||
if (roversector)
|
||||
@@ -3314,6 +3340,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
goto DoneSection2;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case 4: // Linedef executor that doesn't require touching floor // Trigger Linedef Exec (Anywhere in Sector)
|
||||
case 5: // Linedef executor // Trigger Linedef Exec (Floor Touch)
|
||||
@@ -3446,11 +3473,14 @@ DoneSection2:
|
||||
|
||||
if (i != -1)
|
||||
{
|
||||
INT32 sfxnum;
|
||||
angle_t lineangle;
|
||||
fixed_t linespeed;
|
||||
|
||||
lineangle = lines[i].angle;
|
||||
linespeed = P_AproxDistance(lines[i].v2->x-lines[i].v1->x, lines[i].v2->y-lines[i].v1->y);
|
||||
const line_t *line = &lines[i];
|
||||
|
||||
lineangle = line->angle;
|
||||
linespeed = P_AproxDistance(line->v2->x-line->v1->x, line->v2->y-line->v1->y);
|
||||
|
||||
player->mo->angle = lineangle;
|
||||
|
||||
@@ -3464,7 +3494,7 @@ DoneSection2:
|
||||
P_ForceLocalAngle(player, player->mo->angle);
|
||||
}
|
||||
|
||||
if (!(lines[i].flags & ML_EFFECT4))
|
||||
if (!(line->flags & ML_EFFECT4))
|
||||
{
|
||||
P_UnsetThingPosition(player->mo);
|
||||
if (roversector) // make FOF speed pads work
|
||||
@@ -3486,7 +3516,14 @@ DoneSection2:
|
||||
player->kartstuff[k_drift] = 0;
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
player->kartstuff[k_pogospring] = 0;
|
||||
S_StartSound(player->mo, sfx_spdpad);
|
||||
|
||||
sfxnum = sides[line->sidenum[0]].toptexture;
|
||||
|
||||
// none or invalid sound?
|
||||
if (sfxnum <= sfx_None || sfxnum >= NUMSFX)
|
||||
sfxnum = sfx_spdpad; // use the zippy sound then!
|
||||
|
||||
S_StartSound(player->mo, sfxnum);
|
||||
|
||||
{
|
||||
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
||||
@@ -3535,21 +3572,25 @@ DoneSection2:
|
||||
P_DoPlayerExit(player);
|
||||
|
||||
P_SetupSignExit(player);
|
||||
// important: use sector->tag on next line instead of player->mo->subsector->tag
|
||||
// this part is different from in P_PlayerThink, this is what was causing
|
||||
// FOF custom exits not to work.
|
||||
lineindex = P_FindSpecialLineFromTag(2, sector->tag, -1);
|
||||
|
||||
if (gametype == GT_COOP && lineindex != -1) // Custom exit!
|
||||
if (gametype == GT_COOP)
|
||||
{
|
||||
// Special goodies with the block monsters flag depending on emeralds collected
|
||||
if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds))
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS);
|
||||
else
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS);
|
||||
// important: use sector->tag on next line instead of player->mo->subsector->tag
|
||||
// this part is different from in P_PlayerThink, this is what was causing
|
||||
// FOF custom exits not to work.
|
||||
lineindex = P_FindSpecialLineFromTag(2, sector->tag, -1);
|
||||
|
||||
if (lines[lineindex].flags & ML_NOCLIMB)
|
||||
skipstats = true;
|
||||
if (lineindex != -1) // Custom exit!)
|
||||
{
|
||||
// Special goodies with the block monsters flag depending on emeralds collected
|
||||
if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds))
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS);
|
||||
else
|
||||
nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS);
|
||||
|
||||
if (lines[lineindex].flags & ML_NOCLIMB)
|
||||
skipstats = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3656,7 +3697,6 @@ DoneSection2:
|
||||
mobj_t *waypoint = NULL;
|
||||
mobj_t *mo2;
|
||||
|
||||
|
||||
if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT)
|
||||
break;
|
||||
|
||||
@@ -4521,27 +4561,13 @@ void P_PlayerInSpecialSector(player_t *player)
|
||||
|
||||
#undef TELEPORTED
|
||||
|
||||
/** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up.
|
||||
*
|
||||
* \sa P_CheckTimeLimit, P_CheckPointLimit
|
||||
*/
|
||||
void P_UpdateSpecials(void)
|
||||
static void P_UpdateAnimFlats(void)
|
||||
{
|
||||
anim_t *anim;
|
||||
INT32 i;
|
||||
size_t j;
|
||||
levelflat_t *foundflats; // for flat animation
|
||||
|
||||
// LEVEL TIMER
|
||||
P_CheckTimeLimit();
|
||||
|
||||
// POINT LIMIT
|
||||
P_CheckPointLimit();
|
||||
|
||||
// Dynamic slopeness
|
||||
if (!midgamejoin) // run here when not joined midgame to prevent any potential issues that may arise
|
||||
P_RunDynamicSlopes();
|
||||
|
||||
// ANIMATE TEXTURES
|
||||
for (anim = anims; anim < lastanim; anim++)
|
||||
{
|
||||
@@ -4571,15 +4597,38 @@ void P_UpdateSpecials(void)
|
||||
}
|
||||
}
|
||||
|
||||
/** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up.
|
||||
*
|
||||
* \sa P_CheckTimeLimit, P_CheckPointLimit
|
||||
*/
|
||||
void P_UpdateSpecials(void)
|
||||
{
|
||||
// LEVEL TIMER
|
||||
P_CheckTimeLimit();
|
||||
|
||||
// POINT LIMIT
|
||||
P_CheckPointLimit();
|
||||
|
||||
// Dynamic slopeness
|
||||
// we run this here only when not joined midrace
|
||||
// for vanilla compat reasons :chaosleep:
|
||||
if (!midgamejoin)
|
||||
P_RunDynamicSlopes();
|
||||
|
||||
P_UpdateAnimFlats();
|
||||
}
|
||||
|
||||
static inline ffloor_t *P_GetFFloorBySec(sector_t *sec, sector_t *sec2)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
||||
if (!sec->ffloors)
|
||||
return NULL;
|
||||
|
||||
for (rover = sec->ffloors; rover; rover = rover->next)
|
||||
if (rover->secnum == (size_t)(sec2 - sectors))
|
||||
return rover;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4630,6 +4679,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
|
||||
if (sec == sec2)
|
||||
return NULL; //Don't need a fake floor on a control sector.
|
||||
|
||||
if ((ffloor = (P_GetFFloorBySec(sec, sec2))))
|
||||
return ffloor; // If this ffloor already exists, return it
|
||||
|
||||
@@ -4736,7 +4786,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
P_AddSpikeThinker(sec, (INT32)sec2num);
|
||||
}
|
||||
// Should this FOF have friction?
|
||||
else if(th->function == (actionf_p1)T_Friction)
|
||||
else if (th->function == (actionf_p1)T_Friction)
|
||||
{
|
||||
f = (friction_t *)th;
|
||||
|
||||
@@ -4744,7 +4794,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
Add_Friction(f->friction, f->movefactor, (INT32)(sec-sectors), f->affectee);
|
||||
}
|
||||
// Should this FOF have wind/current/pusher?
|
||||
else if(th->function == (actionf_p1)T_Pusher)
|
||||
else if (th->function == (actionf_p1)T_Pusher)
|
||||
{
|
||||
p = (pusher_t *)th;
|
||||
|
||||
@@ -6946,6 +6996,7 @@ static void P_SpawnFriction(void)
|
||||
INT32 movefactor; // applied to each player move to simulate inertia
|
||||
|
||||
for (i = 0; i < numlines; i++, l++)
|
||||
{
|
||||
if (l->special == 540)
|
||||
{
|
||||
//length = P_AproxDistance(l->dx, l->dy)>>FRACBITS;
|
||||
@@ -6979,6 +7030,7 @@ static void P_SpawnFriction(void)
|
||||
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;)
|
||||
Add_Friction(friction, movefactor, s, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -7027,9 +7079,9 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *
|
||||
// "The right triangle of the square of the length of the hypotenuse is equal to the sum of the squares of the lengths of the other two sides."
|
||||
// "Bah! Stupid brains! Don't you know anything besides the Pythagorean Theorem?" - Earthworm Jim
|
||||
if (type == p_downcurrent || type == p_upcurrent || type == p_upwind || type == p_downwind)
|
||||
p->magnitude = P_AproxDistance(p->x_mag,p->y_mag)<<(FRACBITS-PUSH_FACTOR);
|
||||
p->magnitude = P_AproxDistance(p->x_mag, p->y_mag)<<(FRACBITS-PUSH_FACTOR);
|
||||
else
|
||||
p->magnitude = P_AproxDistance(p->x_mag,p->y_mag);
|
||||
p->magnitude = P_AproxDistance(p->x_mag, p->y_mag);
|
||||
|
||||
if (source) // point source exist?
|
||||
{
|
||||
@@ -7293,13 +7345,16 @@ void T_Pusher(pusher_t *p)
|
||||
if (thing->flags2 & MF2_PUSHED)
|
||||
continue;
|
||||
|
||||
if (thing->player && thing->player->pflags & PF_ROPEHANG)
|
||||
continue;
|
||||
if (thing->player)
|
||||
{
|
||||
if (thing->player->pflags & PF_ROPEHANG)
|
||||
continue;
|
||||
|
||||
if (thing->player && (thing->state == &states[thing->info->painstate])
|
||||
&& (thing->player->powers[pw_flashing] > (K_GetKartFlashing(thing->player)/4)*3
|
||||
&& thing->player->powers[pw_flashing] <= K_GetKartFlashing(thing->player)))
|
||||
continue;
|
||||
if ((thing->state == &states[thing->info->painstate])
|
||||
&& (thing->player->powers[pw_flashing] > (K_GetKartFlashing(thing->player)/4)*3
|
||||
&& thing->player->powers[pw_flashing] <= K_GetKartFlashing(thing->player)))
|
||||
continue;
|
||||
}
|
||||
|
||||
inFOF = touching = moved = false;
|
||||
|
||||
@@ -7429,7 +7484,7 @@ void T_Pusher(pusher_t *p)
|
||||
if (p->slider && thing->player)
|
||||
{
|
||||
boolean jumped = (thing->player->pflags & PF_JUMPED);
|
||||
P_ResetPlayer (thing->player);
|
||||
P_ResetPlayer(thing->player);
|
||||
|
||||
if (jumped)
|
||||
thing->player->pflags |= PF_JUMPED;
|
||||
|
||||
+1
-1
@@ -2361,7 +2361,7 @@ static void P_MovePlayer(player_t *player)
|
||||
if (onground && leveltime % 50 == 0 && player->kartstuff[k_drift] != 0)
|
||||
S_StartSound(player->mo, sfx_drift);
|
||||
// Leveltime being 50 might take a while at times. We'll start it up once, isntantly.
|
||||
else if (onground && !S_SoundPlaying(player->mo, sfx_drift) && player->kartstuff[k_drift] != 0)
|
||||
else if (onground && player->kartstuff[k_drift] != 0 && !S_SoundPlaying(player->mo, sfx_drift))
|
||||
S_StartSound(player->mo, sfx_drift);
|
||||
// Ok, we'll stop now.
|
||||
else if (player->kartstuff[k_drift] == 0 || !onground)
|
||||
|
||||
+17
-4
@@ -321,12 +321,19 @@ static void R_AddLine(seg_t *line)
|
||||
angle_t angle1, angle2, span, tspan;
|
||||
static sector_t tempsec;
|
||||
boolean bothfloorssky = false;
|
||||
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
|
||||
|
||||
g_portal = NULL;
|
||||
|
||||
v1x = line->v1->x;
|
||||
v1y = line->v1->y;
|
||||
|
||||
v2x = line->v2->x;
|
||||
v2y = line->v2->y;
|
||||
|
||||
// big room fix
|
||||
angle1 = R_PointToAngle64(line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngle64(line->v2->x, line->v2->y);
|
||||
angle1 = R_PointToAngle64(v1x, v1y);
|
||||
angle2 = R_PointToAngle64(v2x, v2y);
|
||||
|
||||
curline = line;
|
||||
|
||||
@@ -519,6 +526,7 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
angle_t angle1, angle2;
|
||||
INT32 sx1, sx2;
|
||||
const INT32* check;
|
||||
fixed_t x1, y1, x2, y2;
|
||||
|
||||
// Find the corners of the box
|
||||
// that define the edges from current viewpoint.
|
||||
@@ -532,9 +540,14 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
|
||||
check = checkcoord[boxpos];
|
||||
|
||||
x1 = bspcoord[check[0]];
|
||||
y1 = bspcoord[check[1]];
|
||||
x2 = bspcoord[check[2]];
|
||||
y2 = bspcoord[check[3]];
|
||||
|
||||
// big room fix
|
||||
angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
|
||||
angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
|
||||
angle1 = R_PointToAngle64(x1, y1) - viewangle;
|
||||
angle2 = R_PointToAngle64(x2, y2) - viewangle;
|
||||
|
||||
// cph - replaced old code, which was unclear and badly commented
|
||||
// Much more efficient code now
|
||||
|
||||
+4
-4
@@ -387,10 +387,10 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||
return;
|
||||
}
|
||||
|
||||
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||
out->scale = mapobjectscale;
|
||||
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||
out->scale = mapobjectscale;
|
||||
}
|
||||
|
||||
static levelinterpolator_t *CreateInterpolator(levelinterpolator_type_e type, thinker_t *thinker)
|
||||
|
||||
@@ -773,6 +773,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
|
||||
R_SetColumnFunc(BASEDRAWFUNC); // hack: this isn't resetting properly somewhere.
|
||||
dc.colormap = vis->colormap;
|
||||
|
||||
if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS); // translate certain pixels to white
|
||||
@@ -825,6 +826,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
else
|
||||
dc.colormap = &vis->extra_colormap->colormap[dc.colormap - colormaps];
|
||||
}
|
||||
|
||||
if (!dc.colormap)
|
||||
dc.colormap = colormaps;
|
||||
|
||||
@@ -849,6 +851,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
vis->xiscale = FixedDiv(vis->xiscale, this_scale);
|
||||
vis->isScaled = true;
|
||||
}
|
||||
|
||||
dc.texturemid = FixedDiv(dc.texturemid, this_scale);
|
||||
}
|
||||
|
||||
|
||||
+142
-129
@@ -477,6 +477,11 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
{
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
||||
if (!player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
listenmobj[i] = player->awayviewmobj;
|
||||
@@ -535,79 +540,84 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
|
||||
i = 0; // sensible default
|
||||
|
||||
// Check to see if it is audible, and if not, modify the params
|
||||
if (origin && !itsUs)
|
||||
{
|
||||
// Check to see if it is audible, and if not, modify the params
|
||||
if (origin && !itsUs)
|
||||
boolean audible = false;
|
||||
|
||||
if (splitscreen > 0)
|
||||
{
|
||||
boolean audible = false;
|
||||
if (splitscreen > 0)
|
||||
{
|
||||
fixed_t recdist = INT32_MAX;
|
||||
UINT8 j = 0;
|
||||
fixed_t recdist = INT32_MAX;
|
||||
UINT8 j = 0;
|
||||
|
||||
for (; j <= splitscreen; j++)
|
||||
for (; j <= splitscreen; j++)
|
||||
{
|
||||
fixed_t thisdist = INT32_MAX;
|
||||
|
||||
if (!listenmobj[j])
|
||||
{
|
||||
fixed_t thisdist = INT32_MAX;
|
||||
|
||||
if (!listenmobj[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
thisdist = P_AproxDistance(listener[j].x - origin->x, listener[j].y - origin->y);
|
||||
|
||||
if (thisdist >= recdist)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
recdist = thisdist;
|
||||
i = j;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenmobj[i])
|
||||
{
|
||||
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, sfx);
|
||||
}
|
||||
thisdist = P_AproxDistance(listener[j].x - origin->x, listener[j].y - origin->y);
|
||||
|
||||
if (!audible)
|
||||
{
|
||||
return;
|
||||
if (thisdist >= recdist)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
recdist = thisdist;
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
|
||||
// This is supposed to handle the loading/caching.
|
||||
// For some odd reason, the caching is done nearly
|
||||
// each time the sound is needed?
|
||||
if (listenmobj[i])
|
||||
{
|
||||
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, sfx);
|
||||
}
|
||||
|
||||
if (!audible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// This is supposed to handle the loading/caching.
|
||||
// For some odd reason, the caching is done nearly
|
||||
// each time the sound is needed?
|
||||
|
||||
// cache data if necessary
|
||||
// NOTE: set sfx->data NULL sfx->lump -1 to force a reload
|
||||
if (!sfx->data)
|
||||
{
|
||||
sfx->data = I_GetSfx(sfx);
|
||||
|
||||
// cache data if necessary
|
||||
// NOTE: set sfx->data NULL sfx->lump -1 to force a reload
|
||||
if (!sfx->data)
|
||||
{
|
||||
sfx->data = I_GetSfx(sfx);
|
||||
CONS_Alert(CONS_WARNING, "Tried to load invalid sfx_%s\n", sfx->name);
|
||||
return; /* don't play it */
|
||||
}
|
||||
|
||||
// Avoid channel reverse if surround
|
||||
if (reverse)
|
||||
{
|
||||
sep = (~sep) & 255;
|
||||
}
|
||||
|
||||
// At this point it is determined that a sound can and should be played, so find a free channel to play it on
|
||||
cnum = S_getChannel(origin, sfx);
|
||||
|
||||
if (cnum < 0)
|
||||
{
|
||||
return; // If there's no free channels, there won't be any for anymore players either
|
||||
}
|
||||
|
||||
// Now that we know we are going to play a sound, fill out this info
|
||||
channels[cnum].sfxinfo = sfx;
|
||||
channels[cnum].origin = origin;
|
||||
channels[cnum].volume = initial_volume;
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, cnum);
|
||||
}
|
||||
|
||||
// Avoid channel reverse if surround
|
||||
if (reverse)
|
||||
{
|
||||
sep = (~sep) & 255;
|
||||
}
|
||||
|
||||
// At this point it is determined that a sound can and should be played, so find a free channel to play it on
|
||||
cnum = S_getChannel(origin, sfx);
|
||||
|
||||
if (cnum < 0)
|
||||
{
|
||||
return; // If there's no free channels, there won't be any for anymore players either
|
||||
}
|
||||
|
||||
// Now that we know we are going to play a sound, fill out this info
|
||||
channels[cnum].sfxinfo = sfx;
|
||||
channels[cnum].origin = origin;
|
||||
channels[cnum].volume = initial_volume;
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, cnum);
|
||||
}
|
||||
|
||||
void S_StartSound(const void *origin, sfxenum_t sfx_id)
|
||||
@@ -728,6 +738,11 @@ void S_UpdateSounds(void)
|
||||
{
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
|
||||
if (!player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
listenmobj[i] = player->awayviewmobj;
|
||||
@@ -761,84 +776,83 @@ void S_UpdateSounds(void)
|
||||
{
|
||||
c = &channels[cnum];
|
||||
|
||||
if (c->sfxinfo)
|
||||
if (c->sfxinfo == NULL)
|
||||
continue;
|
||||
|
||||
// if channel is allocated but sound has stopped, free it
|
||||
if (!I_SoundIsPlaying(c->handle))
|
||||
{
|
||||
if (I_SoundIsPlaying(c->handle))
|
||||
S_StopChannel(cnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c->origin == NULL)
|
||||
continue;
|
||||
|
||||
// initialize parameters
|
||||
volume = c->volume; // 8 bits internal volume precision
|
||||
sep = NORM_SEP;
|
||||
|
||||
// check non-local sounds for distance clipping
|
||||
// or modify their params
|
||||
boolean itsUs = false;
|
||||
|
||||
for (i = splitscreen; i >= 0; i--)
|
||||
{
|
||||
if (camera[i].freecam)
|
||||
continue;
|
||||
|
||||
if (c->origin != listenmobj[i])
|
||||
continue;
|
||||
|
||||
itsUs = true;
|
||||
}
|
||||
|
||||
if (itsUs == false)
|
||||
{
|
||||
const mobj_t *origin = c->origin;
|
||||
|
||||
i = 0;
|
||||
|
||||
if (splitscreen > 0)
|
||||
{
|
||||
// initialize parameters
|
||||
volume = c->volume; // 8 bits internal volume precision
|
||||
sep = NORM_SEP;
|
||||
fixed_t recdist = INT32_MAX;
|
||||
UINT8 j = 0;
|
||||
|
||||
// check non-local sounds for distance clipping
|
||||
// or modify their params
|
||||
if (c->origin)
|
||||
for (; j <= splitscreen; j++)
|
||||
{
|
||||
boolean itsUs = false;
|
||||
fixed_t thisdist = INT32_MAX;
|
||||
|
||||
for (i = splitscreen; i >= 0; i--)
|
||||
if (!listenmobj[j])
|
||||
{
|
||||
if (camera[i].freecam)
|
||||
continue;
|
||||
|
||||
if (c->origin != listenmobj[i])
|
||||
continue;
|
||||
|
||||
itsUs = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itsUs == false)
|
||||
thisdist = P_AproxDistance(listener[j].x - origin->x, listener[j].y - origin->y);
|
||||
|
||||
if (thisdist >= recdist)
|
||||
{
|
||||
const mobj_t *origin = c->origin;
|
||||
|
||||
i = 0;
|
||||
|
||||
if (splitscreen > 0)
|
||||
{
|
||||
fixed_t recdist = INT32_MAX;
|
||||
UINT8 j = 0;
|
||||
|
||||
for (; j <= splitscreen; j++)
|
||||
{
|
||||
fixed_t thisdist = INT32_MAX;
|
||||
|
||||
if (!listenmobj[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
thisdist = P_AproxDistance(listener[j].x - origin->x, listener[j].y - origin->y);
|
||||
|
||||
if (thisdist >= recdist)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
recdist = thisdist;
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenmobj[i])
|
||||
{
|
||||
audible = S_AdjustSoundParams(
|
||||
listenmobj[i], c->origin,
|
||||
&volume, &sep,
|
||||
c->sfxinfo
|
||||
);
|
||||
}
|
||||
|
||||
if (audible)
|
||||
I_UpdateSoundParams(c->handle, volume, sep);
|
||||
else
|
||||
S_StopChannel(cnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
recdist = thisdist;
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (listenmobj[i])
|
||||
{
|
||||
// if channel is allocated but sound has stopped, free it
|
||||
S_StopChannel(cnum);
|
||||
audible = S_AdjustSoundParams(
|
||||
listenmobj[i], c->origin,
|
||||
&volume, &sep,
|
||||
c->sfxinfo
|
||||
);
|
||||
}
|
||||
|
||||
if (audible)
|
||||
I_UpdateSoundParams(c->handle, volume, sep);
|
||||
else
|
||||
S_StopChannel(cnum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -866,7 +880,6 @@ void S_ClearSfx(void)
|
||||
|
||||
static void S_StopChannel(INT32 cnum)
|
||||
{
|
||||
INT32 i;
|
||||
channel_t *c = &channels[cnum];
|
||||
|
||||
if (c->sfxinfo)
|
||||
@@ -875,12 +888,6 @@ static void S_StopChannel(INT32 cnum)
|
||||
if (I_SoundIsPlaying(c->handle))
|
||||
I_StopSound(c->handle);
|
||||
|
||||
// check to see
|
||||
// if other channels are playing the sound
|
||||
for (i = 0; i < numofchannels; i++)
|
||||
if (cnum != i && c->sfxinfo == channels[i].sfxinfo)
|
||||
break;
|
||||
|
||||
c->sfxinfo = NULL;
|
||||
}
|
||||
|
||||
@@ -1046,12 +1053,14 @@ static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source,
|
||||
INT32 S_OriginPlaying(void *origin)
|
||||
{
|
||||
INT32 cnum;
|
||||
|
||||
if (!origin)
|
||||
return false;
|
||||
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
if (channels[cnum].origin == origin)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1064,6 +1073,7 @@ INT32 S_IdPlaying(sfxenum_t id)
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
if ((size_t)(channels[cnum].sfxinfo - S_sfx) == (size_t)id)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1072,6 +1082,7 @@ INT32 S_IdPlaying(sfxenum_t id)
|
||||
INT32 S_SoundPlaying(void *origin, sfxenum_t id)
|
||||
{
|
||||
INT32 cnum;
|
||||
|
||||
if (!origin)
|
||||
return 0;
|
||||
|
||||
@@ -1081,6 +1092,7 @@ INT32 S_SoundPlaying(void *origin, sfxenum_t id)
|
||||
&& (size_t)(channels[cnum].sfxinfo - S_sfx) == (size_t)id)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1093,6 +1105,7 @@ static sfxenum_t newsounds[MAXNEWSOUNDS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
void S_StartSoundName(void *mo, const char *soundname)
|
||||
{
|
||||
INT32 i, soundnum = 0;
|
||||
|
||||
// Search existing sounds...
|
||||
for (i = sfx_None + 1; i < NUMSFX; i++)
|
||||
{
|
||||
|
||||
@@ -945,7 +945,7 @@ UINT32 I_GetSongLength(void)
|
||||
|
||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
{
|
||||
if (!music|| !is_looping)
|
||||
if (!music || !is_looping)
|
||||
return false;
|
||||
|
||||
const musictype_t mustype = I_SongType();
|
||||
@@ -958,7 +958,7 @@ boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
if (length > 0)
|
||||
looppoint %= length;
|
||||
|
||||
loop_point = max((float)(looppoint / 1000.0L), 0);
|
||||
loop_point = max((float)(looppoint / 1000.0L), 0.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -975,7 +975,7 @@ sfxinfo_t S_sfx[NUMSFX] =
|
||||
char freeslotnames[sfx_freeslot0 + NUMSFXFREESLOTS + NUMSKINSFXSLOTS][7] = {};
|
||||
|
||||
// Prepare free sfx slots to add sfx at run time
|
||||
void S_InitRuntimeSounds (void)
|
||||
void S_InitRuntimeSounds(void)
|
||||
{
|
||||
sfxenum_t i;
|
||||
INT32 value;
|
||||
@@ -1040,6 +1040,7 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
I_Error("Out of Sound Freeslots while allocating \"%s\"\nLoad less addons to fix this.", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user