diff --git a/src/doomdef.h b/src/doomdef.h index 4c4a2a3aa..ab6385659 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -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! diff --git a/src/g_game.c b/src/g_game.c index bf1ce0206..44b9cf370 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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. diff --git a/src/g_input.c b/src/g_input.c index 41c11c204..963663504 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -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); } } diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index f253eccb8..45d072c28 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -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; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index de78808e6..0de904716 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -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" diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index e9eafd387..2e3e005b7 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -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; diff --git a/src/k_kart.c b/src/k_kart.c index 3f3048278..466c5cc9f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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); diff --git a/src/m_menu.c b/src/m_menu.c index 3e8832853..c1abd2903 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -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[] = diff --git a/src/p_enemy.c b/src/p_enemy.c index 195df59b0..d500a0cb2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -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 } diff --git a/src/p_mobj.c b/src/p_mobj.c index 3780ef949..bb894538e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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; } diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index b622c4c45..e23f155e0 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -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]) diff --git a/src/v_video.h b/src/v_video.h index c8f614afc..00d0f6cb2 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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);