Compare commits

...
14 Commits
Author SHA1 Message Date
Alug c68c61975e Merge pull request #169 from Indev450/Saturn-Next
Saturn v8.1
2025-05-11 16:42:59 +01:00
Alug 6f7947dd5f fix smol oopsie for colourized speedlines 2025-05-11 17:41:25 +02:00
Alug cb8930fef6 v8.1 2025-05-11 17:13:22 +02:00
Alug 93d87e1132 fix oob write when map has playerstarts for 32 players
playerstarts is MAXPLAYERS big, which is 16 for us
2025-05-11 17:13:04 +02:00
Alug d5583ba040 add "nofork" parameter
to disable process forking
might be useful for gdb and perf
2025-05-11 17:12:56 +02:00
Alug 7bb3e4445e change colourized speeline behaviour slightly
"driftonly" will tone the lines completely instead of alternating between blue and driftcharge
"normal" will completely colourize speedlines in the player colour
2025-05-11 17:12:54 +02:00
Gustaf Alhäll 001a38bbd2 Fix off-by-one buffer overflow when getting LUT 255 2025-05-11 17:12:50 +02:00
Alug 463778cd88 fix 3d models tanking performance to hell 2025-05-11 01:23:07 +02:00
Alug f263585a72 make this check like vanilla did 2025-05-11 01:23:04 +02:00
Alug ec0ca0d1ab unlock everything when using modkartdata save
doesent make too much sense having to unlock everything again when playing mods
2025-05-10 23:43:04 +02:00
Alug 121540f428 dont check for how many controllers just attempt to reset "all"
JoyInfo->dev will be null
The crash before was most likely due to an oob read
2025-05-10 22:00:52 +02:00
Alug 8b5fd5f646 fix saturn menu 2025-05-10 19:16:32 +02:00
Alug 23a9afb727 fix typo in rumble reset 2025-05-10 18:59:56 +02:00
Alug 38b862ff16 Revert "skinlocal deez nuts"
This reverts commit 12ec3d11a2.
i hate localskins so much its unreal
2025-05-10 18:59:50 +02:00
12 changed files with 81 additions and 60 deletions

No files matched your search

+2 -2
View File
@@ -113,8 +113,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v8"
#define VERSIONSTRINGW L"Saturn v8"
#define VERSIONSTRING "Saturn v8.1"
#define VERSIONSTRINGW L"Saturn v8.1"
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
+11
View File
@@ -626,6 +626,17 @@ static void G_SetSaveGameModified(void)
strcatbf(savegamename, srb2home, PATHSEP);
G_LoadGameData();
// unlock EVERYTHING.
for (UINT8 i = 0; i < MAXUNLOCKABLES; i++)
{
if (!unlockables[i].conditionset)
continue;
if (!unlockables[i].unlocked)
{
unlockables[i].unlocked = true;
}
}
}
// for consistency among messages: this modifies the game and removes savemoddata.
+2 -5
View File
@@ -963,13 +963,10 @@ static void G_ResetPlayerDeviceRumble(INT32 playernum)
void G_ResetAllDeviceRumbles(void)
{
int i;
int devices;
devices = I_NumJoys();
for (i = 0; i < devices; i++)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
I_GamepadRumble(devices, 0, 0, 0);
I_GamepadRumble(i, 0, 0, 0);
}
}
-1
View File
@@ -75,7 +75,6 @@ struct GLPatch_s
{
GLMipmap_t *mipmap;
float max_s,max_t;
boolean notfound; // if the texture file was not found, mark it here (used in model texture loading)
};
typedef struct GLPatch_s GLPatch_t;
+13 -26
View File
@@ -397,7 +397,7 @@ static void md2_loadTexture(md2_t *model)
glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch);
if (glPatch->mipmap->format == 0)
{
glPatch->notfound = true;// mark it so its not searched for again repeatedly
model->notexturefile = true; // mark it so its not searched for again repeatedly
return;
}
@@ -468,7 +468,7 @@ static void md2_loadBlendTexture(md2_t *model)
glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch);
if (glPatch->mipmap->format == 0)
{
glPatch->notfound = true;// mark it so its not searched for again repeatedly
model->noblendfile = true; // mark it so its not searched for again repeatedly
Z_Free(filename);
return;
}
@@ -505,6 +505,8 @@ void HWR_InitMD2(void)
md2_playermodels[s].model = NULL;
md2_playermodels[s].glpatch = NULL;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notexturefile = false;
md2_playermodels[s].noblendfile = false;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
}
@@ -514,6 +516,8 @@ void HWR_InitMD2(void)
md2_localplayermodels[s].model = NULL;
md2_localplayermodels[s].glpatch = NULL;
md2_localplayermodels[s].skin = -1;
md2_localplayermodels[s].notexturefile = false;
md2_localplayermodels[s].noblendfile = false;
md2_localplayermodels[s].notfound = true;
md2_localplayermodels[s].error = false;
}
@@ -523,6 +527,8 @@ void HWR_InitMD2(void)
md2_models[i].model = NULL;
md2_models[i].glpatch = NULL;
md2_models[i].skin = -1;
md2_models[s].notexturefile = false;
md2_models[s].noblendfile = false;
md2_models[i].notfound = true;
md2_models[i].error = false;
}
@@ -543,21 +549,10 @@ void HWR_InitMD2(void)
}
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{
/*if (stricmp(name, "PLAY") == 0)
{
CONS_Printf("MD2 for sprite PLAY detected in mdls.dat, use a player skin instead!\n");
continue;
}*/
// 8/1/19: Allow PLAY to load for default MD2.
for (i = 0; i < NUMSPRITES; i++)
{
if (stricmp(name, sprnames[i]) == 0)
{
//if (stricmp(name, "PLAY") == 0)
//continue;
//CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset);
md2_models[i].scale = scale;
md2_models[i].offset = offset;
md2_models[i].notfound = false;
@@ -570,7 +565,6 @@ void HWR_InitMD2(void)
{
if (stricmp(name, skins[s].name) == 0)
{
//CONS_Printf(" Found: %s %s %f %f\n", name, filename, scale, offset);
md2_playermodels[s].skin = s;
md2_playermodels[s].scale = scale;
md2_playermodels[s].offset = offset;
@@ -1060,7 +1054,6 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLPatch_t *glPatch = patch->hardware;
GLPatch_t *glBlendPatch = NULL;
GLMipmap_t *glMipmap, *newMipmap;
@@ -1071,14 +1064,6 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
return;
}
if ((blendgpatch && (glBlendPatch = blendgpatch->hardware) && glBlendPatch->mipmap->format)
&& (patch->width != blendgpatch->width || patch->height != blendgpatch->height))
{
// Blend image exists, but it's bad.
GL_SetTexture(glPatch->mipmap);
return;
}
// search for the Mipmap
// skip the first (no colormap translated)
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
@@ -1305,7 +1290,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
hwrPatch = ((GLPatch_t *)gpatch->hardware);
if (!gpatch || !hwrPatch
|| ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !hwrPatch->notfound))
|| ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile))
md2_loadTexture(md2);
// Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
@@ -1320,7 +1305,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
if ((gpatch && hwrPatch && hwrPatch->mipmap->format) // don't load the blend texture if the base texture isn't available
&& (!blendgpatch || !hwrBlendPatch
|| ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !hwrPatch->notfound)))
|| ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile)))
md2_loadBlendTexture(md2);
// Load it again, because it isn't being loaded into blendgpatch after md2_loadblendtexture...
@@ -1330,7 +1315,9 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
if (gpatch && hwrPatch && hwrPatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE)
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
blendgpatch && hwrBlendPatch->mipmap->format
&& gpatch->width == blendgpatch->width && gpatch->height == blendgpatch->height)
{
INT32 tcskinnum = TC_DEFAULT;
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
+2
View File
@@ -29,7 +29,9 @@ typedef struct
float offset;
model_t *model;
void *glpatch;
boolean notexturefile; // true if texture file was not found
void *blendglpatch;
boolean noblendfile; // true if blend texture file was not found
boolean notfound;
INT32 skin;
boolean error;
+11 -5
View File
@@ -5617,9 +5617,13 @@ static boolean K_SpeedLinesShouldBlend(player_t *player)
static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
{
UINT8 speedcolor = SKINCOLOR_NONE;
const UINT8 playercolor = player->mo->color;
if (colorSpeed)
{
if (cv_coloredspeedlines.value != 3)
speedcolor = playercolor;
if (cv_coloredspeedlines.value >= 2 && player->kartstuff[k_driftboost])
{
if (player->kartstuff[k_driftboost] <= 20)
@@ -5628,9 +5632,10 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
speedcolor = SKINCOLOR_RASPBERRY;
else if (player->kartstuff[k_driftboost] <= 125)
speedcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
}
speedcolor = (leveltime & 1) ? ((cv_coloredspeedlines.value == 3) ? SKINCOLOR_NONE : player->mo->color) : speedcolor;
if (cv_coloredspeedlines.value == 2)
speedcolor = (leveltime & 1) ? playercolor : speedcolor;
}
}
if (cv_coloredspeedlines.value != 3)
@@ -5642,7 +5647,7 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed)
}
else if (player->kartstuff[k_invincibilitytimer])
{
speedcolor = player->mo->color;
speedcolor = playercolor;
}
}
@@ -10658,6 +10663,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
const skin_t *skin;
player_t *player = mo->player;
const boolean skinlocal = mo->skinlocal;
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos, wntdamxpos, wntdamypos;
@@ -10670,7 +10676,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
#endif
skin = K_GetMobjSkin(mo);
minimaphead = R_GetSkinFaceMini(player);
minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)];
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y);
@@ -10720,7 +10726,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
if (mo->colorized)
colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE);
else
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, mo->skinlocal);
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
V_DrawFixedPatch(amxpos, amypos, scale, flags, minimaphead, colormap);
+11 -11
View File
@@ -2303,25 +2303,25 @@ static menuitem_t OP_SaturnMenu[] =
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35},
{IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 45},
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 40},
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 50},
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 50},
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 60},
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 60},
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 70},
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 70},
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 80},
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 80},
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 90},
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 90},
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 100},
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 100},
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 110},
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 110},
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 120},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 120},
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 125},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 130}, // uwu
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 130},
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 135},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 140}, // uwu
};
static const char* OP_SaturnTooltips[] =
+8 -3
View File
@@ -3996,7 +3996,10 @@ void A_SignPlayer(mobj_t *actor)
if (LUA_CallAction(A_SIGNPLAYER, actor))
return;
if (!actor->target || !actor->target->player)
if (!actor->target)
return;
if (!actor->target->player)
return;
// Set the sign to be an appropriate background color for this player's skincolor.
@@ -4011,9 +4014,11 @@ void A_SignPlayer(mobj_t *actor)
// needs - 1 or else it pukes an error out
// same thing happens on p_mobj.c
if (actor->target->skinlocal)
ov->localskin = &localskins[actor->target->player->localskin - 1];
else if (actor->target->player->localskin)
ov->localskin = &skins[actor->target->player->localskin - 1];
ov->skinlocal = actor->target->skinlocal;
if (ov->skinlocal || actor->target->player->localskin)
ov->localskin = &K_GetSkinArray(ov->skinlocal)[actor->target->player->localskin - 1];
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
}
+11 -3
View File
@@ -11034,9 +11034,17 @@ void P_SpawnMapThing(mapthing_t *mthing)
// check for players specially
if (mthing->type > 0 && mthing->type <= 32)
{
// save spots for respawning in network games
if (!metalrecording)
playerstarts[mthing->type-1] = mthing;
if (mthing->type > MAXPLAYERS) // be wary of playerstarts size! playerstarts[MAXPLAYERS]
{
CONS_Alert(CONS_ERROR, "Excess player start detected %d This will crash vanilla clients!\n", mthing->type);
}
else
{
// save spots for respawning in network games
if (!metalrecording)
playerstarts[mthing->type-1] = mthing;
}
return;
}
+9 -3
View File
@@ -1485,6 +1485,7 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength,
(void)duration;
#else
SDL_GameController *controller = JoyInfo[playernum].dev;
if (controller == NULL)
{
return;
@@ -1503,6 +1504,7 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
(void)blue;
#else
SDL_GameController *controller = JoyInfo[playernum].dev;
if (controller == NULL)
{
return;
@@ -1921,7 +1923,10 @@ INT32 I_StartupSystem(void)
SDL_GetVersion(&SDLlinked);
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
I_Fork();
// This is useful when debugging. It lets GDB attach to
// the correct process easily.
if (!M_CheckParm("-nofork"))
I_Fork();
#endif
#ifdef HAVE_THREADS
I_start_threads();
@@ -2213,9 +2218,10 @@ void I_ShutdownSystem(void)
{
INT32 c;
#ifndef NEWSIGNALHANDLER
I_ShutdownConsole();
#ifdef NEWSIGNALHANDLER
if (M_CheckParm("-nofork"))
#endif
I_ShutdownConsole();
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
if (quit_funcs[c])
+1 -1
View File
@@ -45,7 +45,7 @@ typedef struct
{
boolean init;
RGBA_t palette[256];
UINT16 table[0xFFFF];
UINT16 table[0x10000];
} colorlookup_t;
void InitColorLUT(colorlookup_t *lut, RGBA_t *palette, boolean makecolors);