Merge branch 'next' into hardcode-restat

This commit is contained in:
minenice55 2026-01-24 20:55:35 +01:00
commit ca173bdd91
7 changed files with 46 additions and 49 deletions

View file

@ -33,7 +33,7 @@ extern CV_PossibleValue_t Color_cons_t[];
extern UINT8 skincolor_modified[]; extern UINT8 skincolor_modified[];
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor); boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
state_t *astate; state_t *astate = NULL;
enum sfxinfo_read { enum sfxinfo_read {
sfxinfor_name = 0, sfxinfor_name = 0,

View file

@ -45,31 +45,31 @@ boolean lua_compatmode = false;
// List of internal libraries to load from SRB2 // List of internal libraries to load from SRB2
static lua_CFunction liblist[] = { static lua_CFunction liblist[] = {
LUA_EnumLib, // global metatable for enums LUA_EnumLib, // global metatable for enums
LUA_SOCLib, // A_Action functions, freeslot LUA_SOCLib, // A_Action functions, freeslot
LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc. LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc.
LUA_MathLib, // fixed_t and angle_t math functions LUA_MathLib, // fixed_t and angle_t math functions
LUA_HookLib, // hookAdd and hook-calling functions LUA_HookLib, // hookAdd and hook-calling functions
LUA_ConsoleLib, // console command/variable functions and structs LUA_ConsoleLib, // console command/variable functions and structs
LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[] LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[]
LUA_MobjLib, // mobj_t, mapthing_t LUA_MobjLib, // mobj_t, mapthing_t
LUA_PlayerLib, // player_t LUA_PlayerLib, // player_t
LUA_SkinLib, // skin_t, skins[] LUA_SkinLib, // skin_t, skins[]
LUA_ThinkerLib, // thinker_t LUA_ThinkerLib, // thinker_t
LUA_MapLib, // line_t, side_t, sector_t, subsector_t LUA_MapLib, // line_t, side_t, sector_t, subsector_t
LUA_TagLib, // tags LUA_TagLib, // tags
LUA_PolyObjLib, // polyobj_t LUA_PolyObjLib, // polyobj_t
LUA_BlockmapLib, // blockmap stuff LUA_BlockmapLib, // blockmap stuff
LUA_HudLib, // HUD stuff LUA_HudLib, // HUD stuff
LUA_FollowerLib, // follower_t, followers[] LUA_FollowerLib, // follower_t, followers[]
LUA_BotVarsLib, // botvars_t LUA_BotVarsLib, // botvars_t
LUA_TerrainLib, // t_splash_t, t_footstep_t, t_overlay_t, terrain_t LUA_TerrainLib, // t_splash_t, t_footstep_t, t_overlay_t, terrain_t
LUA_WaypointLib, // waypoint_t LUA_WaypointLib, // waypoint_t
LUA_VectorLib, // vectors LUA_VectorLib, // vectors
LUA_MatrixLib, // matrices LUA_MatrixLib, // matrices
LUA_QuaternionLib, // quaternions LUA_QuaternionLib, // quaternions
LUA_VoiceLib, // kartvoice_t, skinvoices[] LUA_VoiceLib, // kartvoice_t, skinvoices[]
LUA_ItemLib, // kartitem_t, kartresult_t, kartitemgraphics_t LUA_ItemLib, // kartitem_t, kartresult_t, kartitemgraphics_t
NULL NULL
}; };
@ -77,12 +77,8 @@ static lua_CFunction liblist[] = {
static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize) static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize)
{ {
(void)ud; (void)ud;
if (nsize == 0) { (void)osize;
if (osize != 0) return Z_Realloc(ptr, nsize, PU_LUA, NULL);
Z_Free(ptr);
return NULL;
} else
return Z_Realloc(ptr, nsize, PU_LUA, NULL);
} }
// Panic function Lua calls when there's an unprotected error. // Panic function Lua calls when there's an unprotected error.
@ -690,7 +686,8 @@ void LUA_ClearState(void)
lua_setfield(L, LUA_REGISTRYINDEX, LREG_METATABLES); lua_setfield(L, LUA_REGISTRYINDEX, LREG_METATABLES);
// open srb2 libraries // open srb2 libraries
for(i = 0; liblist[i]; i++) { for (i = 0; liblist[i]; i++)
{
lua_pushcfunction(L, liblist[i]); lua_pushcfunction(L, liblist[i]);
lua_call(L, 0, 0); lua_call(L, 0, 0);
} }

View file

@ -297,7 +297,7 @@ void Command_CheatGod_f(void)
void Command_Scale_f(void) void Command_Scale_f(void)
{ {
const double scaled = atof(COM_Argv(1)); const double scaled = atof(COM_Argv(1));
fixed_t scale = FLOAT_TO_FIXED(scaled); fixed_t scale = DoubleToFixed(scaled);
REQUIRE_DEVMODE; REQUIRE_DEVMODE;
REQUIRE_INLEVEL; REQUIRE_INLEVEL;

View file

@ -868,12 +868,12 @@ void R_SetSlopePlane(drawspandata_t* ds, pslope_t *slope, fixed_t xpos, fixed_t
// m is the v direction vector in view space // m is the v direction vector in view space
ang = ANG2RAD(ANGLE_180 - (angle + plangle)); ang = ANG2RAD(ANGLE_180 - (angle + plangle));
m->x = cos(ang); m->x = cosf(ang);
m->z = sin(ang); m->z = sinf(ang);
// n is the u direction vector in view space // n is the u direction vector in view space
n->x = sin(ang); n->x = sinf(ang);
n->z = -cos(ang); n->z = -cosf(ang);
plangle >>= ANGLETOFINESHIFT; plangle >>= ANGLETOFINESHIFT;
temp = P_GetSlopeZAt(slope, xpos + FINESINE(plangle), ypos + FINECOSINE(plangle)); temp = P_GetSlopeZAt(slope, xpos + FINESINE(plangle), ypos + FINECOSINE(plangle));

View file

@ -100,7 +100,7 @@ static const char *spritename;
typedef struct drawseg_xrange_item_s typedef struct drawseg_xrange_item_s
{ {
INT16 x1, x2; INT32 x1, x2;
drawseg_t *user; drawseg_t *user;
} drawseg_xrange_item_t; } drawseg_xrange_item_t;
@ -642,8 +642,8 @@ void R_InitSprites(void)
for (angle = 1; angle < ROTANGLES; angle++) for (angle = 1; angle < ROTANGLES; angle++)
{ {
fa = ANG2RAD(FixedAngle((ROTANGDIFF * angle)<<FRACBITS)); fa = ANG2RAD(FixedAngle((ROTANGDIFF * angle)<<FRACBITS));
rollcosang[angle] = FLOAT_TO_FIXED(cos(-fa)); rollcosang[angle] = FLOAT_TO_FIXED(cosf(-fa));
rollsinang[angle] = FLOAT_TO_FIXED(sin(-fa)); rollsinang[angle] = FLOAT_TO_FIXED(sinf(-fa));
} }
#endif #endif

View file

@ -1152,7 +1152,7 @@ UINT32 I_GetSongPosition(void)
void void
I_UpdateSongLagThreshold (void) I_UpdateSongLagThreshold (void)
{ {
stutter_threshold_user = cv_music_resync_threshold.value/1000.0*(4*44100); stutter_threshold_user = (UINT32)(cv_music_resync_threshold.value/1000.0*(4*44100));
I_UpdateSongLagConditions(); I_UpdateSongLagConditions();
} }

View file

@ -379,7 +379,7 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue)
if (!Cubeapply) if (!Cubeapply)
return; return;
linear = (*red/255.0); linear = (*red/255.0f);
#define dolerp(e1, e2) ((1 - linear)*e1 + linear*e2) #define dolerp(e1, e2) ((1 - linear)*e1 + linear*e2)
for (q = 0; q < 3; q++) for (q = 0; q < 3; q++)
{ {
@ -388,20 +388,20 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue)
working[2][q] = dolerp(Cubepal[0][0][1][q], Cubepal[1][0][1][q]); working[2][q] = dolerp(Cubepal[0][0][1][q], Cubepal[1][0][1][q]);
working[3][q] = dolerp(Cubepal[0][1][1][q], Cubepal[1][1][1][q]); working[3][q] = dolerp(Cubepal[0][1][1][q], Cubepal[1][1][1][q]);
} }
linear = (*green/255.0); linear = (*green/255.0f);
for (q = 0; q < 3; q++) for (q = 0; q < 3; q++)
{ {
working[0][q] = dolerp(working[0][q], working[1][q]); working[0][q] = dolerp(working[0][q], working[1][q]);
working[1][q] = dolerp(working[2][q], working[3][q]); working[1][q] = dolerp(working[2][q], working[3][q]);
} }
linear = (*blue/255.0); linear = (*blue/255.0f);
for (q = 0; q < 3; q++) for (q = 0; q < 3; q++)
{ {
working[0][q] = 255*dolerp(working[0][q], working[1][q]); working[0][q] = 255*dolerp(working[0][q], working[1][q]);
if (working[0][q] > 255.0) if (working[0][q] > 255.0f)
working[0][q] = 255.0; working[0][q] = 255.0f;
else if (working[0][q] < 0.0) else if (working[0][q] < 0.0f)
working[0][q] = 0.0; working[0][q] = 0.0f;
} }
#undef dolerp #undef dolerp