From bae1456499767691c2f3df9e98b834574744ba6b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 17 Sep 2010 16:09:17 +0000 Subject: [PATCH] - sync menu branch with trunk SVN r2809 (menu) --- src/CMakeLists.txt | 1 - src/g_doom/a_doomweaps.cpp | 2 +- src/g_level.cpp | 2 +- src/m_menu.h | 0 src/m_options.cpp | 0 src/menu/menu.cpp | 59 +++++---- src/menu/menudef.cpp | 26 ++-- src/menu/optionmenu.cpp | 41 ------ src/menu/optionmenuitems.h | 53 +++++++- src/menu/playerdisplay.cpp | 16 ++- src/menu/playermenu.cpp | 5 +- src/p_acs.cpp | 92 ++++++++++---- src/p_glnodes.cpp | 42 +++++++ src/p_map.cpp | 28 +++-- src/s_advsound.cpp | 36 +----- src/s_sound.cpp | 30 +++-- src/sdl/i_input.cpp | 2 +- src/v_video.cpp | 6 + src/v_video.h | 3 +- src/win32/i_input.cpp | 12 +- src/win32/i_mouse.cpp | 2 + src/win32/win32iface.h | 2 + wadsrc/static/actors/doom/doomweapons.txt | 1 + wadsrc/static/menudef.txt | 145 ++++++++++++++++++---- 24 files changed, 413 insertions(+), 193 deletions(-) delete mode 100644 src/m_menu.h delete mode 100644 src/m_options.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b811e8a594..e34d8ea3dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -657,7 +657,6 @@ add_executable( zdoom WIN32 m_cheat.cpp m_joy.cpp m_misc.cpp - m_options.cpp m_png.cpp m_random.cpp md5.cpp diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 515a3015ee..f5bf1a8004 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -586,7 +586,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) damage += (pr_bfgspray() & 7) + 1; thingToHit = linetarget; - P_DamageMobj (thingToHit, self->target, self->target, damage, NAME_BFGSplash); + P_DamageMobj (thingToHit, self->target, self->target, damage, spray->DamageType); P_TraceBleed (damage, thingToHit, self->target); } } diff --git a/src/g_level.cpp b/src/g_level.cpp index 10ed1f83e9..1c125324ae 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -233,7 +233,7 @@ void G_DeferedInitNew (const char *mapname, int newskill) void G_DeferedInitNew (FGameStartup *gs) { - playerclass = gs->PlayerClass; + if (gs->PlayerClass != NULL) playerclass = gs->PlayerClass; d_mapname = AllEpisodes[gs->Episode].mEpisodeMap; d_skill = gs->Skill; CheckWarpTransMap (d_mapname, true); diff --git a/src/m_menu.h b/src/m_menu.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/m_options.cpp b/src/m_options.cpp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index cb557512fd..8141e870ea 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -104,12 +104,16 @@ DMenu::DMenu(DMenu *parent) bool DMenu::Responder (event_t *ev) { + bool res = false; if (ev->type == EV_GUI_Event) { if (ev->subtype == EV_GUI_LButtonDown) { - MouseEventBack(MOUSE_Click, ev->data1, ev->data2); - if (MouseEvent(MOUSE_Click, ev->data1, ev->data2)) + res = MouseEventBack(MOUSE_Click, ev->data1, ev->data2); + // make the menu's mouse handler believe that the current coordinate is outside the valid range + if (res) ev->data2 = -1; + res |= MouseEvent(MOUSE_Click, ev->data1, ev->data2); + if (res) { SetCapture(); } @@ -120,8 +124,9 @@ bool DMenu::Responder (event_t *ev) BackbuttonTime = BACKBUTTON_TIME; if (mMouseCapture || m_use_mouse == 1) { - MouseEventBack(MOUSE_Move, ev->data1, ev->data2); - return MouseEvent(MOUSE_Move, ev->data1, ev->data2); + res = MouseEventBack(MOUSE_Move, ev->data1, ev->data2); + if (res) ev->data2 = -1; + res |= MouseEvent(MOUSE_Move, ev->data1, ev->data2); } } else if (ev->subtype == EV_GUI_LButtonUp) @@ -129,8 +134,9 @@ bool DMenu::Responder (event_t *ev) if (mMouseCapture) { ReleaseCapture(); - MouseEventBack(MOUSE_Release, ev->data1, ev->data2); - return MouseEvent(MOUSE_Release, ev->data1, ev->data2); + res = MouseEventBack(MOUSE_Release, ev->data1, ev->data2); + if (res) ev->data2 = -1; + res |= MouseEvent(MOUSE_Release, ev->data1, ev->data2); } } } @@ -205,13 +211,14 @@ bool DMenu::MouseEventBack(int type, int x, int y) { if (m_show_backbutton&1) x -= screen->GetWidth() - tex->GetScaledWidth() * CleanXfac; if (m_show_backbutton&2) y -= screen->GetHeight() - tex->GetScaledHeight() * CleanYfac; - mBackbuttonSelected = (x >= 0 && x < tex->GetScaledWidth() * CleanXfac && y < tex->GetScaledHeight() * CleanYfac); + mBackbuttonSelected = ( x >= 0 && x < tex->GetScaledWidth() * CleanXfac && + y >= 0 && y < tex->GetScaledHeight() * CleanYfac); if (mBackbuttonSelected && type == MOUSE_Release) { if (m_use_mouse == 2) mBackbuttonSelected = false; MenuEvent(MKEY_Back, true); } - return true; + return mBackbuttonSelected; } } return false; @@ -343,6 +350,7 @@ void M_SetMenu(FName menu, int param) GameStartupInfo.Skill = -1; GameStartupInfo.Episode = -1; GameStartupInfo.PlayerClass = + param == -1000? NULL : param == -1? "Random" : PlayerClasses[param].Type->Meta.GetMetaString (APMETA_DisplayName); break; @@ -665,29 +673,30 @@ void M_Ticker (void) { DMenu::MenuTime++; if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off) + { DMenu::CurrentMenu->Ticker(); - for (int i = 0; i < NUM_MKEYS; ++i) - { - if (MenuButtons[i].bDown) + for (int i = 0; i < NUM_MKEYS; ++i) { - if (MenuButtonTickers[i] > 0 && --MenuButtonTickers[i] <= 0) + if (MenuButtons[i].bDown) { - MenuButtonTickers[i] = KEY_REPEAT_RATE; - DMenu::CurrentMenu->MenuEvent(i, MenuButtonOrigin[i]); + if (MenuButtonTickers[i] > 0 && --MenuButtonTickers[i] <= 0) + { + MenuButtonTickers[i] = KEY_REPEAT_RATE; + DMenu::CurrentMenu->MenuEvent(i, MenuButtonOrigin[i]); + } } } - } - - if (BackbuttonTime > 0) - { - if (BackbuttonAlpha < FRACUNIT) BackbuttonAlpha += FRACUNIT/10; - BackbuttonTime--; - } - else - { - if (BackbuttonAlpha > 0) BackbuttonAlpha -= FRACUNIT/10; - if (BackbuttonAlpha < 0) BackbuttonAlpha = 0; + if (BackbuttonTime > 0) + { + if (BackbuttonAlpha < FRACUNIT) BackbuttonAlpha += FRACUNIT/10; + BackbuttonTime--; + } + else + { + if (BackbuttonAlpha > 0) BackbuttonAlpha -= FRACUNIT/10; + if (BackbuttonAlpha < 0) BackbuttonAlpha = 0; + } } } diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 31fe0fd3b5..25fce4e7b7 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -749,13 +749,13 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc) sc.MustGetStringName(","); sc.MustGetFloat(); double step = sc.Float; - bool showvalue = true; + int showvalue = 1; if (sc.CheckString(",")) { sc.MustGetNumber(); - showvalue = !!sc.Number; + showvalue = sc.Number; } - FOptionMenuItem *it = new FOptionMenuSliderCVar(text, action, min, max, step, showvalue? 1:-1); + FOptionMenuItem *it = new FOptionMenuSliderCVar(text, action, min, max, step, showvalue); desc->mItems.Push(it); } else if (sc.Compare("screenresolution")) @@ -1006,7 +1006,15 @@ static void BuildPlayerclassMenu() // center the menu on the screen if the top space is larger than the bottom space int totalheight = posy + (numclassitems+1) * ld->mLinespacing - topy; - if (totalheight <= 190 || numclassitems == 1) + if (numclassitems <= 1) + { + // create a dummy item that auto-chooses the default class. + FListMenuItemText *it = new FListMenuItemText(0, 0, 0, 'p', "player", + ld->mFont,ld->mFontColor, NAME_Episodemenu, -1000); + ld->mAutoselect = ld->mItems.Push(it); + success = true; + } + else if (totalheight <= 190) { int newtop = (200 - totalheight + topy) / 2; int topdelta = newtop - topy; @@ -1051,10 +1059,6 @@ static void BuildPlayerclassMenu() ld->mItems.Push(it); } } - if (n < 2) - { - ld->mAutoselect = ld->mSelectedItem; - } success = true; } } @@ -1327,7 +1331,11 @@ void M_StartupSkillMenu(FGameStartup *gs) } if (AllEpisodes[gs->Episode].mNoSkill || AllSkills.Size() == 1) { - ld->mAutoselect = MIN(2u, AllEpisodes.Size()-1); + ld->mAutoselect = firstitem + MIN(2u, AllEpisodes.Size()-1); + } + else + { + ld->mAutoselect = -1; } success = true; } diff --git a/src/menu/optionmenu.cpp b/src/menu/optionmenu.cpp index 735b674ea6..5661eec8ec 100644 --- a/src/menu/optionmenu.cpp +++ b/src/menu/optionmenu.cpp @@ -66,47 +66,6 @@ void M_DrawConText (int color, int x, int y, const char *str) TAG_DONE); } -//============================================================================= -// -// Draw a slider. Set fracdigits negative to not display the current value numerically. -// -//============================================================================= - -void M_DrawSlider (int x, int y, double min, double max, double cur,int fracdigits) -{ - double range; - - range = max - min; - double ccur = clamp(cur, min, max) - min; - - if (CleanXfac > CleanXfac_1) - { - M_DrawConText(CR_WHITE, x, y, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12"); - M_DrawConText(CR_ORANGE, x + int((5 + ((ccur * 78) / range)) * CleanXfac_1), y, "\x13"); - - if (fracdigits >= 0) - { - char textbuf[16]; - mysnprintf(textbuf, countof(textbuf), "%.*f", fracdigits, cur); - screen->DrawText(SmallFont, CR_DARKGRAY, x + (12*8 + 4) * CleanXfac_1, y, textbuf, DTA_CleanNoMove_1, true, TAG_DONE); - } - } - else - { - // On 320x200 we need a shorter slider - M_DrawConText(CR_WHITE, x, y, "\x10\x11\x11\x11\x11\x11\x12"); - M_DrawConText(CR_ORANGE, x + int((5 + ((ccur * 38) / range)) * CleanXfac_1), y, "\x13"); - - if (fracdigits >= 0) - { - char textbuf[16]; - mysnprintf(textbuf, countof(textbuf), "%.*f", fracdigits, cur); - screen->DrawText(SmallFont, CR_DARKGRAY, x + (7*8 + 4) * CleanXfac_1, y, textbuf, DTA_CleanNoMove_1, true, TAG_DONE); - } - } -} - - IMPLEMENT_CLASS(DOptionMenu) diff --git a/src/menu/optionmenuitems.h b/src/menu/optionmenuitems.h index 07a72fb539..e365f60397 100644 --- a/src/menu/optionmenuitems.h +++ b/src/menu/optionmenuitems.h @@ -34,7 +34,6 @@ void M_DrawConText (int color, int x, int y, const char *str); -void M_DrawSlider (int x, int y, double min, double max, double cur,int fracdigits); void M_SetVideoMode(); @@ -551,6 +550,8 @@ class FOptionMenuSliderBase : public FOptionMenuItem double mMin, mMax, mStep; int mShowValue; int mDrawX; + int mSliderShort; + public: FOptionMenuSliderBase(const char *label, double min, double max, double step, int showval) : FOptionMenuItem(label, NAME_None) @@ -560,17 +561,63 @@ public: mStep = step; mShowValue = showval; mDrawX = 0; + mSliderShort = 0; } virtual double GetValue() = 0; virtual void SetValue(double val) = 0; + //============================================================================= + // + // Draw a slider. Set fracdigits negative to not display the current value numerically. + // + //============================================================================= + + void DrawSlider (int x, int y, double min, double max, double cur,int fracdigits, int indent) + { + char textbuf[16]; + double range; + int maxlen = 0; + int right = x + (12*8 + 4) * CleanXfac_1; + + range = max - min; + double ccur = clamp(cur, min, max) - min; + + if (fracdigits >= 0) + { + mysnprintf(textbuf, countof(textbuf), "%.*f", fracdigits, max); + maxlen = SmallFont->StringWidth(textbuf) * CleanXfac_1; + } + + mSliderShort = right + maxlen > screen->GetWidth(); + + if (!mSliderShort) + { + M_DrawConText(CR_WHITE, x, y, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12"); + M_DrawConText(CR_ORANGE, x + int((5 + ((ccur * 78) / range)) * CleanXfac_1), y, "\x13"); + } + else + { + // On 320x200 we need a shorter slider + M_DrawConText(CR_WHITE, x, y, "\x10\x11\x11\x11\x11\x11\x12"); + M_DrawConText(CR_ORANGE, x + int((5 + ((ccur * 38) / range)) * CleanXfac_1), y, "\x13"); + right -= 5*8*CleanXfac_1; + } + + if (fracdigits >= 0 && right + maxlen <= screen->GetWidth()) + { + mysnprintf(textbuf, countof(textbuf), "%.*f", fracdigits, cur); + screen->DrawText(SmallFont, CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true, TAG_DONE); + } + } + + //============================================================================= int Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected) { drawLabel(indent, y, selected? OptionSettings.mFontColorSelection : OptionSettings.mFontColor); mDrawX = indent + CURSORSPACE; - M_DrawSlider (mDrawX, y + OptionSettings.mLabelOffset, mMin, mMax, GetValue(), mShowValue); + DrawSlider (mDrawX, y + OptionSettings.mLabelOffset, mMin, mMax, GetValue(), mShowValue, indent); return indent; } @@ -609,7 +656,7 @@ public: } int slide_left = mDrawX+8*CleanXfac_1; - int slide_right = slide_left + 10*8*CleanXfac_1; // 12 char cells with 8 pixels each. + int slide_right = slide_left + (10*8*CleanXfac_1 >> mSliderShort); // 12 char cells with 8 pixels each. if (type == DMenu::MOUSE_Click) { diff --git a/src/menu/playerdisplay.cpp b/src/menu/playerdisplay.cpp index f9871e1ca6..a621562fd1 100644 --- a/src/menu/playerdisplay.cpp +++ b/src/menu/playerdisplay.cpp @@ -424,14 +424,18 @@ void FListMenuItemPlayerDisplay::SetPlayerClass(int classnum, bool force) bool FListMenuItemPlayerDisplay::UpdatePlayerClass() { - int classnum; - FName seltype = mOwner->mItems[mOwner->mSelectedItem]->GetAction(&classnum); + if (mOwner->mSelectedItem >= 0) + { + int classnum; + FName seltype = mOwner->mItems[mOwner->mSelectedItem]->GetAction(&classnum); - if (seltype != NAME_Episodemenu) return false; - if (PlayerClasses.Size() == 0) return false; + if (seltype != NAME_Episodemenu) return false; + if (PlayerClasses.Size() == 0) return false; - SetPlayerClass(classnum); - return true; + SetPlayerClass(classnum); + return true; + } + return false; } //============================================================================= diff --git a/src/menu/playermenu.cpp b/src/menu/playermenu.cpp index b25b86f1a6..6965d391bd 100644 --- a/src/menu/playermenu.cpp +++ b/src/menu/playermenu.cpp @@ -162,6 +162,7 @@ void FPlayerNameBox::Drawer(bool selected) { size_t l = strlen(mEditName); mEditName[l] = (gameinfo.gametype & (GAME_DoomStrifeChex)) ? '_' : '['; + mEditName[l+1] = 0; screen->DrawText (SmallFont, CR_UNTRANSLATED, x + mFrameSize, mYpos, mEditName, DTA_Clean, true, TAG_DONE); @@ -297,7 +298,7 @@ bool FValueTextItem::MenuEvent (int mkey, bool fromcontroller) return true; } } - return false; + return (mkey == MKEY_Enter); // needs to eat enter keys so that Activate won't get called } //============================================================================= @@ -898,11 +899,11 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li) if (li->GetValue(0, &sel)) { players[consoleplayer].userinfo.PlayerClass = sel-1; + PickPlayerClass(); cvar_set ("playerclass", sel == 0 ? "Random" : PlayerClass->Type->Meta.GetMetaString (APMETA_DisplayName)); - PickPlayerClass(); UpdateSkins(); UpdateColorsets(); UpdateTranslation(); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 5565929914..f7a52987bf 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2547,6 +2547,8 @@ enum APROP_Notrigger = 23, APROP_DamageFactor = 24, APROP_MasterTID = 25, + APROP_TargetTID = 26, + APROP_TracerTID = 27 }; // These are needed for ACS's APROP_RenderStyle @@ -2786,6 +2788,8 @@ int DLevelScript::GetActorProperty (int tid, int property) } case APROP_Score: return actor->Score; case APROP_MasterTID: return DoGetMasterTID (actor); + case APROP_TargetTID: return (actor->target != NULL)? actor->target->tid : 0; + case APROP_TracerTID: return (actor->tracer != NULL)? actor->tracer->tid : 0; default: return 0; } } @@ -2817,6 +2821,8 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value) case APROP_JumpZ: case APROP_Score: case APROP_MasterTID: + case APROP_TargetTID: + case APROP_TracerTID: return (GetActorProperty(tid, property) == value); // Boolean values need to compare to a binary version of value @@ -5040,7 +5046,7 @@ int DLevelScript::RunScript () } else if (activator) { - work += RUNTIME_TYPE(activator)->TypeName.GetChars(); + work += activator->GetTag(); } else { @@ -5834,15 +5840,22 @@ int DLevelScript::RunScript () case PCD_GETACTORY: case PCD_GETACTORZ: { - AActor *actor = SingleActorFromTID (STACK(1), activator); - - if (actor == NULL) + if(STACK(1) == 0) { - STACK(1) = 0; + STACK(1) = (&activator->x)[pcd - PCD_GETACTORX]; } else { - STACK(1) = (&actor->x)[pcd - PCD_GETACTORX]; + AActor *actor = SingleActorFromTID (STACK(1), activator); + + if (actor == NULL) + { + STACK(1) = 0; + } + else + { + STACK(1) = (&actor->x)[pcd - PCD_GETACTORX]; + } } } break; @@ -5850,50 +5863,77 @@ int DLevelScript::RunScript () case PCD_GETACTORFLOORZ: case PCD_GETACTORCEILINGZ: { - AActor *actor = SingleActorFromTID (STACK(1), activator); - - if (actor == NULL) + if(STACK(1) == 0) { - STACK(1) = 0; - } - else if (pcd == PCD_GETACTORFLOORZ) - { - STACK(1) = actor->floorz; + if (pcd == PCD_GETACTORFLOORZ) + { + STACK(1) = activator->floorz; + } + else if(STACK(1) == 0) + { + STACK(1) = activator->ceilingz; + } } else { - STACK(1) = actor->ceilingz; - } + AActor *actor = SingleActorFromTID (STACK(1), activator); + if (actor == NULL) + { + STACK(1) = 0; + } + else if (pcd == PCD_GETACTORFLOORZ) + { + STACK(1) = actor->floorz; + } + else + { + STACK(1) = actor->ceilingz; + } + } } break; case PCD_GETACTORANGLE: { - AActor *actor = SingleActorFromTID (STACK(1), activator); - - if (actor == NULL) + if(STACK(1) == 0) { - STACK(1) = 0; + STACK(1) = activator->angle >> 16; } else { - STACK(1) = actor->angle >> 16; + AActor *actor = SingleActorFromTID (STACK(1), activator); + + if (actor == NULL) + { + STACK(1) = 0; + } + else + { + STACK(1) = actor->angle >> 16; + } } } break; case PCD_GETACTORPITCH: { - AActor *actor = SingleActorFromTID (STACK(1), activator); - - if (actor == NULL) + if(STACK(1) == 0) { - STACK(1) = 0; + STACK(1) = activator->pitch >> 16; } else { - STACK(1) = actor->pitch >> 16; + AActor *actor = SingleActorFromTID (STACK(1), activator); + + if (actor == NULL) + { + STACK(1) = 0; + } + else + { + STACK(1) = actor->pitch >> 16; + } } } break; diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index 382f026b28..8a491f595a 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -851,6 +851,48 @@ static int FindGLNodesInFile(FileReader * f, const char * label) bool P_LoadGLNodes(MapData * map) { + + if (map->MapLumps[ML_GLZNODES].Size != 0) + { + const int idcheck = MAKE_ID('Z','G','L','N'); + const int idcheck2 = MAKE_ID('Z','G','L','2'); + const int idcheck3 = MAKE_ID('X','G','L','N'); + const int idcheck4 = MAKE_ID('X','G','L','2'); + int id; + + map->Seek(ML_GLZNODES); + map->file->Read (&id, 4); + if (id == idcheck || id == idcheck2 || id == idcheck3 || id == idcheck4) + { + try + { + subsectors = NULL; + segs = NULL; + nodes = NULL; + P_LoadZNodes (*map->file, id); + return true; + } + catch (CRecoverableError &) + { + if (subsectors != NULL) + { + delete[] subsectors; + subsectors = NULL; + } + if (segs != NULL) + { + delete[] segs; + segs = NULL; + } + if (nodes != NULL) + { + delete[] nodes; + nodes = NULL; + } + } + } + } + if (!CheckCachedNodes(map)) { wadlump_t gwalumps[4]; diff --git a/src/p_map.cpp b/src/p_map.cpp index f578ec7feb..424591be5c 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -844,16 +844,23 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm) if (tm.FromPMove) { - fixed_t newdist = P_AproxDistance(thing->x - tm.x, thing->y - tm.y); - fixed_t olddist = P_AproxDistance(thing->x - tm.thing->x, thing->y - tm.thing->y); - // Both actors already overlap. To prevent them from remaining stuck allow the move if it - // takes them further apart. - if (newdist > olddist) + // takes them further apart or the move does not change the position (when called from P_ChangeSector.) + if (tm.x == tm.thing->x && tm.y == tm.thing->y) { - // ... but not if they did not overlap in z-direction before but would after the move. - unblocking = !((tm.thing->x >= thing->x + thing->height && tm.x < thing->x + thing->height) || - (tm.thing->x + tm.thing->height <= thing->x && tm.x + tm.thing->height > thing->x)); + unblocking = true; + } + else + { + fixed_t newdist = P_AproxDistance(thing->x - tm.x, thing->y - tm.y); + fixed_t olddist = P_AproxDistance(thing->x - tm.thing->x, thing->y - tm.thing->y); + + if (newdist > olddist) + { + // ... but not if they did not overlap in z-direction before but would after the move. + unblocking = !((tm.thing->z >= thing->z + thing->height && tm.z < thing->z + thing->height) || + (tm.thing->z + tm.thing->height <= thing->z && tm.z + tm.thing->height > thing->z)); + } } } @@ -4512,6 +4519,11 @@ bool P_AdjustFloorCeil (AActor *thing, FChangePosition *cpos) int flags2 = thing->flags2 & MF2_PASSMOBJ; FCheckPosition tm; + if ((thing->flags2 & MF2_PASSMOBJ) && (thing->flags3 & MF3_ISMONSTER)) + { + tm.FromPMove = true; + } + if (cpos->movemidtex) { // From Eternity: diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 46d4bc813e..a2fa8ccd01 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -2005,36 +2005,10 @@ IMPLEMENT_CLASS (AAmbientSound) void AAmbientSound::Serialize (FArchive &arc) { Super::Serialize (arc); - arc << bActive; - - if (SaveVersion < 1902) + arc << bActive << NextCheck; + if (SaveVersion < 2798) { - arc << NextCheck; - NextCheck += gametic; - if (NextCheck < 0) NextCheck = INT_MAX; - } - else - { - if (arc.IsStoring()) - { - if (NextCheck != INT_MAX) - { - int checktime = NextCheck - gametic; - arc << checktime; - } - else - { - arc << NextCheck; - } - } - else - { - arc << NextCheck; - if (NextCheck != INT_MAX) - { - NextCheck += gametic; - } - } + NextCheck += level.maptime; } } @@ -2048,7 +2022,7 @@ void AAmbientSound::Tick () { Super::Tick (); - if (!bActive || gametic < NextCheck) + if (!bActive || level.maptime < NextCheck) return; FAmbientSound *ambient; @@ -2176,7 +2150,7 @@ void AAmbientSound::Activate (AActor *activator) amb->periodmin = Scale(S_GetMSLength(sndnum), TICRATE, 1000); } - NextCheck = gametic; + NextCheck = level.maptime; if (amb->type & (RANDOM|PERIODIC)) SetTicker (amb); diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 8d64241690..c8fbd23438 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -2618,15 +2618,27 @@ CCMD (idmus) CCMD (changemus) { - if (argv.argc() > 1) - { - if (PlayList) - { - delete PlayList; - PlayList = NULL; - } - S_ChangeMusic (argv[1], argv.argc() > 2 ? atoi (argv[2]) : 0); - } + if (argv.argc() > 1) + { + if (PlayList) + { + delete PlayList; + PlayList = NULL; + } + S_ChangeMusic (argv[1], argv.argc() > 2 ? atoi (argv[2]) : 0); + } + else + { + const char *currentmus = mus_playing.name.GetChars(); + if(currentmus != NULL && *currentmus != 0) + { + Printf ("currently playing %s\n", currentmus); + } + else + { + Printf ("no music playing\n"); + } + } } //========================================================================== diff --git a/src/sdl/i_input.cpp b/src/sdl/i_input.cpp index 3e94ff045b..0fe02cfd2d 100644 --- a/src/sdl/i_input.cpp +++ b/src/sdl/i_input.cpp @@ -256,7 +256,7 @@ static void I_CheckNativeMouse () == (SDL_APPINPUTFOCUS|SDL_APPACTIVE); bool fs = (SDL_GetVideoSurface ()->flags & SDL_FULLSCREEN) != 0; - bool wantNative = !focus || !use_mouse || (!fs && (GUICapture || paused || demoplayback || !inGame())); + bool wantNative = !focus || (!fs && (!use_mouse || GUICapture || paused || demoplayback || !inGame())); if (wantNative != NativeMouse) { diff --git a/src/v_video.cpp b/src/v_video.cpp index c51f13cfca..6beb89292d 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1485,6 +1485,12 @@ bool V_DoModeSetup (int width, int height, int bits) { CleanXfac_1 = MAX(CleanXfac - 1, 1); CleanYfac_1 = MAX(CleanYfac - 1, 1); + // On larger screens this is not enough so make sure it's at most 3/4 of the screen's width + while (CleanXfac_1 * 320 > screen->GetWidth()*3/4 && CleanXfac_1 > 2) + { + CleanXfac_1--; + CleanYfac_1--; + } } CleanWidth_1 = width / CleanXfac_1; CleanHeight_1 = height / CleanYfac_1; diff --git a/src/v_video.h b/src/v_video.h index 14782519cc..f4fb6f5bfe 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -412,7 +412,8 @@ public: virtual void WipeEndScreen(); virtual bool WipeDo(int ticks); virtual void WipeCleanup(); - virtual int GetPixelDoubling() const { return 1; } + virtual int GetPixelDoubling() const { return 0; } + virtual int GetTrueHeight() { return GetHeight(); } uint32 GetLastFPS() const { return LastCount; } diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index f302d807d0..678c03b778 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -158,6 +158,7 @@ LPDIRECTINPUT g_pdi3; BOOL AppActive = TRUE; int SessionState = 0; +int BlockMouseMove; CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) @@ -319,9 +320,15 @@ bool GUIWndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESU else if (message == WM_MOUSEMOVE) { ev.subtype = EV_GUI_MouseMove; + if (BlockMouseMove > 0) return true; + } + + { + int shift = screen? screen->GetPixelDoubling() : 0; + ev.data1 = LOWORD(lParam) >> shift; + ev.data2 = HIWORD(lParam) >> shift; + if (screen) ev.data2 -= (screen->GetTrueHeight() - screen->GetHeight())/2; } - ev.data1 = LOWORD(lParam) >> screen->GetPixelDoubling(); - ev.data2 = HIWORD(lParam) >> screen->GetPixelDoubling(); if (wParam & MK_SHIFT) ev.data3 |= GKM_SHIFT; if (wParam & MK_CONTROL) ev.data3 |= GKM_CTRL; @@ -802,6 +809,7 @@ void I_GetEvent () // void I_StartTic () { + BlockMouseMove--; ResetButtonTriggers (); I_CheckGUICapture (); I_CheckNativeMouse (false); diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index 0fa46c1db1..873b9271ae 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -114,6 +114,7 @@ extern HWND Window; extern LPDIRECTINPUT8 g_pdi; extern LPDIRECTINPUT g_pdi3; extern bool GUICapture; +extern int BlockMouseMove; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -283,6 +284,7 @@ void I_CheckNativeMouse(bool preferNative) NativeMouse = want_native; if (want_native) { + BlockMouseMove = 3; Mouse->Ungrab(); } else diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index e3710b2343..e6745b6cf4 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -162,6 +162,7 @@ public: void SetVSync (bool vsync); void NewRefreshRate(); HRESULT GetHR (); + virtual int GetTrueHeight() { return TrueHeight; } void Blank (); bool PaintToWindow (); @@ -265,6 +266,7 @@ public: bool WipeDo(int ticks); void WipeCleanup(); HRESULT GetHR (); + virtual int GetTrueHeight() { return TrueHeight; } private: friend class D3DTex; diff --git a/wadsrc/static/actors/doom/doomweapons.txt b/wadsrc/static/actors/doom/doomweapons.txt index b748f86115..4b03865246 100644 --- a/wadsrc/static/actors/doom/doomweapons.txt +++ b/wadsrc/static/actors/doom/doomweapons.txt @@ -587,6 +587,7 @@ ACTOR BFGExtra +NOGRAVITY RenderStyle Add Alpha 0.75 + DamageType "BFGSplash" States { Spawn: diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index ee624ed751..875525ec06 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -331,6 +331,8 @@ OptionMenu "OptionsMenu" Submenu "Gameplay Options", "GameplayOptions" Submenu "Compatibility Options", "CompatibilityOptions" Submenu "Automap Options", "AutomapOptions" + Submenu "HUD Options", "HUDOptions" + Submenu "Miscellaneous Options", "MiscOptions" Submenu "Sound Options", "SoundOptions" Submenu "Display Options", "VideoOptions" Submenu "Set video mode", "VideoModeMenu" @@ -615,6 +617,48 @@ OptionValue Contrast 2.0, "Smooth" } +OptionMenu "VideoOptions" +{ + Title "DISPLAY OPTIONS" + + Submenu "Message Options", "MessageOptions" + Submenu "Scoreboard Options", "ScoreboardOptions" + StaticText " " + Slider "Screen size", "screenblocks", 3.0, 12.0, 1.0, 0 + Slider "Brightness", "Gamma", 1.0, 3.0, 0.1 + Option "Vertical Sync", "vid_vsync", "OnOff" + Option "Column render mode", "r_columnmethod", "ColumnMethods" + + StaticText " " + Option "Screen wipe style", "wipetype", "Wipes" + + IfOption(Windows) + { + Option "Show ENDOOM screen", "showendoom", "Endoom" + //Option "DirectDraw palette hack", "vid_palettehack", "OnOff" + //Option "Use attached surfaces", "vid_attachedsurfaces", "OnOff" + } + + Option "Stretch short skies", "r_stretchsky", "OnOff" + Option "Use fuzz effect", "r_drawfuzz", "YesNo" + Slider "Lost Soul translucency", "transsouls", 0.25, 1.0, 0.05, 2 + Option "Use fake contrast", "r_fakecontrast", "Contrast" + Option "Rocket Trails", "cl_rockettrails", "RocketTrailTypes" + Option "Blood Type", "cl_bloodtype", "BloodTypes" + Option "Bullet Puff Type", "cl_pufftype", "PuffTypes" + Slider "Number of particles", "r_maxparticles", 100, 10000, 100, 0 + Option "Show player sprites", "r_drawplayersprites", "OnOff" + Option "Death camera", "r_deathcamera", "OnOff" + Option "Teleporter zoom", "telezoom", "OnOff" + Option "Interpolate monster movement", "nomonsterinterpolation", "NoYes" +} + +//------------------------------------------------------------------------------------------- +// +// HUD menu +// +//------------------------------------------------------------------------------------------- + OptionValue DisplayTagsTypes { 0.0, "None" @@ -654,40 +698,89 @@ OptionValue Crosshairs // will be filled in from the XHAIRS lump } -OptionMenu "VideoOptions" +OptionMenu "HUDOptions" { - Title "DISPLAY OPTIONS" - Submenu "Message Options", "MessageOptions" - Submenu "Scoreboard Options", "ScoreboardOptions" + Title "HUD Options" + Submenu "Alternative HUD", "AltHudOptions" StaticText " " - Slider "Screen size", "screenblocks", 3.0, 12.0, 1.0 - Slider "Brightness", "Gamma", 1.0, 3.0, 0.1 - Option "Vertical Sync", "vid_vsync", "OnOff" - Option "Column render mode", "r_columnmethod", "ColumnMethods" - + Option "Default Crosshair", "crosshair", "Crosshairs" + Option "Force default crosshair", "crosshairforce", "OnOff" + Option "Grow crosshair when picking up items", "crosshairgrow", "OnOff" + ColorPicker "Crosshair color", "crosshaircolor" + Option "Crosshair shows health", "crosshairhealth", "OnOff" + Option "Scale crosshair", "crosshairscale", "OnOff" StaticText " " - Option "Crosshair", "crosshair", "Crosshairs" Option "Display nametags", "displaynametags", "DisplayTagsTypes" Option "Nametag color", "nametagcolor", "TextColors", "displaynametags" Option "Stretch status bar", "st_scale", "OnOff" - Option "Alternative HUD", "hud_althud", "OnOff" - Option "Screen wipe style", "wipetype", "Wipes" +} + +//------------------------------------------------------------------------------------------- +// +// Alternative HUD +// +//------------------------------------------------------------------------------------------- +OptionValue "AMCoordinates" +{ + 0, "Player" + 1, "Map" +} + +OptionMenu "AltHUDOptions" +{ + Title "Alternative HUD" + //Indent 220 + Option "Enable alternative HUD", "hud_althud", "OnOff" + Option "Show secret count", "hud_showsecrets", "OnOff" + Option "Show monster count", "hud_showmonsters", "OnOff" + Option "Show item count", "hud_showitems", "OnOff" + Option "Show stamina and accuracy", "hud_showstats", "OnOff" + Slider "Red ammo display below %", "hud_ammo_red", 0, 100, 1, 0 + Slider "Yellow ammo display below %", "hud_ammo_yellow", 0, 100, 1, 0 + Slider "Red health display below", "hud_health_red", 0, 100, 1, 0 + Slider "Yellow health display below", "hud_health_yellow", 0, 100, 1, 0 + Slider "Green health display below", "hud_health_green", 0, 100, 1, 0 + Slider "Red armor display below", "hud_armor_red", 0, 100, 1, 0 + Slider "Yellow armor display below", "hud_armor_yellow", 0, 100, 1, 0 + Slider "Green armor display below", "hud_armor_green", 0, 100, 1, 0 + StaticText " " + StaticText "Alternative Automap HUD", 1 + option "Map title color", "hudcolor_titl", "TextColors" + option "Hub time color", "hudcolor_time", "TextColors" + option "Map time color", "hudcolor_ltim", "TextColors" + option "Total title color", "hudcolor_ttim", "TextColors" + option "Coordinate color", "hudcolor_xyco", "TextColors" + option "Coordinate mode", "map_point_coordinates", "AMCoordinates" + option "Map title color", "hudcolor_titl", "TextColors" + option "Statistics name color", "hudcolor_statnames", "TextColors" + option "Statistics color", "hudcolor_stats", "TextColors" +} + +//------------------------------------------------------------------------------------------- +// +// Misc menu +// +//------------------------------------------------------------------------------------------- + +OptionMenu "MiscOptions" +{ + Title "Miscellaneous Options" + //Indent 220 IfOption(Windows) { - Option "Show ENDOOM screen", "showendoom", "Endoom" - //Option "DirectDraw palette hack", "vid_palettehack", "OnOff" - //Option "Use attached surfaces", "vid_attachedsurfaces", "OnOff" + Option "Merge left+right Alt/Ctrl/Shift", "k_mergekeys", "OnOff" + Option "Alt-Enter toggles fullscreen", "k_allowfullscreentoggle", "OnOff" + Option "Show IWAD selection dialog", "queryiwad", "OnOff" + StaticText " " } - + Option "Enable cheats from all games", "allcheats", "OnOff" + Option "Enable autosaves", "disableautosave", "OffOn" + Slider "Number of autosaves", "autosavecount", 1, 32, 1, 0 StaticText " " - Option "Stretch short skies", "r_stretchsky", "OnOff" - Option "Use fuzz effect", "r_drawfuzz", "YesNo" - Option "Use fake contrast", "r_fakecontrast", "Contrast" - Option "Rocket Trails", "cl_rockettrails", "RocketTrailTypes" - Option "Blood Type", "cl_bloodtype", "BloodTypes" - Option "Bullet Puff Type", "cl_pufftype", "PuffTypes" - Option "Interpolate monster movement", "nomonsterinterpolation", "NoYes" + Option "Cache nodes", "gl_cachenodes", "OnOff" + Slider "Time threshold for node caching", "gl_cachetime", 0.0, 2.0, 0.1 + SafeCommand "Clear node cache", "clearnodecache" } //------------------------------------------------------------------------------------------- @@ -941,7 +1034,7 @@ OptionValue JumpCrouch OptionMenu GameplayOptions { Title "GAMEPLAY OPTIONS" - Indent 222 + //Indent 222 Option "Teamplay", "teamplay", "OnOff" Slider "Team damage scalar", "teamdamage", 0, 1, 0.05 StaticText " " @@ -1185,9 +1278,9 @@ OptionMenu SoundOptions Option "MIDI device", "snd_mididevice", "MidiDevices" StaticText " " Option "Underwater reverb", "snd_waterreverb", "OnOff" - Slider "Underwater cutoff", "snd_waterlp", 0, 2000, 50 + Slider "Underwater cutoff", "snd_waterlp", 0, 2000, 50, 0 Option "Randomize pitches", "snd_pitched", "OnOff" - Slider "Sound channels", "snd_channels", 8, 256, 8 + Slider "Sound channels", "snd_channels", 8, 256, 8, 0 StaticText " " Command "Restart sound", "snd_reset" StaticText " "