From 9abaaa17857b51d25d3ad53ea23b582af06a6f39 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Sep 2010 07:46:34 +0000 Subject: [PATCH] - added a default cursor for Chex Quest. - set 'cursor' as default for Action Doom 2. Doom's bunny is probably not the best thing here... - made cursor user-settable in the menu. SVN r2855 (trunk) --- src/d_main.cpp | 22 ++++++++++++--- src/win32/i_system.cpp | 39 +++++++++++++++------------ wadsrc/static/graphics/chexcurs.png | Bin 0 -> 358 bytes wadsrc/static/mapinfo/chex.txt | 1 + wadsrc/static/mapinfo/urbanbrawl.txt | 1 + wadsrc/static/menudef.txt | 13 +++++++++ 6 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 wadsrc/static/graphics/chexcurs.png diff --git a/src/d_main.cpp b/src/d_main.cpp index e86db958f..fc282fa5f 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -184,6 +184,23 @@ CUSTOM_CVAR (Int, fraglimit, 0, CVAR_SERVERINFO) CVAR (Float, timelimit, 0.f, CVAR_SERVERINFO); CVAR (Int, wipetype, 1, CVAR_ARCHIVE); CVAR (Int, snd_drawoutput, 0, 0); +CUSTOM_CVAR (String, vid_cursor, "None", CVAR_ARCHIVE | CVAR_NOINITCALL) +{ + bool res = false; + + if (!stricmp(self, "None" ) && gameinfo.CursorPic.IsNotEmpty()) + { + res = I_SetCursor(TexMan[gameinfo.CursorPic]); + } + else + { + res = I_SetCursor(TexMan[self]); + } + if (!res) + { + I_SetCursor(TexMan["cursor"]); + } +} bool DrawFSHUD; // [RH] Draw fullscreen HUD? TArray allwads; @@ -901,10 +918,7 @@ void D_DoomLoop () // Clamp the timer to TICRATE until the playloop has been entered. r_NoInterpolate = true; - if (gameinfo.CursorPic.IsEmpty() || !I_SetCursor(TexMan[gameinfo.CursorPic])) - { - I_SetCursor(TexMan["cursor"]); - } + vid_cursor.Callback(); for (;;) { diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index d0362b13f..095ef1ee5 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1186,28 +1186,33 @@ bool I_SetCursor(FTexture *cursorpic) { HCURSOR cursor; - // Must be no larger than 32x32. - if (cursorpic->GetWidth() > 32 || cursorpic->GetHeight() > 32) + if (cursorpic != NULL && cursorpic->UseType != FTexture::TEX_Null) { - return false; - } + // Must be no larger than 32x32. + if (cursorpic->GetWidth() > 32 || cursorpic->GetHeight() > 32) + { + return false; + } - cursor = CreateAlphaCursor(cursorpic); - if (cursor == NULL) - { - cursor = CreateCompatibleCursor(cursorpic); + cursor = CreateAlphaCursor(cursorpic); + if (cursor == NULL) + { + cursor = CreateCompatibleCursor(cursorpic); + } + if (cursor == NULL) + { + return false; + } + // Replace the existing cursor with the new one. + DestroyCustomCursor(); + CustomCursor = cursor; + atterm(DestroyCustomCursor); } - if (cursor == NULL) + else { - return false; + DestroyCustomCursor(); + cursor = LoadCursor(NULL, IDC_ARROW); } - // Replace the existing cursor with the new one. - if (CustomCursor != NULL) - { - DestroyCursor(CustomCursor); - } - CustomCursor = cursor; - atterm(DestroyCustomCursor); SetClassLongPtr(Window, GCLP_HCURSOR, (LONG_PTR)cursor); return true; } diff --git a/wadsrc/static/graphics/chexcurs.png b/wadsrc/static/graphics/chexcurs.png new file mode 100644 index 0000000000000000000000000000000000000000..658c71f7c2fac276894e886db4cd9ad653982a49 GIT binary patch literal 358 zcmeAS@N?(olHy`uVBq!ia0y~yV2}i17G?$p2D9Tc0vH$=R04cLTp9lV54M-@k2lYD zSD&41{rYxzyEFUjXyNtM^2OQ=hiB_w-|c*F@sw)}3=E7VL4Lsu4$p3+F)%Q2q!&3R zF)%RjFfcGMxcfAuGcYjR@pN$vskr4kVPoDQ2LYG$p3VOiY8dOCrI-2}*f%`M4ifw@ zRpFtvly~QWd$|*oil5J&e>$<}Y{}x~k!RNgnKNdETzYl-#f4phYCGgA8ww81mzc1$ z_?L&0#iA(}lrQje&gMImwUT>5#-d8jX(_)??aNTAIX-QZfoMpj&$cK(c7@b6Ut_j< zM;?E2=)vK$SEaoRdbmCu@AmTJ?lA8ye^Buy>+9ODH_JjN%PuzKsD63s&%qPlz3NU^ zo7OjMm;9>yr%ijiru^hj4v}^}(<9yDn`fW-_T|eKEB*O*miYf=UT9G&e(y@d7Lb2E MUHx3vIVCg!0L?m;y#N3J literal 0 HcmV?d00001 diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 2f2d77bf7..f75838b7f 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -55,6 +55,7 @@ gameinfo playerclasses = "ChexPlayer" pausesign = "M_PAUSE" gibfactor = 1 + cursorpic = "chexcurs" } skill baby diff --git a/wadsrc/static/mapinfo/urbanbrawl.txt b/wadsrc/static/mapinfo/urbanbrawl.txt index 094975bf5..c21e8b675 100644 --- a/wadsrc/static/mapinfo/urbanbrawl.txt +++ b/wadsrc/static/mapinfo/urbanbrawl.txt @@ -3,5 +3,6 @@ include "mapinfo/doom2.txt" gameinfo { swapmenu = true + cursorpic = "cursor" } diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index c3f9ef144..5c6873d14 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -510,6 +510,18 @@ OptionValue "MenuMouse" 2, "Touchscreen-like" } +OptionString "Cursors" +{ + "None", "Default" + "cursor", "Simple arrow" + "doomcurs", "Doom" + "herecurs", "Heretic" + "hexncurs", "Hexen" + "strfcurs", "Strife" + "chexcurs", "Chex" + "-", "System cursor" +} + OptionMenu "MouseOptions" { Title "MOUSE OPTIONS" @@ -518,6 +530,7 @@ OptionMenu "MouseOptions" { Option "Enable mouse in menus", "m_use_mouse", "MenuMouse", "use_mouse" Option "Show back button", "m_show_backbutton", "Corners", "use_mouse" + Option "Cursor", "vid_cursor", "Cursors" } StaticText "" Slider "Overall sensitivity", "mouse_sensitivity", 0.5, 2.5, 0.1