From 4b64df67785d2a07a9efc265a7fd6fe31268123d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 3 Jan 2010 10:04:56 +0000 Subject: [PATCH] - fixed: The player setup menu used the main menu's line spacing which for all non-Doom games was too wide. - fixed: Strife's dialogues cannot use the new options menu code to draw themselves so now they use a stripped down version of the old code. - Replaced I_MSTime with I_FPSTime in node builder timing because basetime will not be initialized yet if a map is started directly from the commandline. SVN r2096 (trunk) --- docs/rh-log.txt | 10 +++++++- src/m_menu.cpp | 1 + src/m_menu.h | 3 ++- src/m_options.cpp | 10 ++++---- src/p_conversation.cpp | 55 +++++++++++++++++++++++++++++++++++++++--- src/p_setup.cpp | 4 +-- 6 files changed, 71 insertions(+), 12 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 41565caf1..21d2534d0 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,12 @@ -January 2, 2010 (Changes by Graf Zahl) +January 3, 2010 (Changes by Graf Zahl) +- fixed: The player setup menu used the main menu's line spacing which + for all non-Doom games was too wide. +- fixed: Strife's dialogues cannot use the new options menu code to draw + themselves so now they use a stripped down version of the old code. +- Replaced I_MSTime with I_FPSTime in node builder timing because basetime + will not be initialized yet if a map is started directly from the commandline. + +January 2, 2010 (Changes by Graf Zahl) - fixed: Polyobjects could contain segs that weren't flagged as such. - fixed: Trying to show a popup crashed in the SBARINFO code because of a missing NULL pointer check. diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 3535cf484..1d1cc6601 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -2142,6 +2142,7 @@ static void M_DrawPlayerSlider (int x, int y, int cur) static void M_PlayerSetupDrawer () { + const int LINEHEIGHT = 16; int x, xo, yo; EColorRange label, value; DWORD color; diff --git a/src/m_menu.h b/src/m_menu.h index 997cf0e7d..f46b6a9e9 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -178,7 +178,7 @@ struct menu_t { int scrolltop; int scrollpos; int y; - void (*PreDraw)(void); + bool (*PreDraw)(void); bool DontDim; void (*EscapeHandler)(void); }; @@ -264,6 +264,7 @@ extern menustack_t MenuStack[16]; extern int MenuStackDepth; extern bool OptionsActive; +extern int skullAnimCounter; extern menu_t *CurrentMenu; extern int CurrentItem; diff --git a/src/m_options.cpp b/src/m_options.cpp index 83b2a038d..9815443f4 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -107,8 +107,6 @@ CVAR (Bool, show_obituaries, true, CVAR_ARCHIVE) EXTERN_CVAR (Bool, longsavemessages) EXTERN_CVAR (Bool, screenshot_quiet) -extern int skullAnimCounter; - EXTERN_CVAR (Bool, cl_run) EXTERN_CVAR (Int, crosshair) EXTERN_CVAR (Bool, freelook) @@ -1651,7 +1649,7 @@ void M_OptDrawer () if (CurrentMenu->PreDraw != NULL) { - CurrentMenu->PreDraw (); + if (CurrentMenu->PreDraw ()) return; } if (CurrentMenu->y != 0) @@ -3002,7 +3000,7 @@ static void DefaultCustomColors () } } -static void ColorPickerDrawer () +static bool ColorPickerDrawer () { DWORD newColor = MAKEARGB(255, int(ColorPickerItems[2].a.fval), @@ -3021,6 +3019,7 @@ static void ColorPickerDrawer () "Old", DTA_CleanNoMove_1, true, TAG_DONE); screen->DrawText (SmallFont, CR_WHITE, x+(48+24-SmallFont->StringWidth("New")/2)*CleanXfac_1, y, "New", DTA_CleanNoMove_1, true, TAG_DONE); + return false; } static void SetColorPickerSliders () @@ -3117,7 +3116,7 @@ CCMD (menu_mouse) MouseOptions (); } -static void DrawJoystickConfigMenuHeader() +static bool DrawJoystickConfigMenuHeader() { FString joyname = SELECTED_JOYSTICK->GetName(); screen->DrawText(BigFont, gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, @@ -3127,6 +3126,7 @@ static void DrawJoystickConfigMenuHeader() screen->DrawText(SmallFont, gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, (screen->GetWidth() - SmallFont->StringWidth(joyname) * CleanXfac_1) / 2, (8 + BigFont->GetHeight()) * CleanYfac_1, joyname, DTA_CleanNoMove_1, true, TAG_DONE); + return false; } static void UpdateJoystickConfigMenu(IJoystickConfig *joy) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 23147343b..53667881c 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -117,7 +117,7 @@ static void LoadScriptFile(FileReader *lump, int numnodes); static FStrifeDialogueNode *ReadRetailNode (FileReader *lump, DWORD &prevSpeakerType); static FStrifeDialogueNode *ReadTeaserNode (FileReader *lump, DWORD &prevSpeakerType); static void ParseReplies (FStrifeDialogueReply **replyptr, Response *responses); -static void DrawConversationMenu (); +static bool DrawConversationMenu (); static void PickConversationReply (); static void CleanupConversationMenu (); static void ConversationMenuEscaped (); @@ -804,6 +804,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang OptionsActive = true; menuactive = MENU_OnNoPause; ConversationPauseTic = gametic + 20; + M_SwitchMenu (&ConversationMenu); } } @@ -838,10 +839,13 @@ void P_ResumeConversation () // //============================================================================ -static void DrawConversationMenu () +static bool DrawConversationMenu () { const char *speakerName; int i, x, y, linesize; + int width, fontheight; + menuitem_t *item; + int labelofs; player_t *cp = &players[consoleplayer]; @@ -851,7 +855,7 @@ static void DrawConversationMenu () if (CurNode == NULL) { M_ClearMenus (); - return; + return true; } // [CW] Freeze the game depending on MAPINFO options. @@ -925,8 +929,53 @@ static void DrawConversationMenu () screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon), 2, 189, DTA_320x200, true, TAG_DONE); } + + y = CurrentMenu->y; + + if (gameinfo.gametype & GAME_Raven) + { + labelofs = 2; + y -= 2; + fontheight = 9; + } + else + { + labelofs = 0; + fontheight = 8; + } + for (i = 0; i < CurrentMenu->numitems; i++, y += fontheight) + { + item = CurrentMenu->items + i; + + width = SmallFont->StringWidth(item->label); + x = CurrentMenu->indent + 14; + + screen->DrawText (SmallFont, CR_GREEN, x, y, item->label, DTA_Clean, true, TAG_DONE); + + if (item->b.position != 0) + { + char tbuf[16]; + + mysnprintf (tbuf, countof(tbuf), "%d.", item->b.position); + x = CurrentMenu->indent - SmallFont->StringWidth (tbuf); + screen->DrawText (SmallFont, CR_GREY, x, y, tbuf, DTA_Clean, true, TAG_DONE); + } + + if (i == CurrentItem && + (skullAnimCounter < 6 || menuactive == MENU_WaitKey)) + { + int x = (CurrentMenu->indent + 3 - 160) * CleanXfac + screen->GetWidth() / 2; + int yy = (y-1+labelofs - 100) * CleanYfac + screen->GetHeight() / 2; + screen->DrawText (ConFont, CR_RED, x, yy, "\xd", + DTA_CellX, 8 * CleanXfac, + DTA_CellY, 8 * CleanYfac, + TAG_DONE); + } + } + return true; } + //============================================================================ // // PickConversationReply diff --git a/src/p_setup.cpp b/src/p_setup.cpp index ab467a77e..100f4bd10 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3574,7 +3574,7 @@ void P_SetupLevel (char *lumpname, int position) { unsigned int startTime, endTime; - startTime = I_MSTime (); + startTime = I_FPSTime (); TArray polyspots, anchors; P_GetPolySpots (map, polyspots, anchors); FNodeBuilder::FLevel leveldata = @@ -3591,7 +3591,7 @@ void P_SetupLevel (char *lumpname, int position) segs, numsegs, subsectors, numsubsectors, vertexes, numvertexes); - endTime = I_MSTime (); + endTime = I_FPSTime (); DPrintf ("BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs); }