diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cd9f1af24..9753bf11a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1106,17 +1106,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_ps_thinkframe_page); CV_RegisterVar(&cv_ps_samplesize); CV_RegisterVar(&cv_ps_descriptor); - - CV_RegisterVar(&cv_invincmusicfade); - CV_RegisterVar(&cv_growmusicfade); - - CV_RegisterVar(&cv_respawnfademusicout); - CV_RegisterVar(&cv_respawnfademusicback); - - CV_RegisterVar(&cv_resetspecialmusic); - - CV_RegisterVar(&cv_resume); - CV_RegisterVar(&cv_fading); //Value used to store last server player has joined CV_RegisterVar(&cv_lastserver); diff --git a/src/g_game.c b/src/g_game.c index 6f7bce1cd..55438cc83 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -519,14 +519,6 @@ consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldis consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_resetspecialmusic = {"resetspecialmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; - #if MAXPLAYERS > 16 #error "please update player_name table using the new value for MAXPLAYERS" #endif @@ -2832,7 +2824,7 @@ void G_PlayerReborn(INT32 player) /* I'm putting this here because lol */ - fade = ( cv_fading.value && P_IsLocalPlayer(p) ); + fade = (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(p)); if (fade) { diff --git a/src/g_game.h b/src/g_game.h index 8cebc088a..2f69070af 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -160,19 +160,8 @@ extern consvar_t cv_sliptideroll; extern consvar_t cv_slamsound; extern consvar_t cv_sloperolldist; -extern consvar_t cv_invincmusicfade; -extern consvar_t cv_growmusicfade; - -extern consvar_t cv_respawnfademusicout; -extern consvar_t cv_respawnfademusicback; - -extern consvar_t cv_resetspecialmusic; - extern consvar_t cv_cechotoggle; -extern consvar_t cv_resume; -extern consvar_t cv_fading; - #ifndef NONET extern consvar_t cv_chatlogsize; #endif diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 8f94abbba..cfb9fae2c 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -1138,10 +1138,13 @@ static inline boolean saveTGA(const char *file_name, void *buffer, UINT8 *HWR_GetScreenshot(void) { - UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf)); + static UINT8 *buf = NULL; + + buf = realloc(buf, vid.width * vid.height * 3); if (!buf) return NULL; + // returns 24bit 888 RGB HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf); return buf; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2ce496ae1..9846c2b1f 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3293,9 +3293,9 @@ boolean HWR_CheckBBox(fixed_t *bspcoord) void HWR_AddPolyObjectSegs(void) { size_t i, j; - seg_t *gr_fakeline = Z_Calloc(sizeof(seg_t), PU_STATIC, NULL); - polyvertex_t *pv1 = Z_Calloc(sizeof(polyvertex_t), PU_STATIC, NULL); - polyvertex_t *pv2 = Z_Calloc(sizeof(polyvertex_t), PU_STATIC, NULL); + seg_t gr_fakeline; + polyvertex_t pv1; + polyvertex_t pv2; // Sort through all the polyobjects for (i = 0; i < numpolys; ++i) @@ -3304,25 +3304,20 @@ void HWR_AddPolyObjectSegs(void) for (j = 0; j < po_ptrs[i]->segCount; ++j) { // Copy the info of a polyobject's seg, then convert it to OpenGL floating point - M_Memcpy(gr_fakeline, po_ptrs[i]->segs[j], sizeof(seg_t)); + M_Memcpy(&gr_fakeline, po_ptrs[i]->segs[j], sizeof(seg_t)); // Now convert the line to float and add it to be rendered - pv1->x = FIXED_TO_FLOAT(gr_fakeline->v1->x); - pv1->y = FIXED_TO_FLOAT(gr_fakeline->v1->y); - pv2->x = FIXED_TO_FLOAT(gr_fakeline->v2->x); - pv2->y = FIXED_TO_FLOAT(gr_fakeline->v2->y); + pv1.x = FIXED_TO_FLOAT(gr_fakeline.v1->x); + pv1.y = FIXED_TO_FLOAT(gr_fakeline.v1->y); + pv2.x = FIXED_TO_FLOAT(gr_fakeline.v2->x); + pv2.y = FIXED_TO_FLOAT(gr_fakeline.v2->y); - gr_fakeline->pv1 = pv1; - gr_fakeline->pv2 = pv2; + gr_fakeline.pv1 = &pv1; + gr_fakeline.pv2 = &pv2; - HWR_AddLine(gr_fakeline); + HWR_AddLine(&gr_fakeline); } } - - // Free temporary data no longer needed - Z_Free(pv2); - Z_Free(pv1); - Z_Free(gr_fakeline); } #ifdef POLYOBJECTS_PLANES @@ -5558,7 +5553,7 @@ void HWR_ProjectSprite(mobj_t *thing) rot = thing->frame&FF_FRAMEMASK; //Fab : 02-08-98: 'skin' override spritedef currently used for skin - if (thing->skin && thing->sprite == SPR_PLAY) + if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY) { sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef; #ifdef ROTSPRITE @@ -6256,8 +6251,15 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t * if (!rootportal && portallist.base && !skybox)// if portals have been drawn in the main view, then render skywalls differently gr_collect_skywalls = true; + // HAYA: Save the old portal state, and turn portals off while normally rendering the BSP tree. + // This fixes specific effects not working, such as horizon lines. + int oldportal_state = gr_portal; + + gr_portal = GRPORTAL_OFF; // TURN IT OFF // Recursively "render" the BSP tree. HWR_RenderBSPNode((INT32)numnodes-1); + // woo we back + gr_portal = oldportal_state; PS_STOP_TIMING(ps_bsptime); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index d558a0834..b69a3c951 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1374,8 +1374,13 @@ void InitPalette(int flashnum, boolean skiplut) pglBindTexture(GL_TEXTURE_3D, palette_tex_num); pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - if (!pglTexImage3D) - I_Error("pglTexImage3D is NULL!"); + + if (!pglTexImage3D){ + GL_MSG_Error("pglTexImage3D is NULL!"); + CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it + return; + } + pglTexImage3D(GL_TEXTURE_3D, 0, internalFormat, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex); free(pal_lookup_tex); } @@ -1595,13 +1600,31 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable) ltcachetail = cache_entry; } ltcachetail->next = NULL; + + GLenum internalFormat; + if (gl_version[0] == '1' || gl_version[0] == '2') + { + // if the OpenGL version is below 3.0, then the GL_R8 format may not be available. + // so use GL_LUMINANCE8 instead to get a single component 8-bit format + // (it is possible to have access to shaders even in some OpenGL 1.x systems, + // so palette rendering can still possibly be achieved there) + internalFormat = GL_LUMINANCE8; + } + else + { + internalFormat = GL_R8; + } + pglGenTextures(1, <cachetail->id); - if (!ltcachetail->id) - I_Error("hwr lighttable cache entry id is zero"); + if (!ltcachetail->id){ + GL_MSG_Error("HWR Lighttable cache entry id is zero"); + CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it + return; + } pglBindTexture(GL_TEXTURE_2D, ltcachetail->id); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - pglTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 256, 32, 0, GL_RED, GL_UNSIGNED_BYTE, lighttable); + pglTexImage2D(GL_TEXTURE_2D, 0, internalFormat, 256, 32, 0, GL_RED, GL_UNSIGNED_BYTE, lighttable); // restore previously bound texture if (!gl_batching) @@ -1734,7 +1757,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too - if (!gl_palette_initialized) + if ((!gl_palette_initialized) && (HWR_ShouldUsePaletteRendering())) InitPalette(0, false); // just gonna put this here for now } diff --git a/src/k_kart.c b/src/k_kart.c index e199fd01c..3c843f88d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -599,8 +599,8 @@ UINT8 K_GetHudColor(void) if (cv_colorizedhud.value){ if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; } - if (stplyr && P_IsLocalPlayer(stplyr)) return stplyr->skincolor; - return (stplyr ? stplyr->skincolor : cv_playercolor.value); + if (stplyr && P_IsLocalPlayer(stplyr) && gamestate == GS_LEVEL) return stplyr->skincolor; + return ((stplyr && gamestate == GS_LEVEL) ? stplyr->skincolor : cv_playercolor.value); } //} @@ -6028,7 +6028,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) P_SetScale(overlay, player->mo->scale); } player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds - if (P_IsLocalPlayer(player) && cv_supermusic.value) + if (P_IsLocalPlayer(player) && cv_supermusic.value && cv_birdmusic.value) S_ChangeMusicSpecial("kinvnc"); else S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc)); @@ -6233,7 +6233,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (cv_kartdebugshrink.value && !modeattacking && !player->bot) player->mo->destscale = (6*player->mo->destscale)/8; player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds - if (P_IsLocalPlayer(player) && cv_growmusic.value) + if (P_IsLocalPlayer(player) && cv_growmusic.value && cv_birdmusic.value ) S_ChangeMusicSpecial("kgrow"); else S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow)); @@ -8083,7 +8083,6 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI } } - if (!cv_colorizedhud.value || !clr_hud) V_DrawScaledPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwide : kp_timestickerwide)); else diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 340bc1352..04bbaa928 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -596,6 +596,42 @@ static int libd_drawOnMinimap(lua_State *L) return 0; } +static int libd_drawStretched(lua_State *L) +{ + fixed_t x, y, hscale, vscale; + INT32 flags; + patch_t *patch; + UINT8 *colormap = NULL; + huddrawlist_h list; + + HUDONLY + x = luaL_checkinteger(L, 1); + y = luaL_checkinteger(L, 2); + hscale = luaL_checkinteger(L, 3); + if (hscale < 0) + return luaL_error(L, "negative horizontal scale"); + vscale = luaL_checkinteger(L, 4); + if (vscale < 0) + return luaL_error(L, "negative vertical scale"); + patch = *((patch_t **)luaL_checkudata(L, 5, META_PATCH)); + flags = luaL_optinteger(L, 6, 0); + if (!lua_isnoneornil(L, 7)) + colormap = *((UINT8 **)luaL_checkudata(L, 7, META_COLORMAP)); + + flags &= ~V_PARAMMASK; // Don't let crashes happen. + + lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST"); + list = (huddrawlist_h) lua_touserdata(L, -1); + lua_pop(L, 1); + + if (LUA_HUD_IsDrawListValid(list)) + LUA_HUD_AddDrawStretched(list, x, y, hscale, vscale, patch, flags, colormap); + else + V_DrawStretchyFixedPatch(x, y, hscale, vscale, flags, patch, colormap); + return 0; +} + + static int libd_drawNum(lua_State *L) { INT32 x, y, flags, num; @@ -913,6 +949,7 @@ static luaL_Reg lib_draw[] = { {"cachePatch", libd_cachePatch}, {"draw", libd_draw}, {"drawScaled", libd_drawScaled}, + {"drawStretched", libd_drawStretched}, {"drawNum", libd_drawNum}, {"drawPaddedNum", libd_drawPaddedNum}, {"drawPingNum", libd_drawPingNum}, diff --git a/src/lua_hudlib_drawlist.c b/src/lua_hudlib_drawlist.c index eedbff910..c543c15d8 100644 --- a/src/lua_hudlib_drawlist.c +++ b/src/lua_hudlib_drawlist.c @@ -20,6 +20,7 @@ enum drawitem_e { DI_Draw = 0, DI_DrawScaled, + DI_DrawStretched, DI_DrawNum, DI_DrawPaddedNum, DI_DrawPingNum, @@ -216,6 +217,29 @@ void LUA_HUD_AddDrawScaled( item->colormap = colormap; } +void LUA_HUD_AddDrawStretched( + huddrawlist_h list, + fixed_t x, + fixed_t y, + fixed_t hscale, + fixed_t vscale, + patch_t *patch, + INT32 flags, + UINT8 *colormap +) +{ + size_t i = AllocateDrawItem(list); + drawitem_t *item = &list->items[i]; + item->type = DI_DrawStretched; + item->x = x; + item->y = y; + item->hscale = hscale; + item->vscale = vscale; + item->patch = patch; + item->flags = flags; + item->colormap = colormap; +} + void LUA_HUD_AddDrawNum( huddrawlist_h list, INT32 x, @@ -377,6 +401,9 @@ void LUA_HUD_DrawList(huddrawlist_h list) case DI_DrawScaled: V_DrawFixedPatch(item->x, item->y, item->scale, item->flags, item->patch, item->colormap); break; + case DI_DrawStretched: + V_DrawStretchyFixedPatch(item->x, item->y, item->hscale, item->vscale, item->flags, item->patch, item->colormap); + break; case DI_DrawNum: V_DrawTallNum(item->x, item->y, item->flags, item->num); break; diff --git a/src/lua_hudlib_drawlist.h b/src/lua_hudlib_drawlist.h index 992578778..4354b6f95 100644 --- a/src/lua_hudlib_drawlist.h +++ b/src/lua_hudlib_drawlist.h @@ -42,6 +42,16 @@ void LUA_HUD_AddDraw( INT32 flags, UINT8 *colormap ); +void LUA_HUD_AddDrawStretched( + huddrawlist_h list, + fixed_t x, + fixed_t y, + fixed_t hscale, + fixed_t vscale, + patch_t *patch, + INT32 flags, + UINT8 *colormap +); void LUA_HUD_AddDrawScaled( huddrawlist_h list, fixed_t x, diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index cfc5c8e5f..06c56645f 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -217,7 +217,7 @@ UNIMPLEMENTED(mobjnum) // For some dumb reason it is valid to set sloperoll, even though it is read // only -int mobj_sloperoll_noop(lua_State *L) { return 0; } +int mobj_sloperoll_noop(lua_State *L) { (void)L; return 0; } // Now other getters/setters with arbitary logic @@ -415,13 +415,40 @@ int mobj_localskin_setter(lua_State *L) { mobj_t *mo = GETMO(); - // TODO - add ability to set localskin to non-player mobjs - // Will probably just need to reimplement SetLocalPlayerSkin as something - // like SetLocalObjectSkin - if (!mo->player) - return luaL_error(L, "mobj.localskin can't be set for non-player mobjs!"); + if (mo->player) + { + SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL); + } + else + { + INT32 i; + char skin[SKINNAMESIZE+1]; // all skin names are limited to this length + strlcpy(skin, luaL_checkstring(L, 2), sizeof skin); + strlwr(skin); // all skin names are lowercase + + // Try localskins + for (i = 0; i < numlocalskins; i++) + { + if (stricmp(localskins[i].name, skin) == 0) + { + mo->localskin = &localskins[i]; + mo->skinlocal = true; + return 0; + } + } + + // Try other skins + for (i = 0; i < numskins; i++) + { + if (fastcmp(skins[i].name, skin)) + { + mo->localskin = &skins[i]; + mo->skinlocal = false; + return 0; + } + } + } - SetLocalPlayerSkin(mo->player - players, luaL_checkstring(L, 2), NULL); return 0; } diff --git a/src/m_anigif.c b/src/m_anigif.c index 8071f030d..744651319 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -465,19 +465,23 @@ static size_t gifframe_size = 8192; static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr) { UINT8 r, g, b; - size_t src = 0, dest = 0; - size_t size = (vid.width * vid.height * 3); + size_t src, dest; + int x, y; InitColorLUT(); - while (src < size) + for (x = 0; x < vid.width; x += scrbuf_downscaleamt) { - r = (UINT8)linear[src]; - g = (UINT8)linear[src + 1]; - b = (UINT8)linear[src + 2]; - scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS]; - src += (3 * scrbuf_downscaleamt); - dest += scrbuf_downscaleamt; + for (y = 0; y < vid.height; y += scrbuf_downscaleamt) + { + dest = y*vid.width + x; + src = dest*3; + + r = (UINT8)linear[src]; + g = (UINT8)linear[src + 1]; + b = (UINT8)linear[src + 2]; + scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS]; + } } } #endif @@ -514,7 +518,7 @@ static void GIF_framewrite(void) { UINT8 *linear = HWR_GetScreenshot(); GIF_rgbconvert(linear, movie_screen); - free(linear); + //free(linear); // Allocated 'statically', no need to free now } #endif } @@ -530,7 +534,7 @@ static void GIF_framewrite(void) { UINT8 *linear = HWR_GetScreenshot(); GIF_rgbconvert(linear, screens[0]); - free(linear); + //free(linear); // Allocated 'statically', no need to free now } #endif diff --git a/src/m_menu.c b/src/m_menu.c index 1a8cc57ce..bb0c9d3e6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2194,10 +2194,11 @@ static menuitem_t OP_BirdMenu[] = //{IT_STRING | IT_CVAR, NULL, "Encore Choices", &cv_encorevotes, 90}, {IT_HEADER, NULL, "Music", NULL, 70}, - {IT_STRING | IT_CVAR, NULL, "Resume Level Music", &cv_resume, 80}, - {IT_STRING | IT_CVAR, NULL, "Restart Special Music", &cv_resetspecialmusic, 90}, + {IT_STRING | IT_CVAR, NULL, "Music Features", &cv_birdmusic, 80}, + {IT_STRING | IT_CVAR, NULL, "Resume Level Music", &cv_resume, 95}, + {IT_STRING | IT_CVAR, NULL, "Restart Special Music", &cv_resetspecialmusic, 105}, - {IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120}, + {IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 130}, }; static const char* OP_BirdTooltips[] = @@ -2211,12 +2212,27 @@ static const char* OP_BirdTooltips[] = //"Only show one battle choice in map vote", //"Amount of encore choices in map vote.", NULL, + "Global toggle for all bird music features.", "Resume level music from last position after music change.", "Restart Special music if item is used again.", "Options for advanced music settings.", }; +enum +{ + headercrzy, + tiltmenu, + headerhud, + viewpointext, + freeplaytext, + headermusic, + birdmusic, + lvlresum, + spclresum, + advmusic, +}; + static menuitem_t OP_ForkedBirdMenu[] = { {IT_HEADER, NULL, "Local Skins", NULL, 0}, @@ -3164,6 +3180,19 @@ void Bird_menu_Onchange(void) OP_AdvancedBirdMenu[fadegrow].status = status; OP_AdvancedBirdMenu[respawnfadeout].status = status; OP_AdvancedBirdMenu[respawnfadein].status = status; + + if (cv_birdmusic.value) + { + OP_BirdMenu[lvlresum].status = IT_STRING | IT_CVAR; + OP_BirdMenu[spclresum].status = IT_STRING | IT_CVAR; + OP_BirdMenu[advmusic].status = IT_STRING | IT_SUBMENU; + } + else + { + OP_BirdMenu[lvlresum].status = IT_GRAYEDOUT; + OP_BirdMenu[spclresum].status = IT_GRAYEDOUT; + OP_BirdMenu[advmusic].status = IT_GRAYEDOUT; + } } //menu code is nice @@ -12014,7 +12043,7 @@ static void M_DrawSetupMultiPlayerMenu(void) patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_CACHE); // draw box around guy - V_DrawFill(mx + 43 - (charw/2), my+65, charw, 84, 239); + V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239); // draw player sprite if (setupm_fakecolor) // inverse should never happen @@ -12023,13 +12052,13 @@ static void M_DrawSetupMultiPlayerMenu(void) if (skins[skintodisplay].flags & SF_HIRES) { - V_DrawFixedPatch((mx+43)<player->playerstate = PST_DEAD; - if (cv_fading.value && P_IsLocalPlayer(target->player)) + if (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(target->player)) { if (netgame || multiplayer) ms = cv_respawntime.value * 1000; diff --git a/src/p_setup.c b/src/p_setup.c index 3167d8462..ee87f8657 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3490,11 +3490,8 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) if (wadfiles[wadnum]->important) partadd_important = true; - - if (local) - wadfiles[wadnum]->localfile = true; - else - wadfiles[wadnum]->localfile = false; + + wadfiles[wadnum]->localfile = local; // // search for sound replacements diff --git a/src/p_user.c b/src/p_user.c index 517e6a07f..fab59d28b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1281,13 +1281,17 @@ void P_RestoreMusic(player_t *player) if (wantedmus == 2 && cv_growmusic.value) { S_ChangeMusicInternal("kgrow", true); - S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); + + if (cv_birdmusic.value) + S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); } // Item - Invincibility else if (wantedmus == 1 && cv_supermusic.value) { S_ChangeMusicInternal("kinvnc", true); - S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); + + if (cv_birdmusic.value) + S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); } else { @@ -1297,14 +1301,20 @@ void P_RestoreMusic(player_t *player) if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1)) S_SpeedMusic(1.2f); #endif - if (mapmusresume && cv_resume.value) - position = mapmusresume; - else - position = mapmusposition; + if (cv_birdmusic.value) + { + if (mapmusresume && cv_resume.value) + position = mapmusresume; + else + position = mapmusposition; - S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, - S_GetRestoreMusicFadeIn()); - S_ClearRestoreMusicFadeInCvar(); + S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, + S_GetRestoreMusicFadeIn()); + S_ClearRestoreMusicFadeInCvar(); + } + else + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); + mapmusresume = 0; } } diff --git a/src/r_data.c b/src/r_data.c index 4010aae0b..4a8ab0a45 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1325,7 +1325,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) extra_colormaps[mapnum].fadeend = (UINT16)fadeend; extra_colormaps[mapnum].fog = fog; - if (rendermode == render_soft || rendermode == render_opengl) + if (rendermode != render_none) { double r, g, b, cbrightness; int p; diff --git a/src/r_draw8.c b/src/r_draw8.c index 7f1c0763c..c80ff2cbc 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -542,16 +542,19 @@ void R_DrawTranslatedColumn_8(void) */ void R_DrawSpan_8 (void) { - UINT32 xposition; - UINT32 yposition; - UINT32 xstep, ystep; + fixed_t xposition; + fixed_t yposition; + fixed_t xstep, ystep; UINT8 *source; UINT8 *colormap; UINT8 *dest; const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - size_t count; + size_t count = (ds_x2 - ds_x1 + 1); + + xposition = ds_xfrac; yposition = ds_yfrac; + xstep = ds_xstep; ystep = ds_ystep; // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest // can be used for the fraction part. This allows calculation of the memory address in the @@ -560,13 +563,12 @@ void R_DrawSpan_8 (void) // bit per power of two (obviously) // Ok, because I was able to eliminate the variable spot below, this function is now FASTER // than the original span renderer. Whodathunkit? - xposition = ds_xfrac << nflatshiftup; yposition = ds_yfrac << nflatshiftup; - xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup; + xposition <<= nflatshiftup; yposition <<= nflatshiftup; + xstep <<= nflatshiftup; ystep <<= nflatshiftup; source = ds_source; colormap = ds_colormap; dest = ylookup[ds_y] + columnofs[ds_x1]; - count = ds_x2 - ds_x1 + 1; if (dest+8 > deststop) return; @@ -576,35 +578,35 @@ void R_DrawSpan_8 (void) // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't // have the uber complicated math to calculate it now, so that was a memory write we didn't // need! - dest[0] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[0] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - dest[1] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[1] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - dest[2] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[2] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - dest[3] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[3] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - dest[4] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[4] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - dest[5] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[5] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - dest[6] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[6] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - dest[7] = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + dest[7] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; @@ -613,7 +615,7 @@ void R_DrawSpan_8 (void) } while (count-- && dest <= deststop) { - *dest++ = colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; + *dest++ = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; } @@ -1281,15 +1283,20 @@ void R_DrawTranslucentSplat_8 (void) */ void R_DrawTranslucentSpan_8 (void) { - UINT32 xposition; - UINT32 yposition; - UINT32 xstep, ystep; + fixed_t xposition; + fixed_t yposition; + fixed_t xstep, ystep; UINT8 *source; UINT8 *colormap; UINT8 *dest; + const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - size_t count; + size_t count = (ds_x2 - ds_x1 + 1); + UINT32 val; + + xposition = ds_xfrac; yposition = ds_yfrac; + xstep = ds_xstep; ystep = ds_ystep; // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest // can be used for the fraction part. This allows calculation of the memory address in the @@ -1298,57 +1305,57 @@ void R_DrawTranslucentSpan_8 (void) // bit per power of two (obviously) // Ok, because I was able to eliminate the variable spot below, this function is now FASTER // than the original span renderer. Whodathunkit? - xposition = ds_xfrac << nflatshiftup; yposition = ds_yfrac << nflatshiftup; - xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup; + xposition <<= nflatshiftup; yposition <<= nflatshiftup; + xstep <<= nflatshiftup; ystep <<= nflatshiftup; source = ds_source; colormap = ds_colormap; dest = ylookup[ds_y] + columnofs[ds_x1]; - count = ds_x2 - ds_x1 + 1; while (count >= 8) { // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't // have the uber complicated math to calculate it now, so that was a memory write we didn't // need! - dest[0] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[0]); + dest[0] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[0]); xposition += xstep; yposition += ystep; - dest[1] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[1]); + dest[1] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[1]); xposition += xstep; yposition += ystep; - dest[2] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[2]); + dest[2] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[2]); xposition += xstep; yposition += ystep; - dest[3] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[3]); + dest[3] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[3]); xposition += xstep; yposition += ystep; - dest[4] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[4]); + dest[4] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[4]); xposition += xstep; yposition += ystep; - dest[5] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[5]); + dest[5] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[5]); xposition += xstep; yposition += ystep; - dest[6] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[6]); + dest[6] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[6]); xposition += xstep; yposition += ystep; - dest[7] = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + dest[7]); + dest[7] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[7]); xposition += xstep; yposition += ystep; dest += 8; count -= 8; } - while (count--) + while (count-- && dest <= deststop) { - *dest = *(ds_transmap + (colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]] << 8) + *dest); + val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); + *dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest); dest++; xposition += xstep; yposition += ystep; diff --git a/src/r_things.c b/src/r_things.c index d08b57501..6334716ce 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1399,7 +1399,7 @@ static void R_ProjectSprite(mobj_t *thing) rot = thing->frame&FF_FRAMEMASK; //Fab : 02-08-98: 'skin' override spritedef currently used for skin - if (thing->skin && thing->sprite == SPR_PLAY) + if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY) { sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef; #ifdef ROTSPRITE diff --git a/src/s_sound.c b/src/s_sound.c index d622f724d..0aeaa9f4e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -28,6 +28,7 @@ #include "p_local.h" // camera info #include "m_misc.h" // for tunes command #include "m_cond.h" // for conditionsets +#include "m_menu.h" // bird music stuff #ifdef HAVE_BLUA #include "lua_hook.h" // MusicChange hook @@ -99,6 +100,7 @@ consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_ consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +//bird music stuff static CV_PossibleValue_t music_resync_threshold_cons_t[] = { {0, "MIN"}, {1000, "MAX"}, @@ -109,6 +111,16 @@ consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagConditions, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_resetspecialmusic = {"resetspecialmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_birdmusic = {"birdmusicstuff", "No", CV_SAVE|CV_CALL, CV_YesNo, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; + + #ifdef HAVE_OPENMPT openmpt_module *openmpt_mhandle = NULL; @@ -273,12 +285,25 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_gamemidimusic); #endif + //bird music stuff CV_RegisterVar(&cv_playmusicifunfocused); CV_RegisterVar(&cv_playsoundifunfocused); CV_RegisterVar(&cv_pausemusic); CV_RegisterVar(&cv_music_resync_threshold); CV_RegisterVar(&cv_music_resync_powerups_only); + + CV_RegisterVar(&cv_invincmusicfade); + CV_RegisterVar(&cv_growmusicfade); + + CV_RegisterVar(&cv_respawnfademusicout); + CV_RegisterVar(&cv_respawnfademusicback); + + CV_RegisterVar(&cv_resetspecialmusic); + + CV_RegisterVar(&cv_resume); + CV_RegisterVar(&cv_fading); + CV_RegisterVar(&cv_birdmusic); COM_AddCommand("tunes", Command_Tunes_f); COM_AddCommand("restartaudio", Command_RestartAudio_f); @@ -1750,7 +1775,8 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms) if (S_MusicDisabled()) return false; - I_UpdateSongLagConditions(); + if (cv_birdmusic.value) + I_UpdateSongLagConditions(); if ((!fadeinms && !I_PlaySong(looping)) || (fadeinms && !I_FadeInPlaySong(fadeinms, looping))) @@ -1874,8 +1900,10 @@ void S_StopMusic(void) || demo.title) // SRB2Kart: Demos don't interrupt title screen music return; - if (strcasecmp(music_name, mapmusname) == 0) + if ((cv_birdmusic.value) && (strcasecmp(music_name, mapmusname) == 0)) mapmusresume = I_GetSongPosition(); + else + mapmusresume = 0; if (I_SongPaused()) I_ResumeSong(); diff --git a/src/s_sound.h b/src/s_sound.h index 44267bc21..fb57665e2 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -53,9 +53,23 @@ extern consvar_t cv_amigatype; #endif #endif +//bird music stuff extern consvar_t cv_music_resync_threshold; extern consvar_t cv_music_resync_powerups_only; +extern consvar_t cv_invincmusicfade; +extern consvar_t cv_growmusicfade; + +extern consvar_t cv_respawnfademusicout; +extern consvar_t cv_respawnfademusicback; + +extern consvar_t cv_resetspecialmusic; + +extern consvar_t cv_resume; +extern consvar_t cv_fading; +extern consvar_t cv_birdmusic; + + extern CV_PossibleValue_t soundvolume_cons_t[]; typedef enum diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index ce9a8b12f..b34ccb18a 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -624,7 +624,7 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata) return; music_bytes += len; - if (gamestate == GS_LEVEL) + if ((gamestate == GS_LEVEL) && (cv_birdmusic.value)) Countstutter(len); } diff --git a/src/st_stuff.c b/src/st_stuff.c index ac7eb9c41..e444d2184 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -245,7 +245,7 @@ void ST_doPaletteStuff(void) palette = 0; #ifdef HWRENDER - if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && !cv_grflashpal.value)) + if ((rendermode == render_opengl && !HWR_ShouldUsePaletteRendering()) || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && !cv_grflashpal.value)) palette = 0; // No flashpals here in OpenGL #endif