Merge branch 'next' into accelerometer
This commit is contained in:
commit
47207435b6
39 changed files with 3606 additions and 972 deletions
|
|
@ -118,6 +118,7 @@ add_executable(BLANKART MACOSX_BUNDLE WIN32
|
|||
lua_botvarslib.c
|
||||
lua_hudlib.c
|
||||
lua_hudlib_drawlist.c
|
||||
lua_colorlib.c
|
||||
lua_followerlib.c
|
||||
lua_terrainlib.c
|
||||
lua_waypointslib.c
|
||||
|
|
|
|||
|
|
@ -5705,6 +5705,9 @@ static INT16 Consistancy(consistancy_t *c)
|
|||
|
||||
mo = (mobj_t *)th;
|
||||
|
||||
if (!MobjIsNetSynced(mo))
|
||||
continue;
|
||||
|
||||
if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY))
|
||||
{
|
||||
c->mobjtype -= mo->type;
|
||||
|
|
@ -5734,11 +5737,11 @@ static INT16 Consistancy(consistancy_t *c)
|
|||
c->mobjstate -= mo->target->state - states;
|
||||
c->mobjtics += mo->target->tics;
|
||||
c->mobjsprite -= mo->target->sprite;
|
||||
c->mobjframe += mo->target->frame;
|
||||
//c->mobjframe += mo->target->frame;
|
||||
}
|
||||
else
|
||||
ConsistancyXOR(c, 0x3333);
|
||||
if (mo->tracer && mo->tracer->type != MT_OVERLAY)
|
||||
if (mo->tracer && MobjIsNetSynced(mo->tracer))
|
||||
{
|
||||
c->mobjtype += mo->tracer->type;
|
||||
c->position[0] -= mo->tracer->x;
|
||||
|
|
@ -5754,12 +5757,12 @@ static INT16 Consistancy(consistancy_t *c)
|
|||
c->mobjstate -= mo->tracer->state - states;
|
||||
c->mobjtics += mo->tracer->tics;
|
||||
c->mobjsprite -= mo->tracer->sprite;
|
||||
c->mobjframe += mo->tracer->frame;
|
||||
//c->mobjframe += mo->tracer->frame;
|
||||
}
|
||||
else
|
||||
ConsistancyXOR(c, 0xAAAA);
|
||||
// SRB2Kart: We use hnext & hprev very extensively
|
||||
if (mo->hnext && mo->hnext->type != MT_OVERLAY)
|
||||
if (mo->hnext && MobjIsNetSynced(mo->hnext))
|
||||
{
|
||||
c->mobjtype += mo->hnext->type;
|
||||
c->position[0] -= mo->hnext->x;
|
||||
|
|
@ -5775,11 +5778,11 @@ static INT16 Consistancy(consistancy_t *c)
|
|||
c->mobjstate -= mo->hnext->state - states;
|
||||
c->mobjtics += mo->hnext->tics;
|
||||
c->mobjsprite -= mo->hnext->sprite;
|
||||
c->mobjframe += mo->hnext->frame;
|
||||
//c->mobjframe += mo->hnext->frame;
|
||||
}
|
||||
else
|
||||
ConsistancyXOR(c, 0x5555);
|
||||
if (mo->hprev && mo->hprev->type != MT_OVERLAY)
|
||||
if (mo->hprev && MobjIsNetSynced(mo->hprev))
|
||||
{
|
||||
c->mobjtype += mo->hprev->type;
|
||||
c->position[0] -= mo->hprev->x;
|
||||
|
|
@ -5795,14 +5798,14 @@ static INT16 Consistancy(consistancy_t *c)
|
|||
c->mobjstate -= mo->hprev->state - states;
|
||||
c->mobjtics += mo->hprev->tics;
|
||||
c->mobjsprite -= mo->hprev->sprite;
|
||||
c->mobjframe += mo->hprev->frame;
|
||||
//c->mobjframe += mo->hprev->frame;
|
||||
}
|
||||
else
|
||||
ConsistancyXOR(c, 0xCCCC);
|
||||
c->mobjstate -= mo->state - states;
|
||||
c->mobjtics += mo->tics;
|
||||
c->mobjsprite -= mo->sprite;
|
||||
c->mobjframe += mo->frame;
|
||||
//c->mobjframe += mo->frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2063,6 +2063,17 @@ static void readmenuitem(MYFILE *f, menuitem_t *menuitem)
|
|||
}
|
||||
else if (fastcmp(word, "SUBMENU"))
|
||||
{
|
||||
#ifndef HAVE_DISCORDRPC
|
||||
{
|
||||
const char *testname = word2;
|
||||
if (fastncmp("MN_", testname, 3))
|
||||
testname += 3;
|
||||
if (fastcmp(testname, "OP_DISCORD") || fastcmp(testname, "MISC_DISCORDREQUESTS"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
menutype_t mn = get_menutype(word2);
|
||||
if (mn == MAXMENUTYPES)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -675,6 +675,18 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
continue; // dedis don't need menus, silly!
|
||||
}
|
||||
|
||||
#ifndef HAVE_DISCORDRPC
|
||||
{
|
||||
const char *testname = word2;
|
||||
if (fastncmp("MN_", testname, 3))
|
||||
testname += 3;
|
||||
if (fastcmp(testname, "OP_DISCORD") || fastcmp(testname, "MISC_DISCORDREQUESTS"))
|
||||
{
|
||||
ignoremenulines(f);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||
i = get_menutype(word2); // find a huditem by name
|
||||
if (i >= 1 && i < nummenutypes)
|
||||
|
|
|
|||
17
src/g_game.c
17
src/g_game.c
|
|
@ -1703,17 +1703,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
return;
|
||||
}
|
||||
|
||||
fixed_t deadZoneY = cv_deadzoney[forplayer].value;
|
||||
const double deadZoneYDecimal = (double) deadZoneY / FRACUNIT;
|
||||
joystickvector.xaxis = G_PlayerInputAnalog(forplayer, gc_turnright, false, DEADZONE_X) - G_PlayerInputAnalog(forplayer, gc_turnleft, false, DEADZONE_X);
|
||||
if (deadZoneYDecimal <= 0)
|
||||
{
|
||||
joystickvector.yaxis = G_PlayerInputAnalog(forplayer, gc_aimbackward, false, DEADZONE_Y) - G_PlayerInputAnalog(forplayer, gc_aimforward, false, DEADZONE_Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
joystickvector.yaxis = 0;
|
||||
}
|
||||
joystickvector.yaxis = 0;
|
||||
G_HandleAxisDeadZone(forplayer, &joystickvector);
|
||||
|
||||
// tilt control never has deadzone
|
||||
|
|
@ -1731,11 +1722,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
// This mean that the turn axis will still be gradient but up/down will be 0
|
||||
// until the stick is pushed far enough
|
||||
//
|
||||
// When the deadzone is set to 0 or lower, the aim axis returns to analog to avoid breaking the chasecam and freecam controls
|
||||
if (deadZoneYDecimal > 0)
|
||||
{
|
||||
joystickvector.yaxis = G_PlayerInputAnalog(forplayer, gc_aimbackward, false, DEADZONE_Y) - G_PlayerInputAnalog(forplayer, gc_aimforward, false, DEADZONE_Y);
|
||||
}
|
||||
joystickvector.yaxis = G_PlayerInputAnalog(forplayer, gc_aimbackward, false, DEADZONE_Y) - G_PlayerInputAnalog(forplayer, gc_aimforward, false, DEADZONE_Y);
|
||||
|
||||
if (encoremode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ static void HWR_AddPolyObjectPlanes(void)
|
|||
sector_t *polyobjsector;
|
||||
INT32 light = 0;
|
||||
|
||||
// Polyobject Planes need their own function for drawing because they don't have extrasubsectors by themselves
|
||||
// Polyobject Planes need their own function for drawing because they don't have poly_subsectors by themselves
|
||||
// It should be okay because polyobjects should always be convex anyway
|
||||
|
||||
for (i = 0; i < numpolys; i++)
|
||||
|
|
@ -567,9 +567,9 @@ static void HWR_Subsector(size_t num)
|
|||
// CONS_Printf("subsector %d in portal\n", (INT32)num);
|
||||
|
||||
#ifdef PARANOIA //no risk while developing, enough debugging nights!
|
||||
if (num >= addsubsector)
|
||||
if (num >= num_poly_subsector)
|
||||
I_Error("HWR_Subsector: ss %s with numss = %s, addss = %s\n",
|
||||
sizeu1(num), sizeu2(numsubsectors), sizeu3(addsubsector));
|
||||
sizeu1(num), sizeu2(numsubsectors), sizeu3(num_poly_subsector));
|
||||
|
||||
/*if (num >= numsubsectors)
|
||||
I_Error("HWR_Subsector: ss %i with numss = %i",
|
||||
|
|
@ -668,7 +668,7 @@ static void HWR_Subsector(size_t num)
|
|||
if (sub->validcount != validcount)
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[gl_frontsector->floorpic], R_NoEncore(gl_frontsector, &levelflats[gl_frontsector->floorpic], false));
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false,
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], false,
|
||||
// Hack to make things continue to work around slopes.
|
||||
locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight,
|
||||
// We now return you to your regularly scheduled rendering.
|
||||
|
|
@ -685,7 +685,7 @@ static void HWR_Subsector(size_t num)
|
|||
if (sub->validcount != validcount)
|
||||
{
|
||||
HWR_GetLevelFlat(&levelflats[gl_frontsector->ceilingpic], R_NoEncore(gl_frontsector, &levelflats[gl_frontsector->ceilingpic], true));
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true,
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], true,
|
||||
// Hack to make things continue to work around slopes.
|
||||
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight,
|
||||
// We now return you to your regularly scheduled rendering.
|
||||
|
|
@ -725,7 +725,7 @@ static void HWR_Subsector(size_t num)
|
|||
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
|
|
@ -740,7 +740,7 @@ static void HWR_Subsector(size_t num)
|
|||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
|
||||
HWR_AddTransparentFloor(&levelflats[*rover->bottompic],
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
false,
|
||||
*rover->bottomheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
|
|
@ -751,7 +751,7 @@ static void HWR_Subsector(size_t num)
|
|||
{
|
||||
HWR_GetLevelFlat(&levelflats[*rover->bottompic], R_NoEncore(gl_frontsector, &levelflats[*rover->bottompic], false));
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false) | PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic],
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false) | PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic],
|
||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
|
|
@ -773,7 +773,7 @@ static void HWR_Subsector(size_t num)
|
|||
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
|
||||
|
||||
HWR_AddTransparentFloor(0,
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
|
|
@ -788,7 +788,7 @@ static void HWR_Subsector(size_t num)
|
|||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
|
||||
HWR_AddTransparentFloor(&levelflats[*rover->toppic],
|
||||
&extrasubsectors[num],
|
||||
&poly_subsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
*gl_frontsector->lightlist[light].lightlevel,
|
||||
|
|
@ -799,7 +799,7 @@ static void HWR_Subsector(size_t num)
|
|||
{
|
||||
HWR_GetLevelFlat(&levelflats[*rover->toppic], R_NoEncore(gl_frontsector, &levelflats[*rover->toppic], true));
|
||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, true) | PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic],
|
||||
HWR_RenderPlane(sub, &poly_subsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, true) | PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic],
|
||||
rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,9 +299,6 @@ struct FSurfaceInfo
|
|||
};
|
||||
typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
|
||||
#define GL_DEFAULTMIX 0x00000000
|
||||
#define GL_DEFAULTFOG 0x19000000
|
||||
|
||||
// Various settings and states for the rendering backend.
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
extrasubsector_t *xsub;
|
||||
poly_subsector_t *xsub;
|
||||
boolean isceiling;
|
||||
fixed_t fixedheight;
|
||||
INT32 lightlevel;
|
||||
|
|
@ -143,7 +143,7 @@ void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 te
|
|||
}
|
||||
|
||||
// This will likely turn into a copy of HWR_Add3DWater and replace it.
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap)
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap)
|
||||
{
|
||||
planeinfo_t *planeinfo = HWR_CreateDrawNode(DRAWNODE_PLANE);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
poly_t *planepoly; // the generated convex polygon
|
||||
} extrasubsector_t;
|
||||
} poly_subsector_t;
|
||||
|
||||
// needed for sprite rendering
|
||||
// equivalent of the software renderer's vissprites
|
||||
|
|
@ -117,16 +117,14 @@ typedef struct gl_vissprite_s
|
|||
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model);
|
||||
|
||||
// --------
|
||||
// hw_bsp.c
|
||||
// hw_map.c
|
||||
// --------
|
||||
extern extrasubsector_t *extrasubsectors;
|
||||
extern size_t addsubsector;
|
||||
extern poly_subsector_t *poly_subsectors;
|
||||
extern size_t num_poly_subsector;
|
||||
|
||||
void HWR_InitPolyPool(void);
|
||||
void HWR_FreePolyPool(void);
|
||||
|
||||
void HWR_FreeExtraSubsectors(void);
|
||||
|
||||
// --------
|
||||
// hw_cache.c
|
||||
// --------
|
||||
|
|
@ -176,7 +174,7 @@ extern INT32 textureformat;
|
|||
// --------
|
||||
// hw_plane.c
|
||||
// --------
|
||||
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
void HWR_RenderPlane(subsector_t *subsector, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
|
||||
FBITFIELD blendmode, UINT8 lightlevel, levelflat_t *levelflat, sector_t *FOFsector,
|
||||
UINT8 alpha, extracolormap_t *planecolormap);
|
||||
|
|
@ -185,7 +183,7 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t
|
|||
// hw_drawnodes.c
|
||||
// --------
|
||||
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentFloor(levelflat_t *levelflat, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
|
||||
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
||||
void HWR_PushDrawNodeState(void);
|
||||
|
|
|
|||
|
|
@ -398,8 +398,8 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
|||
RGBA_t poly_color, tint_color, fade_color;
|
||||
|
||||
poly_color.rgba = 0xFFFFFFFF;
|
||||
tint_color.rgba = (colormap != NULL) ? (UINT32)colormap->rgba : GL_DEFAULTMIX;
|
||||
fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : GL_DEFAULTFOG;
|
||||
tint_color.rgba = (colormap != NULL) ? (UINT32)colormap->rgba : 0x00000000;
|
||||
fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : 0xFF000000;
|
||||
|
||||
// Crappy backup coloring if you can't do shaders
|
||||
if (!HWR_UseShader())
|
||||
|
|
@ -413,7 +413,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
|
|||
blue = (float)poly_color.s.blue;
|
||||
|
||||
// 48 is just an arbritrary value that looked relatively okay.
|
||||
tint_alpha = (float)(sqrt(tint_color.s.alpha) * 48) / 255.0f;
|
||||
tint_alpha = (float)(sqrt((float)tint_color.s.alpha / 10.2) * 48) / 255.0f;
|
||||
|
||||
// 8 is roughly the brightness of the "close" color in Software, and 16 the brightness of the "far" color.
|
||||
// 8 is too bright for dark levels, and 16 is too dark for bright levels.
|
||||
|
|
@ -469,7 +469,7 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if
|
|||
RGBA_t realcolor, surfcolor;
|
||||
INT32 alpha;
|
||||
|
||||
realcolor.rgba = (colormap != NULL) ? colormap->rgba : GL_DEFAULTMIX;
|
||||
realcolor.rgba = (colormap != NULL) ? colormap->rgba : 0x00000000;
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
|
|
@ -1255,6 +1255,17 @@ consvar_t cv_glanisotropicmode = CVAR_INIT ("gr_anisotropicmode", "1", CV_SAVE|C
|
|||
|
||||
consvar_t cv_glsolvetjoin = CVAR_INIT ("gr_solvetjoin", "On", 0, CV_OnOff, NULL);
|
||||
|
||||
consvar_t cv_glpolytile = CVAR_INIT ("gr_polytile", "On", 0, CV_OnOff, NULL);
|
||||
|
||||
CV_PossibleValue_t grpolyshape_cons_t[] = {
|
||||
{0, "Subsector"},
|
||||
{1, "Fat"},
|
||||
{2, "Trim"},
|
||||
{3, "NotConvex"},
|
||||
{0, NULL}
|
||||
};
|
||||
consvar_t cv_glpolyshape = CVAR_INIT ("gr_polygon_shape", "Trim", CV_SAVE, grpolyshape_cons_t, NULL);
|
||||
|
||||
consvar_t cv_glbatching = CVAR_INIT ("gr_batching", "On", 0, CV_OnOff, NULL);
|
||||
|
||||
CV_PossibleValue_t glpalettedepth_cons_t[] = {{16, "16 bits"}, {24, "24 bits"}, {0, NULL}};
|
||||
|
|
@ -1365,7 +1376,10 @@ void HWR_AddCommands(void)
|
|||
CV_RegisterVar(&cv_glallowshaders);
|
||||
|
||||
CV_RegisterVar(&cv_glfiltermode);
|
||||
|
||||
CV_RegisterVar(&cv_glsolvetjoin);
|
||||
CV_RegisterVar(&cv_glpolytile);
|
||||
CV_RegisterVar(&cv_glpolyshape);
|
||||
|
||||
CV_RegisterVar(&cv_glbatching);
|
||||
|
||||
|
|
@ -1399,6 +1413,7 @@ void HWR_Startup(void)
|
|||
textureformat = patchformat = GL_TEXFMT_RGBA;
|
||||
|
||||
HWR_InitPolyPool();
|
||||
|
||||
HWR_AddSessionCommands();
|
||||
HWR_InitMapTextures();
|
||||
HWR_InitModels();
|
||||
|
|
@ -1445,7 +1460,6 @@ void HWR_Switch(void)
|
|||
void HWR_Shutdown(void)
|
||||
{
|
||||
CONS_Printf("HWR_Shutdown()\n");
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreePolyPool();
|
||||
HWR_FreeMapTextures();
|
||||
GL_FlushScreenTextures();
|
||||
|
|
|
|||
|
|
@ -110,11 +110,13 @@ extern consvar_t cv_glmodellighting;
|
|||
extern consvar_t cv_glfiltermode;
|
||||
extern consvar_t cv_glanisotropicmode;
|
||||
extern consvar_t cv_fovchange;
|
||||
extern consvar_t cv_glsolvetjoin;
|
||||
|
||||
extern consvar_t cv_glshearing;
|
||||
extern consvar_t cv_glspritebillboarding;
|
||||
extern consvar_t cv_glskydome;
|
||||
|
||||
extern consvar_t cv_glsolvetjoin, cv_glpolytile, cv_glpolyshape;
|
||||
|
||||
extern consvar_t cv_glbatching;
|
||||
extern consvar_t cv_glpaletterendering;
|
||||
extern consvar_t cv_glpalettedepth;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -40,7 +40,7 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t
|
|||
// -----------------+
|
||||
// HWR_RenderPlane : Render a floor or ceiling convex polygon
|
||||
// -----------------+
|
||||
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap)
|
||||
void HWR_RenderPlane(subsector_t *subsector, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap)
|
||||
{
|
||||
polyvertex_t * pv;
|
||||
float height; //constant y for all points on the convex flat polygon
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@
|
|||
#define GLSL_SOFTWARE_TINT_EQUATION \
|
||||
"if (mix(tint_color.a, 0.0, brightmap_mix) > 0.0) {\n" \
|
||||
"float color_bright = sqrt((base_color.r * base_color.r) + (base_color.g * base_color.g) + (base_color.b * base_color.b));\n" \
|
||||
"float strength = sqrt(9.0 * mix(tint_color.a, 0.0, brightmap_mix));\n" \
|
||||
"float strength = sqrt(mix(tint_color.a, 0.0, brightmap_mix));\n" \
|
||||
"final_color.r = clamp((color_bright * (tint_color.r * strength)) + (base_color.r * (1.0 - strength)), 0.0, 1.0);\n" \
|
||||
"final_color.g = clamp((color_bright * (tint_color.g * strength)) + (base_color.g * (1.0 - strength)), 0.0, 1.0);\n" \
|
||||
"final_color.b = clamp((color_bright * (tint_color.b * strength)) + (base_color.b * (1.0 - strength)), 0.0, 1.0);\n" \
|
||||
|
|
@ -283,16 +283,16 @@
|
|||
#define GLSL_WATER_TEXEL \
|
||||
"float water_z = (gl_FragCoord.z / gl_FragCoord.w) / 2.0;\n" \
|
||||
"float a = -pi * (water_z * freq) + (leveltime * speed);\n" \
|
||||
"float sdistort = sin(a) * amp;\n" \
|
||||
"float cdistort = cos(a) * amp;\n" \
|
||||
"float sdistort = sin(a) * amp * 1.5;\n" \
|
||||
"float cdistort = cos(a) * amp * 2.2;\n" \
|
||||
"vec4 texel = texture2D(tex, vec2(gl_TexCoord[0].s - sdistort, gl_TexCoord[0].t - cdistort));\n"
|
||||
|
||||
#define GLSL_WATER_FRAGMENT_SHADER \
|
||||
"#version 120\n" \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
"const float freq = 0.025;\n" \
|
||||
"const float freq = 0.03;\n" \
|
||||
"const float amp = 0.025;\n" \
|
||||
"const float speed = 2.0;\n" \
|
||||
"const float speed = 1.6;\n" \
|
||||
"const float pi = 3.14159;\n" \
|
||||
"#ifdef SRB2_PALETTE_RENDERING\n" \
|
||||
"uniform sampler2D tex;\n" \
|
||||
|
|
|
|||
13
src/k_kart.c
13
src/k_kart.c
|
|
@ -7160,6 +7160,19 @@ static void K_AirDrop(player_t *player, ticcmd_t *cmd)
|
|||
player->airdroppredelay++;
|
||||
}
|
||||
|
||||
void K_KillAirDrop(player_t *player, p_airdropflags_t airdropflags)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (player->airdropflags & airdropflags)
|
||||
{
|
||||
player->airdroptime = 0;
|
||||
player->airdroppredelay = 0;
|
||||
player->airdropflags &= ~PAF_AIRDROP_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the bumpspark value as an enum.
|
||||
INT32 K_GetBumpSpark(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -414,6 +414,8 @@ typedef enum
|
|||
AIRDROP_FUSION,
|
||||
} airdroptype_t;
|
||||
|
||||
void K_KillAirDrop(player_t *player, p_airdropflags_t airdropflags);
|
||||
|
||||
boolean K_NullDriftTiltEnabled(void);
|
||||
|
||||
#define RECOVERYDASHADD (TICRATE/2)
|
||||
|
|
|
|||
|
|
@ -232,6 +232,8 @@ static const struct {
|
|||
|
||||
{META_PATCH, "patch_t"},
|
||||
{META_COLORMAP, "colormap"},
|
||||
{META_EXTRACOLORMAP,"extracolormap_t"},
|
||||
{META_LIGHTTABLE, "lighttable_t"},
|
||||
{META_CAMERA, "camera_t"},
|
||||
|
||||
{META_ACTION, "action"},
|
||||
|
|
@ -1793,7 +1795,6 @@ static int lib_pGetSectorLightLevelAt(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Maybe color lib someday....
|
||||
static int lib_pGetSectorColormapAt(lua_State *L)
|
||||
{
|
||||
boolean has_sector = false;
|
||||
|
|
@ -1817,7 +1818,6 @@ static int lib_pGetSectorColormapAt(lua_State *L)
|
|||
LUA_PushUserdata(L, exc, META_EXTRACOLORMAP);
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
static int lib_pDoSpring(lua_State *L)
|
||||
{
|
||||
|
|
@ -4375,6 +4375,18 @@ static int lib_kSafeRespawnPositionEx(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_kKillAirDrop(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
p_airdropflags_t airdropflags = luaL_checkinteger(L, 2);
|
||||
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
K_KillAirDrop(player, airdropflags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Checks if Rings are applicable.
|
||||
static int lib_kRingsActive(lua_State *L)
|
||||
{
|
||||
|
|
@ -5589,7 +5601,7 @@ static luaL_Reg lib[] = {
|
|||
{"P_FloorzAtPos",lib_pFloorzAtPos},
|
||||
{"P_CeilingzAtPos",lib_pCeilingzAtPos},
|
||||
{"P_GetSectorLightLevelAt",lib_pGetSectorLightLevelAt},
|
||||
//{"P_GetSectorColormapAt",lib_pGetSectorColormapAt},
|
||||
{"P_GetSectorColormapAt",lib_pGetSectorColormapAt},
|
||||
{"P_DoSpring",lib_pDoSpring},
|
||||
|
||||
// p_inter
|
||||
|
|
@ -5770,6 +5782,7 @@ static luaL_Reg lib[] = {
|
|||
{"K_SetHyudoroCooldown",lib_kSetHyuCountdown},
|
||||
{"K_SafeRespawnPosition",lib_kSafeRespawnPosition},
|
||||
{"K_SafeRespawnPositionEx",lib_kSafeRespawnPositionEx},
|
||||
{"K_KillAirDrop", lib_kKillAirDrop},
|
||||
|
||||
{"K_GetCollideAngle",lib_kGetCollideAngle},
|
||||
|
||||
|
|
|
|||
647
src/lua_colorlib.c
Normal file
647
src/lua_colorlib.c
Normal file
|
|
@ -0,0 +1,647 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2021-2022 by "Lactozilla".
|
||||
// Copyright (C) 2014-2023 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file lua_colorlib.c
|
||||
/// \brief color and colormap libraries for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "fastcmp.h"
|
||||
#include "r_data.h"
|
||||
#include "v_video.h"
|
||||
#include "k_color.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
#define COLORLIB_USE_LOOKUP
|
||||
|
||||
#ifdef COLORLIB_USE_LOOKUP
|
||||
static colorlookup_t colormix_lut;
|
||||
#define GetNearestColor(r, g, b) GetColorLUT(&colormix_lut, r, g, b)
|
||||
#else
|
||||
#define GetNearestColor(r, g, b) NearestPaletteColor(r, g, b, pMasterPalette)
|
||||
#endif
|
||||
|
||||
////////////////
|
||||
// Color library
|
||||
////////////////
|
||||
|
||||
static int lib_colorPaletteToRgb(lua_State *L)
|
||||
{
|
||||
RGBA_t color = V_GetMasterColor((UINT8)luaL_checkinteger(L, 1));
|
||||
lua_pushinteger(L, color.s.red);
|
||||
lua_pushinteger(L, color.s.green);
|
||||
lua_pushinteger(L, color.s.blue);
|
||||
return 3;
|
||||
}
|
||||
|
||||
#define IS_HEX_CHAR(x) ((x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') || (x >= 'A' && x <= 'F'))
|
||||
#define ARE_HEX_CHARS(str, i) IS_HEX_CHAR(str[i]) && IS_HEX_CHAR(str[i + 1])
|
||||
|
||||
static UINT32 hex2int(char x)
|
||||
{
|
||||
if (x >= '0' && x <= '9')
|
||||
return x - '0';
|
||||
else if (x >= 'a' && x <= 'f')
|
||||
return x - 'a' + 10;
|
||||
else if (x >= 'A' && x <= 'F')
|
||||
return x - 'A' + 10;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UINT8 GetHTMLColorLength(const char *str)
|
||||
{
|
||||
if (str[0] == '#')
|
||||
str++;
|
||||
return strlen(str) >= 8 ? 4 : 3;
|
||||
}
|
||||
|
||||
static UINT8 ParseHTMLColor(const char *str, UINT8 *rgba, size_t numc)
|
||||
{
|
||||
const char *hex = str;
|
||||
|
||||
if (hex[0] == '#')
|
||||
hex++;
|
||||
else if (!IS_HEX_CHAR(hex[0]))
|
||||
return 0;
|
||||
|
||||
size_t len = strlen(hex);
|
||||
|
||||
if (len == 3)
|
||||
{
|
||||
// Shorthand like #09C
|
||||
for (unsigned i = 0; i < 3; i++)
|
||||
{
|
||||
if (!IS_HEX_CHAR(hex[i]))
|
||||
return 0;
|
||||
|
||||
UINT32 hx = hex2int(hex[i]);
|
||||
*rgba++ = (hx * 16) + hx;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
else if (len == 6 || len == 8)
|
||||
{
|
||||
if (numc != 4)
|
||||
len = 6;
|
||||
|
||||
// A triplet like #0099CC
|
||||
for (unsigned i = 0; i < len; i += 2)
|
||||
{
|
||||
if (!ARE_HEX_CHARS(hex, i))
|
||||
return false;
|
||||
|
||||
*rgba++ = (hex2int(hex[i]) * 16) + hex2int(hex[i + 1]);
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UINT8 GetPackedRGBA(UINT32 colors, UINT8 *rgba)
|
||||
{
|
||||
if (colors > 0xFFFFFF)
|
||||
{
|
||||
rgba[0] = (colors >> 24) & 0xFF;
|
||||
rgba[1] = (colors >> 16) & 0xFF;
|
||||
rgba[2] = (colors >> 8) & 0xFF;
|
||||
rgba[3] = colors & 0xFF;
|
||||
return 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
rgba[0] = (colors >> 16) & 0xFF;
|
||||
rgba[1] = (colors >> 8) & 0xFF;
|
||||
rgba[2] = colors & 0xFF;
|
||||
rgba[3] = 0xFF;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 GetArgsRGBA(lua_State *L, UINT8 index, INT32 *r, INT32 *g, INT32 *b, INT32 *a)
|
||||
{
|
||||
UINT8 rgba[4] = { 0, 0, 0, 255 };
|
||||
UINT8 num = 0;
|
||||
|
||||
if (lua_gettop(L) == 1 && lua_type(L, index) == LUA_TNUMBER)
|
||||
{
|
||||
num = GetPackedRGBA(luaL_checkinteger(L, 1), rgba);
|
||||
|
||||
*r = rgba[0];
|
||||
*g = rgba[1];
|
||||
*b = rgba[2];
|
||||
if (a)
|
||||
*a = rgba[3];
|
||||
}
|
||||
else if (lua_type(L, index) == LUA_TSTRING)
|
||||
{
|
||||
const char *str = lua_tostring(L, index);
|
||||
UINT8 parsed = ParseHTMLColor(str, rgba, GetHTMLColorLength(str));
|
||||
if (!parsed)
|
||||
luaL_error(L, "Malformed HTML color '%s'", str);
|
||||
|
||||
num = parsed == 8 ? 4 : 3;
|
||||
|
||||
*r = rgba[0];
|
||||
*g = rgba[1];
|
||||
*b = rgba[2];
|
||||
if (a)
|
||||
*a = rgba[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 temp;
|
||||
|
||||
#define CHECKINT(i) luaL_checkinteger(L, i)
|
||||
#define GETCOLOR(c, i, desc) { \
|
||||
temp = CHECKINT(i); \
|
||||
if (temp < 0 || temp > 255) \
|
||||
luaL_error(L, desc " channel %d out of range (0 - 255)", temp); \
|
||||
c = temp; \
|
||||
num++; \
|
||||
}
|
||||
|
||||
GETCOLOR(*r, index + 0, "red color");
|
||||
GETCOLOR(*g, index + 1, "green color");
|
||||
GETCOLOR(*b, index + 2, "blue color");
|
||||
#undef CHECKINT
|
||||
#define CHECKINT(i) luaL_optinteger(L, i, 255)
|
||||
if (a)
|
||||
GETCOLOR(*a, index + 3, "alpha");
|
||||
#undef CHECKINT
|
||||
#undef GETCOLOR
|
||||
|
||||
num = 3 + (lua_type(L, index + 3) == LUA_TNUMBER);
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
static int lib_colorRgbToPalette(lua_State *L)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
GetArgsRGBA(L, 1, &r, &g, &b, NULL);
|
||||
|
||||
#ifdef COLORLIB_USE_LOOKUP
|
||||
InitColorLUT(&colormix_lut, pMasterPalette, false);
|
||||
#endif
|
||||
|
||||
lua_pushinteger(L, GetNearestColor(r, g, b));
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define SCALE_UINT8_TO_FIXED(val) FixedDiv(val * FRACUNIT, 255 * FRACUNIT)
|
||||
#define SCALE_FIXED_TO_UINT8(val) FixedRound(FixedMul(val, 255 * FRACUNIT)) / FRACUNIT
|
||||
|
||||
static fixed_t hue2rgb(fixed_t p, fixed_t q, fixed_t t)
|
||||
{
|
||||
if (t < 0)
|
||||
t += FRACUNIT;
|
||||
if (t > FRACUNIT)
|
||||
t -= FRACUNIT;
|
||||
|
||||
fixed_t out;
|
||||
|
||||
if (t < FRACUNIT / 6)
|
||||
out = p + FixedMul(FixedMul(q - p, 6 * FRACUNIT), t);
|
||||
else if (t < FRACUNIT / 2)
|
||||
out = q;
|
||||
else if (t < 2 * FRACUNIT / 3)
|
||||
out = p + FixedMul(FixedMul(q - p, 2 * FRACUNIT / 3 - t), 6 * FRACUNIT);
|
||||
else
|
||||
out = p;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
static int lib_colorHslToRgb(lua_State *L)
|
||||
{
|
||||
fixed_t h, s, l;
|
||||
|
||||
#define GETHSL(c, i, desc) \
|
||||
c = luaL_checkinteger(L, i); \
|
||||
if (c < 0 || c > 255) \
|
||||
luaL_error(L, desc " %d out of range (0 - 255)", c)
|
||||
|
||||
GETHSL(h, 1, "hue");
|
||||
GETHSL(s, 2, "saturation");
|
||||
GETHSL(l, 3, "value");
|
||||
#undef GETHSL
|
||||
|
||||
if (!s)
|
||||
{
|
||||
lua_pushinteger(L, l);
|
||||
lua_pushinteger(L, l);
|
||||
lua_pushinteger(L, l);
|
||||
}
|
||||
else
|
||||
{
|
||||
h = SCALE_UINT8_TO_FIXED(h);
|
||||
s = SCALE_UINT8_TO_FIXED(s);
|
||||
l = SCALE_UINT8_TO_FIXED(l);
|
||||
|
||||
fixed_t q, p;
|
||||
|
||||
if (l < FRACUNIT/2)
|
||||
q = FixedMul(l, FRACUNIT + s);
|
||||
else
|
||||
q = l + s - FixedMul(l, s);
|
||||
|
||||
p = l * 2 - q;
|
||||
|
||||
lua_pushinteger(L, SCALE_FIXED_TO_UINT8(hue2rgb(p, q, h + FRACUNIT/3)));
|
||||
lua_pushinteger(L, SCALE_FIXED_TO_UINT8(hue2rgb(p, q, h)));
|
||||
lua_pushinteger(L, SCALE_FIXED_TO_UINT8(hue2rgb(p, q, h - FRACUNIT/3)));
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
static int lib_colorRgbToHsl(lua_State *L)
|
||||
{
|
||||
INT32 ir, ig, ib;
|
||||
GetArgsRGBA(L, 1, &ir, &ig, &ib, NULL);
|
||||
|
||||
fixed_t r = SCALE_UINT8_TO_FIXED(ir);
|
||||
fixed_t g = SCALE_UINT8_TO_FIXED(ig);
|
||||
fixed_t b = SCALE_UINT8_TO_FIXED(ib);
|
||||
|
||||
fixed_t cmin = min(min(r, g), b);
|
||||
fixed_t cmax = max(max(r, g), b);
|
||||
|
||||
fixed_t h, s, l = (cmax + cmin) / 2;
|
||||
fixed_t delta = cmax - cmin;
|
||||
|
||||
if (!delta)
|
||||
h = s = 0;
|
||||
else
|
||||
{
|
||||
if (l > FRACUNIT / 2)
|
||||
s = FixedDiv(delta, (FRACUNIT * 2) - cmax - cmin);
|
||||
else
|
||||
s = FixedDiv(delta, cmax + cmin);
|
||||
|
||||
if (r > g && r > b)
|
||||
{
|
||||
h = FixedDiv(g - b, delta);
|
||||
|
||||
if (g < b)
|
||||
h += FRACUNIT * 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = FixedDiv(r - g, delta);
|
||||
|
||||
if (g > b)
|
||||
h += FRACUNIT * 2;
|
||||
else
|
||||
h += FRACUNIT * 4;
|
||||
}
|
||||
|
||||
h = FixedDiv(h, FRACUNIT * 6);
|
||||
}
|
||||
|
||||
lua_pushinteger(L, SCALE_FIXED_TO_UINT8(h));
|
||||
lua_pushinteger(L, SCALE_FIXED_TO_UINT8(s));
|
||||
lua_pushinteger(L, SCALE_FIXED_TO_UINT8(l));
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
static int lib_colorHexToRgb(lua_State *L)
|
||||
{
|
||||
UINT8 rgba[4] = { 0, 0, 0, 255 };
|
||||
|
||||
const char *str = luaL_checkstring(L, 1);
|
||||
UINT8 parsed = ParseHTMLColor(str, rgba, 4), num = 3;
|
||||
if (!parsed)
|
||||
luaL_error(L, "Malformed HTML color '%s'", str);
|
||||
else if (parsed == 8)
|
||||
num++;
|
||||
|
||||
lua_pushinteger(L, rgba[0]);
|
||||
lua_pushinteger(L, rgba[1]);
|
||||
lua_pushinteger(L, rgba[2]);
|
||||
if (num == 4)
|
||||
lua_pushinteger(L, rgba[3]);
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
static int lib_colorRgbToHex(lua_State *L)
|
||||
{
|
||||
INT32 r, g, b, a;
|
||||
UINT8 num = GetArgsRGBA(L, 1, &r, &g, &b, &a);
|
||||
|
||||
char buffer[10];
|
||||
if (num >= 4)
|
||||
snprintf(buffer, sizeof buffer, "#%02X%02X%02X%02X", r, g, b, a);
|
||||
else
|
||||
snprintf(buffer, sizeof buffer, "#%02X%02X%02X", r, g, b);
|
||||
|
||||
lua_pushstring(L, buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_colorPackRgb(lua_State *L)
|
||||
{
|
||||
INT32 r, g, b;
|
||||
|
||||
GetArgsRGBA(L, 1, &r, &g, &b, NULL);
|
||||
|
||||
UINT32 packed = ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
|
||||
|
||||
lua_pushinteger(L, packed);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_colorPackRgba(lua_State *L)
|
||||
{
|
||||
INT32 r, g, b, a;
|
||||
|
||||
GetArgsRGBA(L, 1, &r, &g, &b, &a);
|
||||
|
||||
UINT32 packed = ((r & 0xFF) << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | (a & 0xFF);
|
||||
|
||||
lua_pushinteger(L, packed);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_colorUnpackRgb(lua_State *L)
|
||||
{
|
||||
UINT8 rgba[4];
|
||||
|
||||
UINT8 num = GetPackedRGBA(lua_tointeger(L, 1), rgba);
|
||||
|
||||
for (UINT8 i = 0; i < num; i++)
|
||||
{
|
||||
lua_pushinteger(L, rgba[i]);
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
static luaL_Reg color_lib[] = {
|
||||
{"paletteToRgb", lib_colorPaletteToRgb},
|
||||
{"rgbToPalette", lib_colorRgbToPalette},
|
||||
{"hslToRgb", lib_colorHslToRgb},
|
||||
{"rgbToHsl", lib_colorRgbToHsl},
|
||||
{"hexToRgb", lib_colorHexToRgb},
|
||||
{"rgbToHex", lib_colorRgbToHex},
|
||||
{"packRgb", lib_colorPackRgb},
|
||||
{"packRgba", lib_colorPackRgba},
|
||||
{"unpackRgb", lib_colorUnpackRgb},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/////////////////////////
|
||||
// extracolormap userdata
|
||||
/////////////////////////
|
||||
|
||||
enum extracolormap_e {
|
||||
extracolormap_red = 0,
|
||||
extracolormap_green,
|
||||
extracolormap_blue,
|
||||
extracolormap_alpha,
|
||||
extracolormap_color,
|
||||
extracolormap_fade_red,
|
||||
extracolormap_fade_green,
|
||||
extracolormap_fade_blue,
|
||||
extracolormap_fade_alpha,
|
||||
extracolormap_fade_color,
|
||||
extracolormap_fade_start,
|
||||
extracolormap_fade_end,
|
||||
extracolormap_colormap
|
||||
};
|
||||
|
||||
static const char *const extracolormap_opt[] = {
|
||||
"red",
|
||||
"green",
|
||||
"blue",
|
||||
"alpha",
|
||||
"color",
|
||||
"fade_red",
|
||||
"fade_green",
|
||||
"fade_blue",
|
||||
"fade_alpha",
|
||||
"fade_color",
|
||||
"fade_start",
|
||||
"fade_end",
|
||||
"colormap",
|
||||
NULL};
|
||||
|
||||
static int extracolormap_get(lua_State *L)
|
||||
{
|
||||
extracolormap_t *exc = *((extracolormap_t **)luaL_checkudata(L, 1, META_EXTRACOLORMAP));
|
||||
enum extracolormap_e field = luaL_checkoption(L, 2, NULL, extracolormap_opt);
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case extracolormap_red:
|
||||
lua_pushinteger(L, R_GetRgbaR(exc->rgba));
|
||||
break;
|
||||
case extracolormap_green:
|
||||
lua_pushinteger(L, R_GetRgbaG(exc->rgba));
|
||||
break;
|
||||
case extracolormap_blue:
|
||||
lua_pushinteger(L, R_GetRgbaB(exc->rgba));
|
||||
break;
|
||||
case extracolormap_alpha:
|
||||
lua_pushinteger(L, R_GetRgbaA(exc->rgba));
|
||||
break;
|
||||
case extracolormap_color:
|
||||
lua_pushinteger(L, R_GetRgbaR(exc->rgba));
|
||||
lua_pushinteger(L, R_GetRgbaG(exc->rgba));
|
||||
lua_pushinteger(L, R_GetRgbaB(exc->rgba));
|
||||
lua_pushinteger(L, R_GetRgbaA(exc->rgba));
|
||||
return 4;
|
||||
case extracolormap_fade_red:
|
||||
lua_pushinteger(L, R_GetRgbaR(exc->fadergba));
|
||||
break;
|
||||
case extracolormap_fade_green:
|
||||
lua_pushinteger(L, R_GetRgbaG(exc->fadergba));
|
||||
break;
|
||||
case extracolormap_fade_blue:
|
||||
lua_pushinteger(L, R_GetRgbaB(exc->fadergba));
|
||||
break;
|
||||
case extracolormap_fade_alpha:
|
||||
lua_pushinteger(L, R_GetRgbaA(exc->fadergba));
|
||||
break;
|
||||
case extracolormap_fade_color:
|
||||
lua_pushinteger(L, R_GetRgbaR(exc->fadergba));
|
||||
lua_pushinteger(L, R_GetRgbaG(exc->fadergba));
|
||||
lua_pushinteger(L, R_GetRgbaB(exc->fadergba));
|
||||
lua_pushinteger(L, R_GetRgbaA(exc->fadergba));
|
||||
return 4;
|
||||
case extracolormap_fade_start:
|
||||
lua_pushinteger(L, exc->fadestart);
|
||||
break;
|
||||
case extracolormap_fade_end:
|
||||
lua_pushinteger(L, exc->fadeend);
|
||||
break;
|
||||
case extracolormap_colormap:
|
||||
LUA_PushUserdata(L, exc->colormap, META_LIGHTTABLE);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void GetExtraColormapRGBA(lua_State *L, UINT8 *rgba, int arg)
|
||||
{
|
||||
if (lua_type(L, arg) == LUA_TSTRING)
|
||||
{
|
||||
const char *str = lua_tostring(L, arg);
|
||||
UINT8 parsed = ParseHTMLColor(str, rgba, 4);
|
||||
if (!parsed)
|
||||
luaL_error(L, "Malformed HTML color '%s'", str);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetPackedRGBA(lua_tointeger(L, arg), rgba);
|
||||
}
|
||||
}
|
||||
|
||||
static int extracolormap_set(lua_State *L)
|
||||
{
|
||||
extracolormap_t *exc = *((extracolormap_t **)luaL_checkudata(L, 1, META_EXTRACOLORMAP));
|
||||
enum extracolormap_e field = luaL_checkoption(L, 2, NULL, extracolormap_opt);
|
||||
|
||||
UINT8 r = R_GetRgbaR(exc->rgba);
|
||||
UINT8 g = R_GetRgbaG(exc->rgba);
|
||||
UINT8 b = R_GetRgbaB(exc->rgba);
|
||||
UINT8 a = R_GetRgbaA(exc->rgba);
|
||||
|
||||
UINT8 fr = R_GetRgbaR(exc->fadergba);
|
||||
UINT8 fg = R_GetRgbaG(exc->fadergba);
|
||||
UINT8 fb = R_GetRgbaB(exc->fadergba);
|
||||
UINT8 fa = R_GetRgbaA(exc->fadergba);
|
||||
|
||||
UINT8 rgba[4];
|
||||
|
||||
INT32 old_rgba = exc->rgba, old_fade_rgba = exc->fadergba; // It's not unsigned?
|
||||
UINT8 old_fade_start = exc->fadestart, old_fade_end = exc->fadeend;
|
||||
|
||||
#define val luaL_checkinteger(L, 3)
|
||||
|
||||
switch(field)
|
||||
{
|
||||
case extracolormap_red:
|
||||
exc->rgba = R_PutRgbaRGBA(val, g, b, a);
|
||||
break;
|
||||
case extracolormap_green:
|
||||
exc->rgba = R_PutRgbaRGBA(r, val, b, a);
|
||||
break;
|
||||
case extracolormap_blue:
|
||||
exc->rgba = R_PutRgbaRGBA(r, g, val, a);
|
||||
break;
|
||||
case extracolormap_alpha:
|
||||
exc->rgba = R_PutRgbaRGBA(r, g, b, val);
|
||||
break;
|
||||
case extracolormap_color:
|
||||
rgba[0] = r;
|
||||
rgba[1] = g;
|
||||
rgba[2] = b;
|
||||
rgba[3] = a;
|
||||
GetExtraColormapRGBA(L, rgba, 3);
|
||||
exc->rgba = R_PutRgbaRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
break;
|
||||
case extracolormap_fade_red:
|
||||
exc->fadergba = R_PutRgbaRGBA(val, fg, fb, fa);
|
||||
break;
|
||||
case extracolormap_fade_green:
|
||||
exc->fadergba = R_PutRgbaRGBA(fr, val, fb, fa);
|
||||
break;
|
||||
case extracolormap_fade_blue:
|
||||
exc->fadergba = R_PutRgbaRGBA(fr, fg, val, fa);
|
||||
break;
|
||||
case extracolormap_fade_alpha:
|
||||
exc->fadergba = R_PutRgbaRGBA(fr, fg, fb, val);
|
||||
break;
|
||||
case extracolormap_fade_color:
|
||||
rgba[0] = fr;
|
||||
rgba[1] = fg;
|
||||
rgba[2] = fb;
|
||||
rgba[3] = fa;
|
||||
GetExtraColormapRGBA(L, rgba, 3);
|
||||
exc->fadergba = R_PutRgbaRGBA(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
break;
|
||||
case extracolormap_fade_start:
|
||||
if (val > 31)
|
||||
return luaL_error(L, "fade start %d out of range (0 - 31)", val);
|
||||
exc->fadestart = val;
|
||||
break;
|
||||
case extracolormap_fade_end:
|
||||
if (val > 31)
|
||||
return luaL_error(L, "fade end %d out of range (0 - 31)", val);
|
||||
exc->fadeend = val;
|
||||
break;
|
||||
case extracolormap_colormap:
|
||||
return luaL_error(L, LUA_QL("extracolormap_t") " field " LUA_QS " should not be set directly.", extracolormap_opt[field]);
|
||||
}
|
||||
|
||||
#undef val
|
||||
|
||||
if (exc->rgba != old_rgba
|
||||
|| exc->fadergba != old_fade_rgba
|
||||
|| exc->fadestart != old_fade_start
|
||||
|| exc->fadeend != old_fade_end)
|
||||
R_GenerateLightTable(exc, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lighttable_get(lua_State *L)
|
||||
{
|
||||
void **userdata;
|
||||
|
||||
lighttable_t *table = *((lighttable_t **)luaL_checkudata(L, 1, META_LIGHTTABLE));
|
||||
UINT32 row = luaL_checkinteger(L, 2);
|
||||
if (row < 1 || row > 34)
|
||||
return luaL_error(L, "lighttable row %d out of range (1 - %d)", row, 34);
|
||||
|
||||
userdata = lua_newuserdata(L, sizeof(void *));
|
||||
*userdata = &table[256 * (row - 1)];
|
||||
luaL_getmetatable(L, META_COLORMAP);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lighttable_len(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, NUM_PALETTE_ENTRIES);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LUA_ColorLib(lua_State *L)
|
||||
{
|
||||
luaL_newmetatable(L, META_EXTRACOLORMAP);
|
||||
lua_pushcfunction(L, extracolormap_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, extracolormap_set);
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L, 1);
|
||||
|
||||
luaL_newmetatable(L, META_LIGHTTABLE);
|
||||
lua_pushcfunction(L, lighttable_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, lighttable_len);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
luaL_register(L, "color", color_lib);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -748,6 +748,7 @@ static int libd_drawAffine(lua_State *L)
|
|||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
huddrawlist_h list = lua_touserdata(L, -1);
|
||||
(void)list;
|
||||
lua_pop(L, 1);
|
||||
|
||||
//if (LUA_HUD_IsDrawListValid(list))
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ extern lua_State *gL;
|
|||
#define META_HUDINFO "HUDINFO_T*"
|
||||
#define META_PATCH "PATCH_T*"
|
||||
#define META_COLORMAP "COLORMAP"
|
||||
#define META_EXTRACOLORMAP "EXTRACOLORMAP_T*"
|
||||
#define META_LIGHTTABLE "LIGHTTABLE_T*"
|
||||
#define META_CAMERA "CAMERA_T*"
|
||||
|
||||
#define META_ACTION "actionf_p1*"
|
||||
|
|
@ -152,6 +154,7 @@ int LUA_TagLib(lua_State *L);
|
|||
int LUA_PolyObjLib(lua_State *L);
|
||||
int LUA_BlockmapLib(lua_State *L);
|
||||
int LUA_HudLib(lua_State *L);
|
||||
int LUA_ColorLib(lua_State *L);
|
||||
int LUA_FollowerLib(lua_State *L);
|
||||
int LUA_BotVarsLib(lua_State *L);
|
||||
int LUA_TerrainLib(lua_State *L);
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ enum sector_e {
|
|||
sector_ffloors,
|
||||
sector_fslope,
|
||||
sector_cslope,
|
||||
sector_colormap,
|
||||
sector_flags,
|
||||
sector_specialflags,
|
||||
sector_damagetype,
|
||||
|
|
@ -85,6 +86,7 @@ static const char *const sector_opt[] = {
|
|||
"ffloors",
|
||||
"f_slope",
|
||||
"c_slope",
|
||||
"colormap",
|
||||
"flags",
|
||||
"specialflags",
|
||||
"damagetype",
|
||||
|
|
@ -750,6 +752,9 @@ static int sector_get(lua_State *L)
|
|||
case sector_cslope: // c_slope
|
||||
LUA_PushUserdata(L, sector->c_slope, META_SLOPE);
|
||||
return 1;
|
||||
case sector_colormap: // extra_colormap
|
||||
LUA_PushUserdata(L, sector->extra_colormap, META_EXTRACOLORMAP);
|
||||
return 1;
|
||||
case sector_flags: // flags
|
||||
lua_pushinteger(L, sector->flags);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ static lua_CFunction liblist[] = {
|
|||
LUA_PolyObjLib, // polyobj_t
|
||||
LUA_BlockmapLib, // blockmap stuff
|
||||
LUA_HudLib, // HUD stuff
|
||||
LUA_ColorLib, // general color functions
|
||||
LUA_FollowerLib, // follower_t, followers[]
|
||||
LUA_BotVarsLib, // botvars_t
|
||||
LUA_TerrainLib, // t_splash_t, t_footstep_t, t_overlay_t, terrain_t
|
||||
|
|
|
|||
|
|
@ -2556,3 +2556,37 @@ UINT32 FNV1a_QuickCaseHash(const char *message, size_t size)
|
|||
|
||||
return hash;
|
||||
}
|
||||
|
||||
// Returns true if the string is empty.
|
||||
boolean M_IsStringEmpty(const char *s)
|
||||
{
|
||||
const char *ch = s;
|
||||
|
||||
if (s == NULL || s[0] == '\0')
|
||||
return true;
|
||||
|
||||
for (;;ch++)
|
||||
{
|
||||
if (!(*ch))
|
||||
break;
|
||||
if (!isspace((*ch)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Rounds off floating numbers and checks for 0 - 255 bounds
|
||||
int M_RoundUp(double number)
|
||||
{
|
||||
if (number > 255.0l)
|
||||
return 255;
|
||||
if (number < 0.0l)
|
||||
return 0;
|
||||
|
||||
if ((int)number <= (int)(number - 0.5f))
|
||||
return (int)number + 1;
|
||||
|
||||
return (int)number;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
|
|||
// Hashes some message using FNV-1a
|
||||
UINT32 FNV1a_QuickCaseHash(const char *message, size_t size);
|
||||
|
||||
boolean M_IsStringEmpty(const char *s);
|
||||
|
||||
int M_RoundUp(double number);
|
||||
|
||||
#include "w_wad.h"
|
||||
extern char configfile[MAX_WADPATH];
|
||||
|
||||
|
|
|
|||
|
|
@ -11066,6 +11066,9 @@ void A_SPBChase(void *thing)
|
|||
specialring->colorized = true;
|
||||
specialring->color = SKINCOLOR_RED;
|
||||
specialring->flags |= MF_NOCLIPHEIGHT;
|
||||
|
||||
// But don't let first pick these up.
|
||||
specialring->extravalue3 = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -629,7 +629,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
if (special->extravalue1)
|
||||
return;
|
||||
|
||||
// No picking up rings while SPB is targetting you
|
||||
// No picking up rings while your rings are locked.
|
||||
if (player->pflags & PF_RINGLOCK)
|
||||
return;
|
||||
|
||||
|
|
@ -637,6 +637,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
if (special->threshold > 0 || P_PlayerInPain(player))
|
||||
return;
|
||||
|
||||
// Don't pick up SPB rings in first.
|
||||
if (special->extravalue3 && player->position == 1)
|
||||
return;
|
||||
|
||||
if (!(P_CanPickupItem(player, PICKUPITEM_RING)))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -3406,12 +3406,7 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
mobj->momz = FixedMul(mobj->momz, FixedDiv(2*FRACUNIT, 5*FRACUNIT)); // kill momentum significantly, to make the goo feel thick.
|
||||
|
||||
// Kill heavy airdrop too so you don't get softlocked.
|
||||
if (mobj->player && (mobj->player->airdropflags & PAF_AIRDROP_HEAVY))
|
||||
{
|
||||
mobj->player->airdroptime = 0;
|
||||
mobj->player->airdroppredelay = 0;
|
||||
mobj->player->airdropflags &= ~PAF_AIRDROP_MASK;
|
||||
}
|
||||
K_KillAirDrop(mobj->player, PAF_AIRDROP_HEAVY);
|
||||
}
|
||||
else if (wasinwater && P_MobjFlip(mobj) * mobj->momz > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2081,6 +2081,35 @@ static void DiffMobj(const mobj_t *mobj, UINT32 diff[])
|
|||
DIFF(mobj->voice, MD3_VOICE);
|
||||
}
|
||||
|
||||
boolean MobjIsNetSynced(mobj_t *mobj)
|
||||
{
|
||||
// Ignore stationary hoops - these will be respawned from mapthings.
|
||||
if (mobj->type == MT_HOOP)
|
||||
return false;
|
||||
|
||||
// These are NEVER saved.
|
||||
if (mobj->type == MT_HOOPCOLLIDE)
|
||||
return false;
|
||||
|
||||
// This hoop has already been collected.
|
||||
if (mobj->type == MT_HOOPCENTER && mobj->threshold == 4242)
|
||||
return false;
|
||||
|
||||
// MT_SPARK: used for debug stuff
|
||||
if (mobj->type == MT_SPARK)
|
||||
return false;
|
||||
|
||||
// MT_FOLLOWERHORN: So it turns out hornmod is fundamentally incompatible with netsync
|
||||
if (mobj->type == MT_FOLLOWERHORN)
|
||||
return false;
|
||||
|
||||
// This is a non-synched visual effect mobj
|
||||
if (mobj->flags2 & MF2_DONTSYNC)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static thinker_t *SyncMobjThinker(savebuffer_t *save, actionf_p1 thinker, thinker_t *th, UINT8 type)
|
||||
{
|
||||
mobj_t *mobj = (mobj_t *)th;
|
||||
|
|
@ -2089,24 +2118,7 @@ static thinker_t *SyncMobjThinker(savebuffer_t *save, actionf_p1 thinker, thinke
|
|||
|
||||
if (save->write)
|
||||
{
|
||||
// Ignore stationary hoops - these will be respawned from mapthings.
|
||||
if (mobj->type == MT_HOOP)
|
||||
return th;
|
||||
|
||||
// These are NEVER saved.
|
||||
if (mobj->type == MT_HOOPCOLLIDE)
|
||||
return th;
|
||||
|
||||
// This hoop has already been collected.
|
||||
if (mobj->type == MT_HOOPCENTER && mobj->threshold == 4242)
|
||||
return th;
|
||||
|
||||
// MT_SPARK: used for debug stuff
|
||||
if (mobj->type == MT_SPARK)
|
||||
return th;
|
||||
|
||||
// This is a non-synched visual effect mobj
|
||||
if (mobj->flags2 & MF2_DONTSYNC)
|
||||
if (!MobjIsNetSynced(mobj))
|
||||
return th;
|
||||
|
||||
// Scrap all of that. If we're a hoop center, this is ALL we're saving.
|
||||
|
|
@ -3822,9 +3834,7 @@ static void P_RelinkPointers(savebuffer_t *save)
|
|||
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
|
||||
if (UNLIKELY(mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER
|
||||
// MT_SPARK: used for debug stuff
|
||||
|| mobj->type == MT_SPARK))
|
||||
if (!MobjIsNetSynced(mobj))
|
||||
continue;
|
||||
|
||||
RELINK(&mobj->tracer);
|
||||
|
|
@ -4538,11 +4548,7 @@ void P_SaveNetGame(savebuffer_t *save, boolean resending)
|
|||
continue;
|
||||
|
||||
mobj = (mobj_t *)th;
|
||||
if (UNLIKELY(mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER
|
||||
// MT_SPARK: used for debug stuff
|
||||
|| mobj->type == MT_SPARK
|
||||
// MT_FOLLOWERHORN: So it turns out hornmod is fundamentally incompatible with netsync
|
||||
|| mobj->type == MT_FOLLOWERHORN || mobj->flags2 & MF2_DONTSYNC))
|
||||
if (!MobjIsNetSynced(mobj))
|
||||
continue;
|
||||
mobj->mobjnum = i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ boolean P_SaveBufferFromLump(savebuffer_t *save, lumpnum_t lump);
|
|||
size_t P_SaveBufferFromFile(savebuffer_t *save, char const *name);
|
||||
void P_SaveBufferFree(savebuffer_t *save);
|
||||
|
||||
boolean MobjIsNetSynced(mobj_t *mobj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3873,7 +3873,7 @@ static inline float P_SegLengthFloat(seg_t *seg)
|
|||
dx = FIXED_TO_FLOAT(seg->v2->x - seg->v1->x);
|
||||
dy = FIXED_TO_FLOAT(seg->v2->y - seg->v1->y);
|
||||
|
||||
return (float)hypot(dx, dy);
|
||||
return hypotf(dx, dy);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -4033,7 +4033,7 @@ static void P_LoadSegs(UINT8 *data)
|
|||
|
||||
seg->length = P_SegLength(seg);
|
||||
#ifdef HWRENDER
|
||||
seg->flength = (rendermode == render_opengl) ? P_SegLengthFloat(seg) : 0;
|
||||
seg->flength = P_SegLengthFloat(seg);
|
||||
#endif
|
||||
|
||||
seg->glseg = false;
|
||||
|
|
@ -9051,21 +9051,20 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
// Load the ccheckpoints and waypoints please!
|
||||
if (gametyperules & GTR_CIRCUIT && gamestate != GS_TITLESCREEN)
|
||||
{
|
||||
|
||||
if ((K_SetupWaypointList() == false))
|
||||
if ((K_SetupWaypointList() == false))
|
||||
{
|
||||
if (!K_UsingLegacyCheckpoints())
|
||||
{
|
||||
if (!K_UsingLegacyCheckpoints())
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Waypoints were not able to be setup and legacy checkpoints do not exist! Player positions will not work correctly.\n");
|
||||
}
|
||||
CONS_Alert(CONS_ERROR, "Waypoints were not able to be setup and legacy checkpoints do not exist! Player positions will not work correctly.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||
gl_maploaded = false;
|
||||
|
||||
// Lactozilla: Free extrasubsectors regardless of renderer.
|
||||
HWR_FreeExtraSubsectors();
|
||||
// Lactozilla: Free poly_subsectors regardless of renderer.
|
||||
HWR_FreePolyPool();
|
||||
|
||||
// Create plane polygons.
|
||||
if (rendermode == render_opengl)
|
||||
|
|
|
|||
15
src/p_user.c
15
src/p_user.c
|
|
@ -1692,6 +1692,9 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
{
|
||||
player->mo->momx = -FixedMul(player->mo->momx,rover->bouncestrength);
|
||||
player->mo->momy = -FixedMul(player->mo->momy,rover->bouncestrength);
|
||||
|
||||
// Kill heavy airdrop too so you don't get softlocked.
|
||||
K_KillAirDrop(player, PAF_AIRDROP_HEAVY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1731,6 +1734,10 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
player->mo->momx = momentum.x;
|
||||
player->mo->momy = momentum.y;
|
||||
player->mo->momz = momentum.z;
|
||||
|
||||
// Kill heavy airdrop too so you don't get softlocked.
|
||||
K_KillAirDrop(player, PAF_AIRDROP_HEAVY);
|
||||
|
||||
}
|
||||
goto bouncydone;
|
||||
}
|
||||
|
|
@ -3884,8 +3891,12 @@ static angle_t P_GetCameraPitchRollAngle(mobj_t *mobj, player_t *viewPlayer)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Regular Mobjs don't air tilt.
|
||||
viewingAngle = mobj->angle;
|
||||
// For regular objects, use the camera; just not the *player's* camera.
|
||||
//... Unless you are a Nights bumber...
|
||||
if (mobj->type == MT_NIGHTSBUMPER)
|
||||
viewingAngle = mobj->angle;
|
||||
else
|
||||
viewingAngle = R_PointToAngleFloat(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
pitchMul = -FINESINE(viewingAngle >> ANGLETOFINESHIFT);
|
||||
|
|
|
|||
244
src/r_data.c
244
src/r_data.c
|
|
@ -387,7 +387,7 @@ extracolormap_t *R_CreateDefaultColormap(boolean lighttable)
|
|||
exc->fadeend = 31;
|
||||
exc->flags = 0;
|
||||
exc->rgba = 0;
|
||||
exc->fadergba = 0x19000000;
|
||||
exc->fadergba = 0xFF000000;
|
||||
exc->colormap = lighttable ? R_CreateLightTable(exc) : NULL;
|
||||
#ifdef EXTRACOLORMAPLUMPS
|
||||
exc->lump = LUMPERROR;
|
||||
|
|
@ -502,7 +502,7 @@ boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba,
|
|||
&& !flags)
|
||||
)
|
||||
&& (!checkrgba ? true : rgba == 0)
|
||||
&& (!checkfadergba ? true : fadergba == 0x19000000)
|
||||
&& (!checkfadergba ? true : (unsigned)fadergba == 0xFF000000)
|
||||
#ifdef EXTRACOLORMAPLUMPS
|
||||
&& lump == LUMPERROR
|
||||
&& extra_colormap->lumpname[0] == 0
|
||||
|
|
@ -603,7 +603,7 @@ extracolormap_t *R_ColormapForName(char *name)
|
|||
if (lump == LUMPERROR)
|
||||
I_Error("R_ColormapForName: Cannot find colormap lump %.8s\n", name);
|
||||
|
||||
exc = R_GetColormapFromListByValues(0, 0x19000000, 0, 31, 0, lump);
|
||||
exc = R_GetColormapFromListByValues(0, 0xFF000000, 0, 31, 0, lump);
|
||||
if (exc)
|
||||
return exc;
|
||||
|
||||
|
|
@ -623,7 +623,7 @@ extracolormap_t *R_ColormapForName(char *name)
|
|||
exc->fadeend = 31;
|
||||
exc->flags = 0;
|
||||
exc->rgba = 0;
|
||||
exc->fadergba = 0x19000000;
|
||||
exc->fadergba = 0xFF000000;
|
||||
|
||||
R_AddColormapToList(exc);
|
||||
|
||||
|
|
@ -642,27 +642,42 @@ extracolormap_t *R_ColormapForName(char *name)
|
|||
static double brightChange[256], map[256][3];
|
||||
static double deltas[256][3]; // for old fade colormaps
|
||||
|
||||
static int RoundUp(double number);
|
||||
static colorlookup_t lighttable_lut;
|
||||
|
||||
static UINT8 LightTableNearest(UINT8 r, UINT8 g, UINT8 b)
|
||||
{
|
||||
return NearestColor(r, g, b);
|
||||
}
|
||||
|
||||
static UINT8 LightTableNearest_LUT(UINT8 r, UINT8 g, UINT8 b)
|
||||
{
|
||||
return GetColorLUT(&lighttable_lut, r, g, b);
|
||||
}
|
||||
|
||||
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
||||
{
|
||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb, cdestbright;
|
||||
extra_colormap->colormap = Z_MallocAlign((256 * 34) + 10, PU_LEVEL, NULL, 8);
|
||||
R_GenerateLightTable(extra_colormap, false);
|
||||
return extra_colormap->colormap;
|
||||
}
|
||||
|
||||
void R_GenerateLightTable(extracolormap_t *extra_colormap, boolean uselookup)
|
||||
{
|
||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
||||
double maskamt = 0, othermask = 0;
|
||||
double fmaskamt = 0, fothermask = 0;
|
||||
|
||||
UINT8 cr = R_GetRgbaR(extra_colormap->rgba),
|
||||
cg = R_GetRgbaG(extra_colormap->rgba),
|
||||
cb = R_GetRgbaB(extra_colormap->rgba),
|
||||
ca = R_GetRgbaA(extra_colormap->rgba),
|
||||
cfr = R_GetRgbaR(extra_colormap->fadergba),
|
||||
cfg = R_GetRgbaG(extra_colormap->fadergba),
|
||||
cfb = R_GetRgbaB(extra_colormap->fadergba),
|
||||
cfa = R_GetRgbaA(extra_colormap->fadergba);
|
||||
cg = R_GetRgbaG(extra_colormap->rgba),
|
||||
cb = R_GetRgbaB(extra_colormap->rgba),
|
||||
ca = R_GetRgbaA(extra_colormap->rgba),
|
||||
cfr = R_GetRgbaR(extra_colormap->fadergba),
|
||||
cfg = R_GetRgbaG(extra_colormap->fadergba),
|
||||
cfb = R_GetRgbaB(extra_colormap->fadergba);
|
||||
// cfa = R_GetRgbaA(extra_colormap->fadergba); // unused in software
|
||||
|
||||
UINT8 fadestart = extra_colormap->fadestart,
|
||||
fadedist = extra_colormap->fadeend - extra_colormap->fadestart;
|
||||
fadedist = extra_colormap->fadeend - extra_colormap->fadestart;
|
||||
|
||||
lighttable_t *lighttable = NULL;
|
||||
size_t i;
|
||||
|
||||
/////////////////////
|
||||
|
|
@ -672,7 +687,7 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
|||
cmaskg = cg;
|
||||
cmaskb = cb;
|
||||
|
||||
maskamt = (double)(ca/24.0l);
|
||||
maskamt = (double)(ca/255.0l);
|
||||
othermask = 1 - maskamt;
|
||||
maskamt /= 0xff;
|
||||
|
||||
|
|
@ -686,27 +701,39 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
|||
cdestr = cfr;
|
||||
cdestg = cfg;
|
||||
cdestb = cfb;
|
||||
cdestbright = sqrt((cfr*cfr) + (cfg*cfg) + (cfb*cfb));
|
||||
|
||||
fmaskamt = (double)(cfa/24.0l);
|
||||
fothermask = 1 - fmaskamt;
|
||||
//fmaskamt /= 0xff;
|
||||
// fade alpha unused in software
|
||||
// maskamt = (double)(cfa/255.0l);
|
||||
// othermask = 1 - maskamt;
|
||||
// maskamt /= 0xff;
|
||||
|
||||
(void)fothermask; // unused, but don't feel like commenting it out
|
||||
// cdestr *= maskamt;
|
||||
// cdestg *= maskamt;
|
||||
// cdestb *= maskamt;
|
||||
|
||||
/////////////////////
|
||||
// This code creates the colormap array used by software renderer
|
||||
/////////////////////
|
||||
{
|
||||
double r, g, b, cbrightness, cbest, cdist;
|
||||
double r, g, b, cbrightness;
|
||||
int p;
|
||||
lighttable_t *colormap_p;
|
||||
char *colormap_p;
|
||||
|
||||
UINT8 (*NearestColorFunc)(UINT8, UINT8, UINT8);
|
||||
|
||||
if (uselookup)
|
||||
{
|
||||
InitColorLUT(&lighttable_lut, pMasterPalette, false);
|
||||
NearestColorFunc = LightTableNearest_LUT;
|
||||
}
|
||||
else
|
||||
NearestColorFunc = LightTableNearest;
|
||||
|
||||
// Initialise the map and delta arrays
|
||||
// map[i] stores an RGB color (as double) for index i,
|
||||
// which is then converted to SRB2's palette later
|
||||
// brightChange[i] is the value added/subtracted every step for the fade;
|
||||
// map[i]'s values are in/decremented by it after each use
|
||||
// deltas[i] stores a corresponding fade delta between the RGB color and the final fade color;
|
||||
// map[i]'s values are decremented by after each use
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
r = pMasterPalette[i].s.red;
|
||||
|
|
@ -717,122 +744,55 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
|||
map[i][0] = (cbrightness * cmaskr) + (r * othermask);
|
||||
if (map[i][0] > 255.0l)
|
||||
map[i][0] = 255.0l;
|
||||
deltas[i][0] = (map[i][0] - cdestr) / (double)fadedist;
|
||||
|
||||
map[i][1] = (cbrightness * cmaskg) + (g * othermask);
|
||||
if (map[i][1] > 255.0l)
|
||||
map[i][1] = 255.0l;
|
||||
deltas[i][1] = (map[i][1] - cdestg) / (double)fadedist;
|
||||
|
||||
map[i][2] = (cbrightness * cmaskb) + (b * othermask);
|
||||
if (map[i][2] > 255.0l)
|
||||
map[i][2] = 255.0l;
|
||||
|
||||
if (extra_colormap->flags & CMF_NEWFADE)
|
||||
{
|
||||
// Get the "best" color.
|
||||
// Our brightest color's value, if we're fading to a darker color,
|
||||
// or our (inverted) darkest color's value, if we're fading to a brighter color.
|
||||
if (cbrightness < cdestbright)
|
||||
{
|
||||
cbest = 255.0l - min(r, min(g, b));
|
||||
cdist = 255.0l - max(cdestr, max(cdestg, cdestb));
|
||||
}
|
||||
else
|
||||
{
|
||||
cbest = max(r, max(g, b));
|
||||
cdist = min(cdestr, min(cdestg, cdestb));
|
||||
}
|
||||
|
||||
// Add/subtract this value during fading.
|
||||
brightChange[i] = (fabs(cbest - cdist) / (double)fadedist) * fmaskamt;
|
||||
}
|
||||
else
|
||||
{
|
||||
deltas[i][0] = (map[i][0] - cdestr) / (double)fadedist;
|
||||
deltas[i][1] = (map[i][1] - cdestg) / (double)fadedist;
|
||||
deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist;
|
||||
}
|
||||
deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist;
|
||||
}
|
||||
|
||||
// Now allocate memory for the actual colormap array itself!
|
||||
// aligned on 8 bit for asm code
|
||||
colormap_p = Z_MallocAlign((COLORMAP_SIZE * (encoremap ? 2 : 1)) + 10, PU_LEVEL, NULL, 8);
|
||||
lighttable = (UINT8 *)colormap_p;
|
||||
colormap_p = (char *)extra_colormap->colormap;
|
||||
|
||||
// Calculate the palette index for each palette index, for each light level
|
||||
// (as well as the two unused colormap lines we inherited from Doom)
|
||||
for (p = 0; p < LIGHTLEVELS; p++)
|
||||
for (p = 0; p < 34; p++)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
*colormap_p = NearestColor((UINT8)RoundUp(map[i][0]),
|
||||
(UINT8)RoundUp(map[i][1]),
|
||||
(UINT8)RoundUp(map[i][2]));
|
||||
*colormap_p = NearestColorFunc((UINT8)M_RoundUp(map[i][0]),
|
||||
(UINT8)M_RoundUp(map[i][1]),
|
||||
(UINT8)M_RoundUp(map[i][2]));
|
||||
colormap_p++;
|
||||
|
||||
if ((UINT32)p < fadestart)
|
||||
continue;
|
||||
|
||||
if (extra_colormap->flags & CMF_NEWFADE)
|
||||
{
|
||||
// Add/subtract towards the destination color.
|
||||
if (fabs(map[i][0] - cdestr) <= brightChange[i])
|
||||
map[i][0] = cdestr;
|
||||
else if (map[i][0] > cdestr)
|
||||
map[i][0] -= brightChange[i];
|
||||
else
|
||||
map[i][0] += brightChange[i];
|
||||
|
||||
if (fabs(map[i][1] - cdestg) <= brightChange[i])
|
||||
map[i][1] = cdestg;
|
||||
else if (map[i][1] > cdestg)
|
||||
map[i][1] -= brightChange[i];
|
||||
else
|
||||
map[i][1] += brightChange[i];
|
||||
|
||||
if (fabs(map[i][2] - cdestb) <= brightChange[i])
|
||||
map[i][2] = cdestb;
|
||||
else if (map[i][2] > cdestb)
|
||||
map[i][2] -= brightChange[i];
|
||||
else
|
||||
map[i][2] += brightChange[i];
|
||||
}
|
||||
#define ABS2(x) ((x) < 0 ? -(x) : (x))
|
||||
if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0]))
|
||||
map[i][0] -= deltas[i][0];
|
||||
else
|
||||
{
|
||||
if (fabs(map[i][0] - cdestr) > fabs(deltas[i][0]))
|
||||
map[i][0] -= deltas[i][0];
|
||||
else
|
||||
map[i][0] = cdestr;
|
||||
map[i][0] = cdestr;
|
||||
|
||||
if (fabs(map[i][1] - cdestg) > fabs(deltas[i][1]))
|
||||
map[i][1] -= deltas[i][1];
|
||||
else
|
||||
map[i][1] = cdestg;
|
||||
if (ABS2(map[i][1] - cdestg) > ABS2(deltas[i][1]))
|
||||
map[i][1] -= deltas[i][1];
|
||||
else
|
||||
map[i][1] = cdestg;
|
||||
|
||||
if (fabs(map[i][2] - cdestb) > fabs(deltas[i][1])) // typo alert!
|
||||
map[i][2] -= deltas[i][2];
|
||||
else
|
||||
map[i][2] = cdestb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (encoremap)
|
||||
{
|
||||
lighttable_t *colormap_p2 = lighttable;
|
||||
|
||||
for (p = 0; p < LIGHTLEVELS; p++)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
*colormap_p = colormap_p2[encoremap[i]];
|
||||
colormap_p++;
|
||||
}
|
||||
colormap_p2 += 256;
|
||||
if (ABS2(map[i][2] - cdestb) > ABS2(deltas[i][1]))
|
||||
map[i][2] -= deltas[i][2];
|
||||
else
|
||||
map[i][2] = cdestb;
|
||||
#undef ABS2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lighttable;
|
||||
}
|
||||
|
||||
extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3)
|
||||
|
|
@ -841,7 +801,7 @@ extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3)
|
|||
UINT8 cr = 0, cg = 0, cb = 0, ca = 0, cfr = 0, cfg = 0, cfb = 0, cfa = 25;
|
||||
UINT32 fadestart = 0, fadeend = 31;
|
||||
UINT8 flags = 0;
|
||||
INT32 rgba = 0, fadergba = 0x19000000;
|
||||
INT32 rgba = 0, fadergba = 0xFF000000;
|
||||
|
||||
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
||||
#define ALPHA2INT(x) (x >= 'a' && x <= 'z' ? x - 'a' : x >= 'A' && x <= 'Z' ? x - 'A' : x >= '0' && x <= '9' ? 25 : 0)
|
||||
|
|
@ -849,13 +809,13 @@ extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3)
|
|||
// Get base colormap value
|
||||
// First alpha-only, then full value
|
||||
if (p1[0] >= 'a' && p1[0] <= 'z' && !p1[1])
|
||||
ca = (p1[0] - 'a');
|
||||
ca = ((p1[0] - 'a') * 102) / 10;
|
||||
else if (p1[0] == '#' && p1[1] >= 'a' && p1[1] <= 'z' && !p1[2])
|
||||
ca = (p1[1] - 'a');
|
||||
ca = ((p1[1] - 'a') * 102) / 10;
|
||||
else if (p1[0] >= 'A' && p1[0] <= 'Z' && !p1[1])
|
||||
ca = (p1[0] - 'A');
|
||||
ca = ((p1[0] - 'A') * 102) / 10;
|
||||
else if (p1[0] == '#' && p1[1] >= 'A' && p1[1] <= 'Z' && !p1[2])
|
||||
ca = (p1[1] - 'A');
|
||||
ca = ((p1[1] - 'A') * 102) / 10;
|
||||
else if (p1[0] == '#')
|
||||
{
|
||||
// For each subsequent value, the value before it must exist
|
||||
|
|
@ -871,20 +831,20 @@ extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3)
|
|||
cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6]));
|
||||
|
||||
if (p1[7] >= 'a' && p1[7] <= 'z')
|
||||
ca = (p1[7] - 'a');
|
||||
ca = ((p1[7] - 'a') * 102) / 10;
|
||||
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
||||
ca = (p1[7] - 'A');
|
||||
ca = ((p1[7] - 'A') * 102) / 10;
|
||||
else
|
||||
ca = 25;
|
||||
ca = 255;
|
||||
}
|
||||
else
|
||||
ca = 25;
|
||||
ca = 255;
|
||||
}
|
||||
else
|
||||
ca = 25;
|
||||
ca = 255;
|
||||
}
|
||||
else
|
||||
ca = 25;
|
||||
ca = 255;
|
||||
}
|
||||
|
||||
#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0)
|
||||
|
|
@ -914,13 +874,13 @@ extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3)
|
|||
// Get fade (dark) colormap value
|
||||
// First alpha-only, then full value
|
||||
if (p3[0] >= 'a' && p3[0] <= 'z' && !p3[1])
|
||||
cfa = (p3[0] - 'a');
|
||||
cfa = ((p3[0] - 'a') * 102) / 10;
|
||||
else if (p3[0] == '#' && p3[1] >= 'a' && p3[1] <= 'z' && !p3[2])
|
||||
cfa = (p3[1] - 'a');
|
||||
cfa = ((p3[1] - 'a') * 102) / 10;
|
||||
else if (p3[0] >= 'A' && p3[0] <= 'Z' && !p3[1])
|
||||
cfa = (p3[0] - 'A');
|
||||
cfa = ((p3[0] - 'A') * 102) / 10;
|
||||
else if (p3[0] == '#' && p3[1] >= 'A' && p3[1] <= 'Z' && !p3[2])
|
||||
cfa = (p3[1] - 'A');
|
||||
cfa = ((p3[1] - 'A') * 102) / 10;
|
||||
else if (p3[0] == '#')
|
||||
{
|
||||
// For each subsequent value, the value before it must exist
|
||||
|
|
@ -936,20 +896,20 @@ extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3)
|
|||
cfb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
|
||||
|
||||
if (p3[7] >= 'a' && p3[7] <= 'z')
|
||||
cfa = (p3[7] - 'a');
|
||||
cfa = ((p3[7] - 'a') * 102) / 10;
|
||||
else if (p3[7] >= 'A' && p3[7] <= 'Z')
|
||||
cfa = (p3[7] - 'A');
|
||||
cfa = ((p3[7] - 'A') * 102) / 10;
|
||||
else
|
||||
cfa = 25;
|
||||
cfa = 255;
|
||||
}
|
||||
else
|
||||
cfa = 25;
|
||||
cfa = 255;
|
||||
}
|
||||
else
|
||||
cfa = 25;
|
||||
cfa = 255;
|
||||
}
|
||||
else
|
||||
cfa = 25;
|
||||
cfa = 255;
|
||||
}
|
||||
#undef ALPHA2INT
|
||||
#undef HEX2INT
|
||||
|
|
@ -1166,20 +1126,6 @@ UINT8 NearestPaletteColor(UINT8 r, UINT8 g, UINT8 b, RGBA_t *palette)
|
|||
return (UINT8)bestcolor;
|
||||
}
|
||||
|
||||
// Rounds off floating numbers and checks for 0 - 255 bounds
|
||||
static int RoundUp(double number)
|
||||
{
|
||||
if (number > 255.0l)
|
||||
return 255;
|
||||
if (number < 0.0l)
|
||||
return 0;
|
||||
|
||||
if ((int)number <= (int)(number - 0.5f))
|
||||
return (int)number + 1;
|
||||
|
||||
return (int)number;
|
||||
}
|
||||
|
||||
#ifdef EXTRACOLORMAPLUMPS
|
||||
const char *R_NameForColormap(extracolormap_t *extra_colormap)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ typedef enum
|
|||
TMCF_OVERRIDE = 1<<13,
|
||||
} textmapcolormapflags_t;
|
||||
|
||||
void R_GenerateLightTable(extracolormap_t *extra_colormap, boolean uselookup);
|
||||
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap);
|
||||
extracolormap_t * R_CreateColormapFromLinedef(char *p1, char *p2, char *p3);
|
||||
extracolormap_t* R_CreateColormap(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags);
|
||||
|
|
|
|||
|
|
@ -589,9 +589,9 @@ static void R_DrawAffineColumnTemplate(drawcolumndata_t *dc)
|
|||
intptr_t frac;
|
||||
// Looks familiar.
|
||||
const intptr_t fracstep = dc->iscale;
|
||||
const intptr_t heightmask = dc->sourcelength-1; // CPhipps - specify type
|
||||
constexpr INT32 npow2min = -1;
|
||||
const INT32 npow2max = dc->sourcelength;
|
||||
//const intptr_t heightmask = dc->sourcelength-1; // CPhipps - specify type
|
||||
//constexpr INT32 npow2min = -1;
|
||||
//const INT32 npow2max = dc->sourcelength;
|
||||
|
||||
// Framebuffer destination address.
|
||||
// SoM: MAGIC
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
/// See tables.c, too.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
|
|
@ -51,6 +52,9 @@ extern consvar_t cv_debugrender_freezebsp;
|
|||
// Fineangles in the SCREENWIDTH wide window.
|
||||
#define FIELDOFVIEW 2048
|
||||
|
||||
// Double-precision Pi value
|
||||
#define DOUBLE_PI 3.141592653589793
|
||||
|
||||
// increment every time a check is made
|
||||
size_t validcount = 1;
|
||||
|
||||
|
|
@ -144,8 +148,6 @@ static CV_PossibleValue_t secbright_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NU
|
|||
|
||||
static void Fov_OnChange(void);
|
||||
|
||||
consvar_t cv_tailspickup = CVAR_INIT ("tailspickup", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL);
|
||||
|
||||
// if enabled, load all graphics at level load
|
||||
consvar_t cv_precachetextures = CVAR_INIT ("precachetextures", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
|
|
@ -202,9 +204,6 @@ consvar_t cv_fakerollangle = CVAR_INIT ("fakerollangle", "Off", CV_SAVE, CV_OnOf
|
|||
consvar_t cv_affineprescale = CVAR_INIT ("affineprescale", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
consvar_t cv_affinemosaic = CVAR_INIT ("affinemosaic", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
static CV_PossibleValue_t affineangle_cons_t[] = {{0, "MIN"}, {360 * FRACUNIT, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t affinetest_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Auto"}, {0, NULL}};
|
||||
|
||||
void SplitScreen_OnChange(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
|
@ -390,6 +389,29 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
|
|||
0;
|
||||
}
|
||||
|
||||
#define ANGLE_180_DOUBLE (static_cast<double>(ANGLE_180))
|
||||
#define ANGLE_360_DOUBLE (ANGLE_180_DOUBLE * 2)
|
||||
|
||||
// For absolute accuracy. Please don't use this outside of renderers.
|
||||
angle_t R_PointToAngleFloat2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2)
|
||||
{
|
||||
double deltax = FixedToDouble(x2 - x1);
|
||||
double deltay = FixedToDouble(y2 - y1);
|
||||
|
||||
// Converted to degrees
|
||||
double _arctan = (atan2(deltay, deltax) * ANGLE_180_DOUBLE) / DOUBLE_PI;
|
||||
|
||||
while (_arctan < 0)
|
||||
{
|
||||
_arctan += ANGLE_360_DOUBLE;
|
||||
}
|
||||
|
||||
return static_cast<angle_t>(_arctan);
|
||||
}
|
||||
|
||||
#undef ANGLE_180_DOUBLE
|
||||
#undef ANGLE_360_DOUBLE
|
||||
|
||||
//
|
||||
// R_ScaleFromGlobalAngle
|
||||
// Returns the texture mapping scale for the current line (horizontal span)
|
||||
|
|
@ -1773,7 +1795,6 @@ void R_RegisterEngineStuff(void)
|
|||
UINT8 i;
|
||||
|
||||
CV_RegisterVar(&cv_gravity);
|
||||
CV_RegisterVar(&cv_tailspickup);
|
||||
CV_RegisterVar(&cv_allowmlook);
|
||||
CV_RegisterVar(&cv_homremoval);
|
||||
|
||||
|
|
|
|||
|
|
@ -83,9 +83,11 @@ FUNCINLINE static ATTRINLINE INT32 R_PointOnSideFast(fixed_t x, fixed_t y, const
|
|||
|
||||
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line);
|
||||
#define R_PointToAngle(x, y) R_PointToAngle2(viewx, viewy, x, y)
|
||||
#define R_PointToAngleFloat(x, y) (R_PointToAngleFloat2(viewx, viewy, x, y))
|
||||
angle_t R_PointToAnglePlayer(player_t *player, fixed_t x, fixed_t y);
|
||||
angle_t R_PointToAngle64(INT64 x, INT64 y);
|
||||
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PointToAngleFloat2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
|
||||
#define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y)
|
||||
#define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2))
|
||||
|
||||
|
|
@ -153,7 +155,6 @@ extern consvar_t cv_drawdist, cv_drawdist_precip;
|
|||
extern consvar_t cv_playerfade;
|
||||
extern consvar_t cv_fov[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_skybox;
|
||||
extern consvar_t cv_tailspickup;
|
||||
extern consvar_t cv_debugfinishline;
|
||||
extern consvar_t cv_secbright;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,12 @@ angle_t R_GetPitchRollAngle(mobj_t *mobj, player_t *viewPlayer, interpmobjstate_
|
|||
}
|
||||
else
|
||||
{
|
||||
// Regular Mobjs don't air tilt.
|
||||
viewingAngle = mobj->angle;
|
||||
// For regular objects, use the camera; just not the *player's* camera.
|
||||
//... Unless you are a Nights bumber...
|
||||
if (mobj->type == MT_NIGHTSBUMPER)
|
||||
viewingAngle = mobj->angle;
|
||||
else
|
||||
viewingAngle = R_PointToAngleFloat(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
pitchMul = -FINESINE(viewingAngle >> ANGLETOFINESHIFT);
|
||||
|
|
@ -164,6 +168,7 @@ vector2_t* R_RotateSpriteOffsetsByPitchRoll(
|
|||
{
|
||||
fixed_t rotcos, rotsin, finx, finy;
|
||||
vector2_t xvec, yvec;
|
||||
(void)affine;
|
||||
|
||||
// input offsets
|
||||
fixed_t xoffs, yoffs, xpiv, ypiv;
|
||||
|
|
|
|||
|
|
@ -2081,7 +2081,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
// Affines
|
||||
boolean affinesprite = (((thing->player != NULL) || R_ThingIsAffineSprite(thing)) && (!splat));
|
||||
affine_t affine_transform = {0};
|
||||
affine_bounding_t affine_bounds = {0};
|
||||
affine_bounding_t affine_bounds = {};
|
||||
vector2_t affine_scale = {0};
|
||||
vector2_t affine_distscale = {0};
|
||||
f_vector2_t affine_pivotoffsetdiff = {0};
|
||||
|
|
@ -2928,7 +2928,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
vis->viewpoint.z = viewz;
|
||||
vis->viewpoint.angle = viewangle;
|
||||
|
||||
vis->affine = {0};
|
||||
vis->affine = {};
|
||||
|
||||
if (affinesprite)
|
||||
{
|
||||
|
|
|
|||
12
src/w_wad.c
12
src/w_wad.c
|
|
@ -625,21 +625,13 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
|
|||
{
|
||||
const char *temp = trimname-1;
|
||||
// CONS_Printf("wadnumtemp: %s\n", temp);
|
||||
#if (defined(_WIN32))
|
||||
while (temp >= filename+5 && *temp != PATHSEP[0])
|
||||
temp--;
|
||||
|
||||
if (((trimname-1) - temp) == 8
|
||||
&& temp >= filename+5
|
||||
&& !strncmp(temp-5, PATHSEP"Temp", 5))
|
||||
#elif (defined(__linux__))
|
||||
while (temp >= filename+4 && *temp != PATHSEP[0])
|
||||
temp--;
|
||||
|
||||
if (((trimname-1) - temp) == 8
|
||||
&& temp >= filename+4
|
||||
&& !strncmp(temp-4, PATHSEP"tmp", 4))
|
||||
#endif
|
||||
&& (!strncmp(temp-5, PATHSEP"Temp", 5)
|
||||
|| !strncmp(temp-4, PATHSEP"tmp", 4)))
|
||||
{
|
||||
filename = wadfiles[
|
||||
((wadnamelump & ~UINT16_MAX) >> 16)
|
||||
|
|
|
|||
Loading…
Reference in a new issue