id24: SBARDEF (#1916)
* implement SBARDEF parsing * add default sbardef.lmp to base * add support for Boom colors * implement widescreen mode, F5 switches to fullscreen HUD * update dig* font * load defaults from sbhuddef.lmp * remove hu_stuff.* and hu_lib.* * add support for translucency, introduce -dumptranmap * apply Fabian Greffrath's patch, fixes * build woof.pk3 only if the base files have been modified * remove key blinking
@ -40,6 +40,7 @@ set(PROJECT_COPYRIGHT "Copyright (C) 1993-2024")
|
||||
set(PROJECT_LICENSE "GNU General Public License, version 2")
|
||||
set(PROJECT_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
|
||||
set(PROJECT_SHORTNAME "woof")
|
||||
set(BASE_PK3 "woof.pk3")
|
||||
set(WOOF_ICON "woof.ico")
|
||||
set(SETUP_ICON "setup.ico")
|
||||
set(PROJECT_VERSION_RC "${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},0") # ${PROJECT_VERSION_TWEAK}
|
||||
@ -194,7 +195,10 @@ set(CPACK_SOURCE_IGNORE_FILES "/.git/;/build;/.vs/;/out/;CMakeSettings.json")
|
||||
set(CPACK_STRIP_FILES TRUE)
|
||||
include(CPack)
|
||||
|
||||
set(BASE_PK3_PATH "${CMAKE_BINARY_DIR}/src/${BASE_PK3}")
|
||||
|
||||
# Where to find other CMakeLists.txt files.
|
||||
add_subdirectory(base)
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(opl)
|
||||
add_subdirectory(textscreen)
|
||||
|
@ -58,7 +58,6 @@ If you turn the [Doom logo upside down](https://www.reddit.com/r/Doom/comments/8
|
||||
* UMAPINFO support, compliant to Rev 2.2 of the [spec](https://github.com/kraflab/umapinfo).
|
||||
* MBF21 compatibility level, compliant to Rev 1.4 of the [spec](https://github.com/kraflab/mbf21).
|
||||
* SMMU-style swirling animated flats.
|
||||
* Customization of the extended Boom HUD using the [WOOFHUD](https://github.com/fabiangreffrath/woof/blob/master/docs/woofhud.md) lump.
|
||||
|
||||
## Usage
|
||||
|
||||
@ -204,6 +203,11 @@ Copyright:
|
||||
© TobiasKosmos.
|
||||
License: [CC-BY-3.0](https://creativecommons.org/licenses/by/3.0/) and [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
|
||||
Files: `base/all-all/sbardef.lmp`
|
||||
Copyright:
|
||||
© 2024 Ethan Watson.
|
||||
License: [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
|
||||
Files: `cmake/FindSDL2.cmake, cmake/FindSDL2_net.cmake`
|
||||
Copyright: © 2018 Alex Mayfield.
|
||||
License: [BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)
|
||||
|
217
base/CMakeLists.txt
Normal file
@ -0,0 +1,217 @@
|
||||
set(BASE_SOURCES
|
||||
all-all/animated.lmp
|
||||
all-all/crblack.lmp
|
||||
all-all/crblue.lmp
|
||||
all-all/crblue2.lmp
|
||||
all-all/crbrick.lmp
|
||||
all-all/crbrown.lmp
|
||||
all-all/crgold.lmp
|
||||
all-all/crgray.lmp
|
||||
all-all/crgreen.lmp
|
||||
all-all/crorange.lmp
|
||||
all-all/cross00.png
|
||||
all-all/cross01.png
|
||||
all-all/cross02.png
|
||||
all-all/cross03.png
|
||||
all-all/cross04.png
|
||||
all-all/cross05.png
|
||||
all-all/cross06.png
|
||||
all-all/cross07.png
|
||||
all-all/cross08.png
|
||||
all-all/crpurple.lmp
|
||||
all-all/crred.lmp
|
||||
all-all/crtan.lmp
|
||||
all-all/crwhite.lmp
|
||||
all-all/cryellow.lmp
|
||||
all-all/dig033.png
|
||||
all-all/dig037.png
|
||||
all-all/dig043.png
|
||||
all-all/dig045.png
|
||||
all-all/dig046.png
|
||||
all-all/dig047.png
|
||||
all-all/dig048.png
|
||||
all-all/dig049.png
|
||||
all-all/dig050.png
|
||||
all-all/dig051.png
|
||||
all-all/dig052.png
|
||||
all-all/dig053.png
|
||||
all-all/dig054.png
|
||||
all-all/dig055.png
|
||||
all-all/dig056.png
|
||||
all-all/dig057.png
|
||||
all-all/dig058.png
|
||||
all-all/dig065.png
|
||||
all-all/dig066.png
|
||||
all-all/dig067.png
|
||||
all-all/dig068.png
|
||||
all-all/dig069.png
|
||||
all-all/dig070.png
|
||||
all-all/dig071.png
|
||||
all-all/dig072.png
|
||||
all-all/dig073.png
|
||||
all-all/dig074.png
|
||||
all-all/dig075.png
|
||||
all-all/dig076.png
|
||||
all-all/dig077.png
|
||||
all-all/dig078.png
|
||||
all-all/dig079.png
|
||||
all-all/dig080.png
|
||||
all-all/dig081.png
|
||||
all-all/dig082.png
|
||||
all-all/dig083.png
|
||||
all-all/dig084.png
|
||||
all-all/dig085.png
|
||||
all-all/dig086.png
|
||||
all-all/dig087.png
|
||||
all-all/dig088.png
|
||||
all-all/dig089.png
|
||||
all-all/dig090.png
|
||||
all-all/dig091.png
|
||||
all-all/dig093.png
|
||||
all-all/dsdgact.wav
|
||||
all-all/dsdgatk.wav
|
||||
all-all/dsdgdth.wav
|
||||
all-all/dsdgpain.wav
|
||||
all-all/dsdgsit.wav
|
||||
all-all/m_butt1.png
|
||||
all-all/m_butt2.png
|
||||
all-all/m_vbox.png
|
||||
all-all/sbardef.lmp
|
||||
all-all/sbhuddef.lmp
|
||||
all-all/skytran.lmp
|
||||
all-all/stbr123.png
|
||||
all-all/stbr124.png
|
||||
all-all/stbr125.png
|
||||
all-all/stbr126.png
|
||||
all-all/stbr127.png
|
||||
all-all/stkeys6.png
|
||||
all-all/stkeys7.png
|
||||
all-all/stkeys8.png
|
||||
all-all/switches.lmp
|
||||
|
||||
all-all/colormaps/watermap.cmp
|
||||
|
||||
all-all/sprites/dogsa1.png
|
||||
all-all/sprites/dogsa2.png
|
||||
all-all/sprites/dogsa3.png
|
||||
all-all/sprites/dogsa4.png
|
||||
all-all/sprites/dogsa5.png
|
||||
all-all/sprites/dogsa6.png
|
||||
all-all/sprites/dogsa7.png
|
||||
all-all/sprites/dogsa8.png
|
||||
all-all/sprites/dogsb1.png
|
||||
all-all/sprites/dogsb2.png
|
||||
all-all/sprites/dogsb3.png
|
||||
all-all/sprites/dogsb4.png
|
||||
all-all/sprites/dogsb5.png
|
||||
all-all/sprites/dogsb6.png
|
||||
all-all/sprites/dogsb7.png
|
||||
all-all/sprites/dogsb8.png
|
||||
all-all/sprites/dogsc1.png
|
||||
all-all/sprites/dogsc2.png
|
||||
all-all/sprites/dogsc3.png
|
||||
all-all/sprites/dogsc4.png
|
||||
all-all/sprites/dogsc5.png
|
||||
all-all/sprites/dogsc6.png
|
||||
all-all/sprites/dogsc7.png
|
||||
all-all/sprites/dogsc8.png
|
||||
all-all/sprites/dogsd1.png
|
||||
all-all/sprites/dogsd2.png
|
||||
all-all/sprites/dogsd3.png
|
||||
all-all/sprites/dogsd4.png
|
||||
all-all/sprites/dogsd5.png
|
||||
all-all/sprites/dogsd6.png
|
||||
all-all/sprites/dogsd7.png
|
||||
all-all/sprites/dogsd8.png
|
||||
all-all/sprites/dogse1.png
|
||||
all-all/sprites/dogse2.png
|
||||
all-all/sprites/dogse3.png
|
||||
all-all/sprites/dogse4.png
|
||||
all-all/sprites/dogse5.png
|
||||
all-all/sprites/dogse6.png
|
||||
all-all/sprites/dogse7.png
|
||||
all-all/sprites/dogse8.png
|
||||
all-all/sprites/dogsf1.png
|
||||
all-all/sprites/dogsf2.png
|
||||
all-all/sprites/dogsf3.png
|
||||
all-all/sprites/dogsf4.png
|
||||
all-all/sprites/dogsf5.png
|
||||
all-all/sprites/dogsf6.png
|
||||
all-all/sprites/dogsf7.png
|
||||
all-all/sprites/dogsf8.png
|
||||
all-all/sprites/dogsg1.png
|
||||
all-all/sprites/dogsg2.png
|
||||
all-all/sprites/dogsg3.png
|
||||
all-all/sprites/dogsg4.png
|
||||
all-all/sprites/dogsg5.png
|
||||
all-all/sprites/dogsg6.png
|
||||
all-all/sprites/dogsg7.png
|
||||
all-all/sprites/dogsg8.png
|
||||
all-all/sprites/dogsh1.png
|
||||
all-all/sprites/dogsh2.png
|
||||
all-all/sprites/dogsh3.png
|
||||
all-all/sprites/dogsh4.png
|
||||
all-all/sprites/dogsh5.png
|
||||
all-all/sprites/dogsh6.png
|
||||
all-all/sprites/dogsh7.png
|
||||
all-all/sprites/dogsh8.png
|
||||
all-all/sprites/dogsi0.png
|
||||
all-all/sprites/dogsj0.png
|
||||
all-all/sprites/dogsk0.png
|
||||
all-all/sprites/dogsl0.png
|
||||
all-all/sprites/dogsm0.png
|
||||
all-all/sprites/dogsn0.png
|
||||
all-all/sprites/pls1a0.png
|
||||
all-all/sprites/pls1b0.png
|
||||
all-all/sprites/pls1c0.png
|
||||
all-all/sprites/pls1d0.png
|
||||
all-all/sprites/pls1e0.png
|
||||
all-all/sprites/pls1f0.png
|
||||
all-all/sprites/pls1g0.png
|
||||
all-all/sprites/pls2a0.png
|
||||
all-all/sprites/pls2b0.png
|
||||
all-all/sprites/pls2c0.png
|
||||
all-all/sprites/pls2d0.png
|
||||
all-all/sprites/pls2e0.png
|
||||
all-all/sprites/tnt1a0.png
|
||||
|
||||
betalevl.wad/umapdef.lmp
|
||||
|
||||
chex.wad/brghtmps.lmp
|
||||
chex.wad/dehacked.lmp
|
||||
chex.wad/umapdef.lmp
|
||||
|
||||
chex2.wad/brghtmps.lmp
|
||||
|
||||
doom-all/brghtmps.lmp
|
||||
|
||||
e1m4b.wad/umapdef.lmp
|
||||
e1m8b.wad/umapdef.lmp
|
||||
|
||||
hacx.wad/brghtmps.lmp
|
||||
hacx.wad/dehacked.deh
|
||||
|
||||
masterlevels.wad/umapdef.lmp
|
||||
|
||||
nerve.wad/umapdef.lmp
|
||||
|
||||
rekkr.wad/dehacked.lmp
|
||||
rekkrsa.wad/dehacked.lmp
|
||||
rekkrsl.wad/dehacked.lmp
|
||||
|
||||
sigil_v1_21.wad/umapdef.lmp
|
||||
|
||||
tnt.wad/brghtmps.lmp)
|
||||
|
||||
add_custom_command(OUTPUT "${BASE_PK3_PATH}"
|
||||
COMMAND ${CMAKE_COMMAND} -E tar cf "${BASE_PK3_PATH}" --format=zip ${BASE_SOURCES}
|
||||
DEPENDS ${BASE_SOURCES}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
add_custom_target(woof-base DEPENDS "${BASE_PK3_PATH}")
|
||||
|
||||
if(WIN32)
|
||||
install(FILES "${BASE_PK3_PATH}" DESTINATION .)
|
||||
else()
|
||||
install(FILES "${BASE_PK3_PATH}" DESTINATION "share/${PROJECT_SHORTNAME}")
|
||||
endif()
|
BIN
base/all-all/dig033.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
2002
base/all-all/sbardef.lmp
Normal file
257
base/all-all/sbhuddef.lmp
Normal file
@ -0,0 +1,257 @@
|
||||
{
|
||||
"type": "hud",
|
||||
"version": "1.0.0",
|
||||
"data":
|
||||
{
|
||||
"hudfonts":
|
||||
[
|
||||
{
|
||||
"name": "Console",
|
||||
"type": 2,
|
||||
"stem": "STCFN"
|
||||
},
|
||||
{
|
||||
"name": "Digits",
|
||||
"type": 0,
|
||||
"stem": "DIG"
|
||||
}
|
||||
],
|
||||
"widgets":
|
||||
[
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 2,
|
||||
"y": 160,
|
||||
"alignment": 16,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 0,
|
||||
"font": "Digits",
|
||||
"conditions":
|
||||
[
|
||||
{
|
||||
"condition": 19,
|
||||
"param": 6
|
||||
}
|
||||
],
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 2,
|
||||
"y": 153,
|
||||
"alignment": 16,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 1,
|
||||
"font": "Digits",
|
||||
"conditions":
|
||||
[
|
||||
{
|
||||
"condition": 19,
|
||||
"param": 6
|
||||
}
|
||||
],
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 2,
|
||||
"y": 152,
|
||||
"alignment": 16,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 0,
|
||||
"font": "Digits",
|
||||
"conditions":
|
||||
[
|
||||
{
|
||||
"condition": 19,
|
||||
"param": 1
|
||||
}
|
||||
],
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 2,
|
||||
"y": 146,
|
||||
"alignment": 16,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 1,
|
||||
"font": "Digits",
|
||||
"conditions":
|
||||
[
|
||||
{
|
||||
"condition": 19,
|
||||
"param": 1
|
||||
}
|
||||
],
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 320,
|
||||
"y": 8,
|
||||
"alignment": 34,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 2,
|
||||
"font": "Digits",
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 320,
|
||||
"y": 0,
|
||||
"alignment": 34,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 3,
|
||||
"font": "Digits",
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"alignment": 0,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 4,
|
||||
"font": "Digits",
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 320,
|
||||
"y": 167,
|
||||
"alignment": 42,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 5,
|
||||
"font": "Digits",
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 160,
|
||||
"y": 167,
|
||||
"alignment": 9,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 6,
|
||||
"font": "Digits",
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"alignment": 16,
|
||||
"tranmap": null,
|
||||
"translation": null,
|
||||
"type": 7,
|
||||
"font": "Console",
|
||||
"duration": 4,
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 160,
|
||||
"y": 52,
|
||||
"alignment": 1,
|
||||
"tranmap": null,
|
||||
"translation": "CRGOLD",
|
||||
"type": 8,
|
||||
"font": "Console",
|
||||
"duration": 2.5,
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"alignment": 16,
|
||||
"tranmap": null,
|
||||
"translation": "CRGOLD",
|
||||
"type": 9,
|
||||
"font": "Console",
|
||||
"conditions": null,
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 0,
|
||||
"y": 160,
|
||||
"alignment": 16,
|
||||
"tranmap": null,
|
||||
"translation": "CRGOLD",
|
||||
"type": 10,
|
||||
"font": "Console",
|
||||
"conditions":
|
||||
[
|
||||
{
|
||||
"condition": 19,
|
||||
"param": 1
|
||||
}
|
||||
],
|
||||
"children": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget":
|
||||
{
|
||||
"x": 160,
|
||||
"y": 160,
|
||||
"alignment": 1,
|
||||
"tranmap": null,
|
||||
"translation": "CRGOLD",
|
||||
"type": 10,
|
||||
"font": "Console",
|
||||
"conditions":
|
||||
[
|
||||
{
|
||||
"condition": 19,
|
||||
"param": 2
|
||||
}
|
||||
],
|
||||
"children": null
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
hud 0
|
||||
rate topleft
|
||||
compact bottomleft
|
||||
monsec topleft
|
||||
sttime topleft
|
||||
coord topright
|
||||
fps topright
|
||||
cmd bottomright
|
||||
speed bottomcenter
|
||||
|
||||
hud 1
|
||||
rate topleft
|
||||
armor bottomleft
|
||||
health bottomleft
|
||||
ammo bottomleft
|
||||
weapon bottomleft
|
||||
keys bottomleft
|
||||
monsec bottomleft
|
||||
sttime bottomleft
|
||||
coord topright
|
||||
fps topright
|
||||
cmd bottomright
|
||||
speed bottomcenter
|
||||
|
||||
hud 2
|
||||
rate topleft
|
||||
health topright
|
||||
armor topright
|
||||
ammo bottomright
|
||||
weapon bottomright
|
||||
keys bottomleft
|
||||
monsec bottomleft
|
||||
sttime bottomleft
|
||||
coord topright
|
||||
fps topright
|
||||
cmd bottomright
|
||||
speed bottomcenter
|
@ -5,9 +5,7 @@ set(WOOF_DOCS
|
||||
mbf.txt
|
||||
mbfedit.txt
|
||||
mbffaq.txt
|
||||
options.txt
|
||||
woofhud.lmp
|
||||
woofhud.md)
|
||||
options.txt)
|
||||
|
||||
if(WIN32)
|
||||
install(FILES ${WOOF_DOCS} DESTINATION docs)
|
||||
|
@ -1,33 +0,0 @@
|
||||
// Copy this to autoload/doom-all for alternative HUD arrangements.
|
||||
// Thanks @liPillON <https://github.com/fabiangreffrath/woof/issues/593>.
|
||||
|
||||
hud 0
|
||||
title topleft
|
||||
coords topright
|
||||
fps topright
|
||||
stats bottomright
|
||||
time bottomright
|
||||
|
||||
hud 1
|
||||
title topleft
|
||||
coords topright
|
||||
fps topright
|
||||
armor bottomleft
|
||||
health bottomleft
|
||||
ammo bottomleft
|
||||
weapons bottomleft
|
||||
keys bottomleft
|
||||
stats bottomright
|
||||
time bottomright
|
||||
|
||||
hud 2
|
||||
title topleft
|
||||
stats topright
|
||||
time topright
|
||||
coords topright
|
||||
fps topright
|
||||
keys bottomleft
|
||||
health bottomleft
|
||||
armor bottomleft
|
||||
weapons bottomright
|
||||
ammo bottomright
|
121
docs/woofhud.md
@ -1,121 +0,0 @@
|
||||
# WOOFHUD
|
||||
|
||||
Woof! supports the WOOFHUD lump to customize the appearance of the extended Boom HUD.
|
||||
|
||||
## Description
|
||||
|
||||
The Boom HUD shows information about the player's health, armor, weapons, ammo and keys using different widgets, i.e. lines of text and symbols. It is usually made visible by hitting the <kbd>F5</kbd> key, and repeatedly hitting the <kbd>F5</kbd> key toggles through three different modes: the "minimal" mode which shows only the most basic information, the "compact" mode which shows all information in the lower left corner of the screen and the "distributed" mode which shows information spread across the corners of the screen.
|
||||
|
||||
The WOOFHUD lump can be used to modify the positions of these widgets for each mode.
|
||||
This lump may either get embedded into a PWAD, or provided by the user on the command line or through the autoload feature.
|
||||
|
||||
## Format
|
||||
|
||||
The WOOFHUD lump is in text format and consists of paragraphs, which are separated by blank lines. Each paragraph begins with a line starting with the keyword `hud` and a number for the HUD mode which is to be modified: `0` for minimal, `1` for compact and `2` for distributed.
|
||||
The following lines start with the name of the HUD widget which is to be positioned followed by either a keyword giving the position relative to the screen or two numbers giving the absolute X and Y screen coordinates.
|
||||
|
||||
Possible values for the HUD widget names:
|
||||
|
||||
* "title" or "levelname"
|
||||
* "message"
|
||||
* "secret"
|
||||
* "armor"
|
||||
* "health"
|
||||
* "ammo"
|
||||
* "weapon" or "weapons"
|
||||
* "keys"
|
||||
* "monsec" or "stats"
|
||||
* "sttime" or "time"
|
||||
* "coord" or "coords"
|
||||
* "fps" or "rate"
|
||||
* "cmd" or "commands"
|
||||
* "compact"
|
||||
* "speed"
|
||||
|
||||
Possible values for the widget position keywords:
|
||||
|
||||
* "topleft" or "upperleft"
|
||||
* "topright" or "upperright"
|
||||
* "topcenter" or "uppercenter"
|
||||
* "bottomleft" or "lowerleft"
|
||||
* "bottomright" or "lowerright"
|
||||
* "bottomcenter" or "lowercenter"
|
||||
|
||||
When using relative screen positioning, the widgets are aligned "first come, first serve". For example, the first widget in a paragraph that is aligned with the "bottomleft" keyword will end up in the very bottom-left area of the screen and each following widget that is aligned with the same keyword will get stacked one line above.
|
||||
|
||||
Absolute X and Y screen coordinates are limited to the low-resolution non-widescreen visible area of the screen, i.e. `0 <= X < 320` and `0 <= Y < 200`. Negative values will get interpreted relative to the right or lower edges of the screen, respectively. If the "Widescreen Widget Arrangement" feature is enabled, widgets will get aligned with respect to the widescreen area of the screen (new in Woof! 14.0.0).
|
||||
|
||||
## Examples
|
||||
|
||||
The following example represents the current default alignments of the Boom HUD widgets:
|
||||
|
||||
```
|
||||
hud 0
|
||||
rate topleft
|
||||
compact bottomleft
|
||||
monsec topleft
|
||||
sttime topleft
|
||||
coord topright
|
||||
fps topright
|
||||
cmd bottomright
|
||||
speed bottomcenter
|
||||
|
||||
hud 1
|
||||
rate topleft
|
||||
armor bottomleft
|
||||
health bottomleft
|
||||
ammo bottomleft
|
||||
weapon bottomleft
|
||||
keys bottomleft
|
||||
monsec bottomleft
|
||||
sttime bottomleft
|
||||
coord topright
|
||||
fps topright
|
||||
cmd bottomright
|
||||
speed bottomcenter
|
||||
|
||||
hud 2
|
||||
rate topleft
|
||||
health topright
|
||||
armor topright
|
||||
ammo bottomright
|
||||
weapon bottomright
|
||||
keys bottomleft
|
||||
monsec bottomleft
|
||||
sttime bottomleft
|
||||
coord topright
|
||||
fps topright
|
||||
cmd bottomright
|
||||
speed bottomcenter
|
||||
```
|
||||
|
||||
An alternative approach to the distributed HUD, using absolute screen coordinates, could look like this:
|
||||
|
||||
```
|
||||
hud 2
|
||||
health 224 0
|
||||
armor 224 8
|
||||
ammo 200 -8
|
||||
weapon 200 -16
|
||||
keys 2 -8
|
||||
monsec 2 8
|
||||
sttime 2 16
|
||||
coord 200 8
|
||||
fps 224 16
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
The "title" widget is only visible if the Automap is enabled. The "monsec", "sttime" and "coord" widgets are only visible if they are explicitly enabled in the Options menu (separately for Automap and HUD). The "fps" widget is only visible if the SHOWFPS cheat is enabled.
|
||||
|
||||
The "speed" widget is only visible if the SPEED cheat is enabled. Repeating the cheat cycles through different units.
|
||||
|
||||
The "compact" widget is a minimal widget showing only health, armor and ammo information. It is enabled by default in the minimal Boom HUD mode.
|
||||
|
||||
A centered widget does not allow for any other left or right aligned widget on the same line.
|
||||
|
||||
HUD modes without a paragraph remain unchanged. Widgets which are not mentioned in a paragraph will *never* be visible in the respective HUD mode. So, it is a good idea to *always* include the five widgets which make up the `hud 0` paragraph in the example above in *any* other paragraph.
|
||||
The Vanilla Doom widgets (i.e. "title", "message", "secret"), however, will *always* be visible, whether they are explicitly mentioned in a paragraph or not (new in Woof! 12.0.0).
|
||||
|
||||
It is currently impossible to use the WOOFHUD lump to modify the appearance of the Status Bar or the Crispy HUD. However, when using the Crispy HUD or the Automap, the visible widgets will align corresponding to the last active HUD mode.
|
||||
|
@ -28,9 +28,7 @@ set(WOOF_SOURCES
|
||||
hu_command.c hu_command.h
|
||||
hu_coordinates.c hu_coordinates.h
|
||||
hu_crosshair.c hu_crosshair.h
|
||||
hu_lib.c hu_lib.h
|
||||
hu_obituary.c hu_obituary.h
|
||||
hu_stuff.c hu_stuff.h
|
||||
i_3dsound.c
|
||||
i_endoom.c i_endoom.h
|
||||
i_flickstick.c i_flickstick.h
|
||||
@ -129,8 +127,9 @@ set(WOOF_SOURCES
|
||||
s_musinfo.c s_musinfo.h
|
||||
s_sound.c s_sound.h
|
||||
sounds.c sounds.h
|
||||
st_lib.c st_lib.h
|
||||
st_sbardef.c st_sbardef.h
|
||||
st_stuff.c st_stuff.h
|
||||
st_widgets.c st_widgets.h
|
||||
statdump.c statdump.h
|
||||
tables.c tables.h
|
||||
u_mapinfo.c u_mapinfo.h
|
||||
@ -282,10 +281,14 @@ if(MSVC)
|
||||
target_link_options(woof-setup PRIVATE "/MANIFEST:NO")
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET woof POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E tar cf
|
||||
"$<TARGET_FILE_DIR:woof>/woof.pk3" --format=zip .
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/base")
|
||||
add_dependencies(woof woof-base)
|
||||
|
||||
if(MSVC)
|
||||
add_custom_command(TARGET woof POST_BUILD
|
||||
DEPENDS "${BASE_PK3_PATH}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
"${BASE_PK3_PATH}" "$<TARGET_FILE_DIR:woof>")
|
||||
endif()
|
||||
|
||||
# Install
|
||||
#
|
||||
@ -313,11 +316,9 @@ if(WIN32)
|
||||
else()
|
||||
install(TARGETS woof woof-setup RUNTIME DESTINATION .)
|
||||
endif()
|
||||
install(FILES "$<TARGET_FILE_DIR:woof-com>/woof.com" DESTINATION .)
|
||||
install(FILES "$<TARGET_FILE_DIR:woof-exe>/woof.exe" DESTINATION .)
|
||||
install(FILES "$<TARGET_FILE_DIR:woof>/woof.pk3" DESTINATION .)
|
||||
install(FILES "$<TARGET_FILE_DIR:woof-com>/woof.com"
|
||||
"$<TARGET_FILE_DIR:woof-exe>/woof.exe"
|
||||
DESTINATION .)
|
||||
else()
|
||||
install(TARGETS woof woof-setup RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES "$<TARGET_FILE_DIR:woof>/woof.pk3"
|
||||
DESTINATION "share/${PROJECT_SHORTNAME}")
|
||||
endif()
|
||||
|
11
src/am_map.c
@ -28,7 +28,6 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "doomtype.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_video.h"
|
||||
#include "m_config.h"
|
||||
#include "m_input.h"
|
||||
@ -39,11 +38,11 @@
|
||||
#include "p_setup.h"
|
||||
#include "p_spec.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_main.h"
|
||||
#include "r_state.h"
|
||||
#include "r_things.h"
|
||||
#include "st_stuff.h"
|
||||
#include "st_widgets.h"
|
||||
#include "tables.h"
|
||||
#include "v_flextran.h"
|
||||
#include "v_fmt.h"
|
||||
@ -2387,12 +2386,6 @@ void AM_ColorPreset(void)
|
||||
*mapcolors[i].var = mapcolors[i].color[mapcolor_preset];
|
||||
}
|
||||
|
||||
// [FG] immediately apply changes if the automap is visible through the menu
|
||||
if (automapactive && menu_backdrop != MENU_BG_TEXTURE)
|
||||
{
|
||||
HU_Start();
|
||||
}
|
||||
|
||||
// [crispy] Make secret wall colors independent from PLAYPAL color indexes
|
||||
if (mapcolor_preset == AM_PRESET_CRISPY)
|
||||
{
|
||||
@ -2400,6 +2393,8 @@ void AM_ColorPreset(void)
|
||||
mapcolor_secr = I_GetNearestColor(playpal, 255, 0, 255);
|
||||
mapcolor_revsecr = I_GetNearestColor(playpal, 119, 255, 111);
|
||||
}
|
||||
|
||||
ST_ResetTitle();
|
||||
}
|
||||
|
||||
void AM_BindAutomapVariables(void)
|
||||
|
@ -44,8 +44,9 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_NULL,
|
||||
1,
|
||||
0,
|
||||
WPF_FLEEMELEE | WPF_AUTOSWITCHFROM | WPF_NOAUTOSWITCHTO
|
||||
},
|
||||
WPF_FLEEMELEE | WPF_AUTOSWITCHFROM | WPF_NOAUTOSWITCHTO,
|
||||
1
|
||||
},
|
||||
{
|
||||
// pistol
|
||||
am_clip,
|
||||
@ -56,8 +57,9 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_PISTOLFLASH,
|
||||
1,
|
||||
0,
|
||||
WPF_AUTOSWITCHFROM
|
||||
},
|
||||
WPF_AUTOSWITCHFROM,
|
||||
2
|
||||
},
|
||||
{
|
||||
// shotgun
|
||||
am_shell,
|
||||
@ -68,7 +70,8 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_SGUNFLASH1,
|
||||
1,
|
||||
0,
|
||||
WPF_NOFLAG
|
||||
WPF_NOFLAG,
|
||||
3
|
||||
},
|
||||
{
|
||||
// chaingun
|
||||
@ -80,7 +83,8 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_CHAINFLASH1,
|
||||
1,
|
||||
0,
|
||||
WPF_NOFLAG
|
||||
WPF_NOFLAG,
|
||||
4
|
||||
},
|
||||
{
|
||||
// missile launcher
|
||||
@ -92,7 +96,8 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_MISSILEFLASH1,
|
||||
1,
|
||||
0,
|
||||
WPF_NOAUTOFIRE
|
||||
WPF_NOAUTOFIRE,
|
||||
5
|
||||
},
|
||||
{
|
||||
// plasma rifle
|
||||
@ -104,7 +109,8 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_PLASMAFLASH1,
|
||||
1,
|
||||
0,
|
||||
WPF_NOFLAG
|
||||
WPF_NOFLAG,
|
||||
6
|
||||
},
|
||||
{
|
||||
// bfg 9000
|
||||
@ -116,7 +122,8 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_BFGFLASH1,
|
||||
40,
|
||||
0,
|
||||
WPF_NOAUTOFIRE
|
||||
WPF_NOAUTOFIRE,
|
||||
7
|
||||
},
|
||||
{
|
||||
// chainsaw
|
||||
@ -128,7 +135,8 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_NULL,
|
||||
1,
|
||||
0,
|
||||
WPF_NOTHRUST | WPF_FLEEMELEE | WPF_NOAUTOSWITCHTO
|
||||
WPF_NOTHRUST | WPF_FLEEMELEE | WPF_NOAUTOSWITCHTO,
|
||||
1
|
||||
},
|
||||
{
|
||||
// super shotgun
|
||||
@ -140,8 +148,9 @@ weaponinfo_t weaponinfo[NUMWEAPONS+2] =
|
||||
S_DSGUNFLASH1,
|
||||
2,
|
||||
0,
|
||||
WPF_NOFLAG
|
||||
},
|
||||
WPF_NOFLAG,
|
||||
3
|
||||
},
|
||||
{
|
||||
0
|
||||
},
|
||||
|
@ -57,6 +57,8 @@ typedef struct
|
||||
int ammopershot;
|
||||
int intflags;
|
||||
int flags;
|
||||
// id24
|
||||
int slot;
|
||||
} weaponinfo_t;
|
||||
|
||||
extern weaponinfo_t weaponinfo[NUMWEAPONS+2];
|
||||
|
54
src/d_main.c
@ -43,9 +43,7 @@
|
||||
#include "f_finale.h"
|
||||
#include "f_wipe.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_endoom.h"
|
||||
#include "i_gamepad.h"
|
||||
#include "i_glob.h"
|
||||
#include "i_input.h"
|
||||
#include "i_printf.h"
|
||||
@ -78,6 +76,7 @@
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "st_stuff.h"
|
||||
#include "st_widgets.h"
|
||||
#include "statdump.h"
|
||||
#include "u_mapinfo.h"
|
||||
#include "v_fmt.h"
|
||||
@ -255,16 +254,14 @@ void D_Display (void)
|
||||
{
|
||||
static boolean viewactivestate = false;
|
||||
static boolean menuactivestate = false;
|
||||
static boolean inhelpscreensstate = false;
|
||||
static boolean fullscreen = false;
|
||||
static gamestate_t oldgamestate = GS_NONE;
|
||||
static int borderdrawcount;
|
||||
int wipestart;
|
||||
boolean done, wipe, redrawsbar;
|
||||
boolean done, wipe;
|
||||
|
||||
if (demobar && PLAYBACK_SKIP)
|
||||
{
|
||||
if (HU_DemoProgressBar(false))
|
||||
if (ST_DemoProgressBar(false))
|
||||
{
|
||||
I_FinishUpdate();
|
||||
return;
|
||||
@ -285,8 +282,6 @@ void D_Display (void)
|
||||
}
|
||||
}
|
||||
|
||||
redrawsbar = false;
|
||||
|
||||
wipe = false;
|
||||
|
||||
// save the current screen if about to wipe
|
||||
@ -315,7 +310,7 @@ void D_Display (void)
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL && gametic)
|
||||
HU_Erase();
|
||||
ST_Erase();
|
||||
|
||||
switch (gamestate) // do buffered drawing
|
||||
{
|
||||
@ -324,24 +319,14 @@ void D_Display (void)
|
||||
break;
|
||||
if (automapactive)
|
||||
{
|
||||
static overlay_t last_automapoverlay;
|
||||
if (!automapoverlay)
|
||||
{
|
||||
// [FG] update automap while playing
|
||||
R_RenderPlayerView(&players[displayplayer]);
|
||||
AM_Drawer();
|
||||
if (last_automapoverlay && scaledviewheight == 200)
|
||||
{
|
||||
redrawsbar = true;
|
||||
}
|
||||
}
|
||||
last_automapoverlay = automapoverlay;
|
||||
ST_Drawer();
|
||||
}
|
||||
if (wipe || (scaledviewheight != 200 && fullscreen) // killough 11/98
|
||||
|| (inhelpscreensstate && !inhelpscreens))
|
||||
redrawsbar = true; // just put away the help screen
|
||||
ST_Drawer(scaledviewheight == 200, redrawsbar ); // killough 11/98
|
||||
fullscreen = scaledviewheight == 200; // killough 11/98
|
||||
break;
|
||||
case GS_INTERMISSION:
|
||||
WI_Drawer();
|
||||
@ -358,10 +343,10 @@ void D_Display (void)
|
||||
|
||||
// draw the view directly
|
||||
if (gamestate == GS_LEVEL && automap_off && gametic)
|
||||
R_RenderPlayerView (&players[displayplayer]);
|
||||
|
||||
if (gamestate == GS_LEVEL && gametic)
|
||||
HU_Drawer ();
|
||||
{
|
||||
R_RenderPlayerView(&players[displayplayer]);
|
||||
ST_Drawer();
|
||||
}
|
||||
|
||||
// clean up border stuff
|
||||
if (gamestate != oldgamestate && gamestate != GS_LEVEL)
|
||||
@ -381,26 +366,23 @@ void D_Display (void)
|
||||
borderdrawcount = 3;
|
||||
if (borderdrawcount)
|
||||
{
|
||||
R_DrawViewBorder (); // erase old menu stuff
|
||||
HU_Drawer ();
|
||||
R_DrawViewBorder(); // erase old menu stuff
|
||||
ST_Drawer();
|
||||
borderdrawcount--;
|
||||
}
|
||||
}
|
||||
|
||||
menuactivestate = menuactive;
|
||||
viewactivestate = viewactive;
|
||||
inhelpscreensstate = inhelpscreens;
|
||||
oldgamestate = wipegamestate = gamestate;
|
||||
|
||||
if (gamestate == GS_LEVEL && automapactive && automapoverlay)
|
||||
{
|
||||
AM_Drawer();
|
||||
ST_Drawer(scaledviewheight == 200, redrawsbar);
|
||||
HU_Drawer();
|
||||
ST_Drawer();
|
||||
|
||||
// [crispy] force redraw of status bar and border
|
||||
// [crispy] force redraw of border
|
||||
viewactivestate = false;
|
||||
inhelpscreensstate = true;
|
||||
}
|
||||
|
||||
// draw pause pic
|
||||
@ -423,7 +405,7 @@ void D_Display (void)
|
||||
NetUpdate(); // send out any new accumulation
|
||||
|
||||
if (demobar && demoplayback)
|
||||
HU_DemoProgressBar(true);
|
||||
ST_DemoProgressBar(true);
|
||||
|
||||
// normal update
|
||||
if (!wipe)
|
||||
@ -861,7 +843,7 @@ static boolean FileContainsMaps(const char *filename)
|
||||
{
|
||||
for (int m = 1; m < 35; ++m)
|
||||
{
|
||||
if (CheckMapLump(MAPNAME(1, m), filename))
|
||||
if (CheckMapLump(MapName(1, m), filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -873,7 +855,7 @@ static boolean FileContainsMaps(const char *filename)
|
||||
{
|
||||
for (int m = 1; m < 10; ++m)
|
||||
{
|
||||
if (CheckMapLump(MAPNAME(e, m), filename))
|
||||
if (CheckMapLump(MapName(e, m), filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -2448,12 +2430,10 @@ void D_DoomMain(void)
|
||||
S_Init(snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ );
|
||||
|
||||
I_Printf(VB_INFO, "HU_Init: Setting up heads up display.");
|
||||
HU_Init();
|
||||
MN_SetHUFontKerning();
|
||||
|
||||
I_Printf(VB_INFO, "ST_Init: Init status bar.");
|
||||
ST_Init();
|
||||
ST_Warnings();
|
||||
MN_SetHUFontKerning();
|
||||
|
||||
// andrewj: voxel support
|
||||
I_Printf(VB_INFO, "VX_Init: ");
|
||||
|
@ -176,6 +176,33 @@ typedef enum {
|
||||
NUMPOWERS,
|
||||
} powertype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
item_noitem = -1,
|
||||
item_messageonly,
|
||||
item_bluecard,
|
||||
item_yellowcard,
|
||||
item_redcard,
|
||||
item_blueskull,
|
||||
item_yellowskull,
|
||||
item_redskull,
|
||||
item_backpack,
|
||||
item_healthbonus,
|
||||
item_stimpack,
|
||||
item_medikit,
|
||||
item_soulsphere,
|
||||
item_megasphere,
|
||||
item_armorbonus,
|
||||
item_greenarmor,
|
||||
item_bluearmor,
|
||||
item_areamap,
|
||||
item_lightamp,
|
||||
item_berserk,
|
||||
item_invisibility,
|
||||
item_radsuit,
|
||||
item_invulnerability,
|
||||
} itemtype_t;
|
||||
|
||||
// Power up durations (how many seconds till expiration).
|
||||
typedef enum {
|
||||
INVULNTICS = (30*TICRATE),
|
||||
|
@ -119,7 +119,7 @@ int center_weapon;
|
||||
int view_bobbing_pct;
|
||||
int weapon_bobbing_pct;
|
||||
|
||||
char *MAPNAME(int e, int m)
|
||||
char *MapName(int e, int m)
|
||||
{
|
||||
static char name[9];
|
||||
|
||||
|
@ -63,7 +63,7 @@ typedef struct
|
||||
|
||||
extern GameVersions_t gameversions[];
|
||||
|
||||
extern char *MAPNAME(int e, int m);
|
||||
extern char *MapName(int e, int m);
|
||||
|
||||
// Set if homebrew PWAD stuff has been added.
|
||||
extern boolean modifiedgame;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "doomstat.h"
|
||||
#include "doomtype.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_lib.h"
|
||||
#include "info.h"
|
||||
#include "m_misc.h" // [FG] M_StringDuplicate()
|
||||
#include "m_swap.h"
|
||||
@ -35,6 +34,8 @@
|
||||
#include "r_state.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "st_sbardef.h"
|
||||
#include "st_stuff.h"
|
||||
#include "u_mapinfo.h"
|
||||
#include "v_fmt.h"
|
||||
#include "v_video.h"
|
||||
|
37
src/g_game.c
@ -41,8 +41,8 @@
|
||||
#include "doomtype.h"
|
||||
#include "f_finale.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_command.h"
|
||||
#include "hu_obituary.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_gamepad.h"
|
||||
#include "i_gyro.h"
|
||||
#include "i_input.h"
|
||||
@ -84,6 +84,7 @@
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "st_stuff.h"
|
||||
#include "st_widgets.h"
|
||||
#include "statdump.h" // [FG] StatCopy()
|
||||
#include "tables.h"
|
||||
#include "u_mapinfo.h"
|
||||
@ -860,7 +861,7 @@ void G_BuildTiccmd(ticcmd_t* cmd)
|
||||
|
||||
// Buttons
|
||||
|
||||
cmd->chatchar = HU_dequeueChatChar();
|
||||
cmd->chatchar = ST_DequeueChatChar();
|
||||
|
||||
if (M_InputGameActive(input_fire))
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
@ -1098,9 +1099,6 @@ static void G_DoLoadLevel(void)
|
||||
{
|
||||
displayplayer = consoleplayer; // view the guy you are playing
|
||||
}
|
||||
// [Alaux] Update smooth count values
|
||||
st_health = players[displayplayer].health;
|
||||
st_armor = players[displayplayer].armorpoints;
|
||||
gameaction = ga_nothing;
|
||||
|
||||
// Set the initial listener parameters using the player's initial state.
|
||||
@ -1119,7 +1117,6 @@ static void G_DoLoadLevel(void)
|
||||
//jff 4/26/98 wake up the status bar in case were coming out of a DM demo
|
||||
// killough 5/13/98: in case netdemo has consoleplayer other than green
|
||||
ST_Start();
|
||||
HU_Start();
|
||||
|
||||
// killough: make -timedemo work on multilevel demos
|
||||
// Move to end of function to minimize noise -- killough 2/22/98:
|
||||
@ -1249,7 +1246,7 @@ int G_GotoNextLevel(int *pEpi, int *pMap)
|
||||
!demorecording && !demoplayback &&
|
||||
!menuactive)
|
||||
{
|
||||
char *name = MAPNAME(epsd, map);
|
||||
char *name = MapName(epsd, map);
|
||||
|
||||
if (W_CheckNumForName(name) == -1)
|
||||
displaymsg("Next level not found: %s", name);
|
||||
@ -1370,8 +1367,7 @@ boolean G_Responder(event_t* ev)
|
||||
|
||||
// killough 9/29/98: reformatted
|
||||
if (gamestate == GS_LEVEL
|
||||
&& (HU_Responder(ev) || // chat ate the event
|
||||
ST_Responder(ev) || // status window ate it
|
||||
&& (ST_Responder(ev) || // status window ate it
|
||||
AM_Responder(ev) || // automap ate it
|
||||
WS_Responder(ev))) // weapon slots ate it
|
||||
{
|
||||
@ -1397,7 +1393,6 @@ boolean G_Responder(event_t* ev)
|
||||
while (!playeringame[displayplayer] && displayplayer!=consoleplayer);
|
||||
|
||||
ST_Start(); // killough 3/7/98: switch status bar views too
|
||||
HU_Start();
|
||||
S_UpdateSounds(players[displayplayer].mo);
|
||||
// [crispy] re-init automap variables for correct player arrow angle
|
||||
if (automapactive)
|
||||
@ -1746,7 +1741,7 @@ static void G_WriteLevelStat(void)
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(levelString, MAPNAME(gameepisode, gamemap));
|
||||
strcpy(levelString, MapName(gameepisode, gamemap));
|
||||
|
||||
G_FormatLevelStatTime(levelTimeString, leveltime, false);
|
||||
G_FormatLevelStatTime(totalTimeString, totalleveltimes + leveltime, true);
|
||||
@ -1798,9 +1793,6 @@ static void G_DoCompleted(void)
|
||||
if (automapactive)
|
||||
AM_Stop();
|
||||
|
||||
// Rebuild the Time widget to get rid of the Use-button timer
|
||||
HU_widget_rebuild_sttime();
|
||||
|
||||
wminfo.nextep = wminfo.epsd = gameepisode -1;
|
||||
wminfo.last = gamemap -1;
|
||||
|
||||
@ -2467,7 +2459,7 @@ static uint64_t G_Signature(int sig_epi, int sig_map)
|
||||
int lump, i;
|
||||
char name[9];
|
||||
|
||||
strcpy(name, MAPNAME(sig_epi, sig_map));
|
||||
strcpy(name, MapName(sig_epi, sig_map));
|
||||
|
||||
lump = W_CheckNumForName(name);
|
||||
|
||||
@ -2796,11 +2788,6 @@ static boolean DoLoadGame(boolean do_load_autosave)
|
||||
// done
|
||||
Z_Free(savebuffer);
|
||||
|
||||
// [Alaux] Update smooth count values;
|
||||
// the same procedure is done in G_LoadLevel, but we have to repeat it here
|
||||
st_health = players[displayplayer].health;
|
||||
st_armor = players[displayplayer].armorpoints;
|
||||
|
||||
if (setsizeneeded)
|
||||
R_ExecuteSetViewSize();
|
||||
|
||||
@ -3120,7 +3107,7 @@ void G_Ticker(void)
|
||||
// killough 9/29/98: split up switch statement
|
||||
// into pauseable and unpauseable parts.
|
||||
|
||||
gamestate == GS_LEVEL ? P_Ticker(), ST_Ticker(), AM_Ticker(), HU_Ticker() :
|
||||
gamestate == GS_LEVEL ? P_Ticker(), ST_Ticker(), AM_Ticker() :
|
||||
paused & 2 ? (void) 0 :
|
||||
gamestate == GS_INTERMISSION ? WI_Ticker() :
|
||||
gamestate == GS_FINALE ? F_Ticker() :
|
||||
@ -3969,7 +3956,7 @@ mapentry_t *G_LookupMapinfo(int episode, int map)
|
||||
int i;
|
||||
char lumpname[9];
|
||||
|
||||
strcpy(lumpname, MAPNAME(episode, map));
|
||||
strcpy(lumpname, MapName(episode, map));
|
||||
|
||||
for (i = 0; i < U_mapinfo.mapcount; i++)
|
||||
{
|
||||
@ -4003,13 +3990,13 @@ int G_ValidateMapName(const char *mapname, int *pEpi, int *pMap)
|
||||
{
|
||||
if (sscanf(mapuname, "E%dM%d", &epi, &map) != 2)
|
||||
return 0;
|
||||
strcpy(lumpname, MAPNAME(epi, map));
|
||||
strcpy(lumpname, MapName(epi, map));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sscanf(mapuname, "MAP%d", &map) != 1)
|
||||
return 0;
|
||||
strcpy(lumpname, MAPNAME(epi = 1, map));
|
||||
strcpy(lumpname, MapName(epi = 1, map));
|
||||
}
|
||||
|
||||
if (epi > 4)
|
||||
@ -4045,7 +4032,7 @@ void G_InitNew(skill_t skill, int episode, int map)
|
||||
episode = 1;
|
||||
|
||||
// Disable all sanity checks if there are custom episode definitions. They do not make sense in this case.
|
||||
if (!EpiCustom && W_CheckNumForName(MAPNAME(episode, map)) == -1)
|
||||
if (!EpiCustom && W_CheckNumForName(MapName(episode, map)) == -1)
|
||||
{
|
||||
|
||||
if (gamemode == retail)
|
||||
|
@ -21,8 +21,9 @@
|
||||
#include "d_event.h"
|
||||
#include "doomstat.h"
|
||||
#include "hu_command.h"
|
||||
#include "i_printf.h"
|
||||
#include "m_misc.h"
|
||||
#include "st_sbardef.h"
|
||||
#include "st_widgets.h"
|
||||
#include "v_video.h"
|
||||
|
||||
boolean hud_command_history;
|
||||
@ -267,13 +268,14 @@ void HU_UpdateCommandHistory(const ticcmd_t *cmd)
|
||||
UpdateHudCmdText(current);
|
||||
}
|
||||
|
||||
void HU_BuildCommandHistory(hu_multiline_t *const multiline)
|
||||
void HU_BuildCommandHistory(sbe_widget_t *widget)
|
||||
{
|
||||
hud_cmd_item_t *hud_cmd = current;
|
||||
|
||||
ST_ClearLines(widget);
|
||||
for (int i = 0; i < hud_command_history_size; i++)
|
||||
{
|
||||
HUlib_add_string_keep_space(multiline, hud_cmd->buf);
|
||||
ST_AddLine(widget, hud_cmd->buf);
|
||||
hud_cmd = hud_cmd->prev;
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,9 @@
|
||||
#define __HU_COMMAND__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "hu_lib.h"
|
||||
|
||||
struct hu_multiline_s;
|
||||
struct ticcmd_s;
|
||||
struct sbe_widget_s;
|
||||
|
||||
extern boolean hud_command_history;
|
||||
extern int hud_command_history_size;
|
||||
@ -33,6 +32,6 @@ void HU_UpdateTurnFormat(void);
|
||||
void HU_InitCommandHistory(void);
|
||||
void HU_ResetCommandHistory(void);
|
||||
void HU_UpdateCommandHistory(const struct ticcmd_s *cmd);
|
||||
void HU_BuildCommandHistory(struct hu_multiline_s *const multiline);
|
||||
void HU_BuildCommandHistory(struct sbe_widget_s *widget);
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "hu_coordinates.h"
|
||||
#include "m_misc.h"
|
||||
#include "p_mobj.h"
|
||||
#include "st_sbardef.h"
|
||||
#include "st_widgets.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#define THRESH_M1 15.11
|
||||
@ -92,7 +94,7 @@ static split_angle_t SplitAngle(angle_t x)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void BuildString(hu_multiline_t *const w_coord, char *buf, int len,
|
||||
static void BuildString(sbe_widget_t *widget, char *buf, int len,
|
||||
int pos)
|
||||
{
|
||||
if (WIDGET_WIDTH > pos)
|
||||
@ -100,10 +102,10 @@ static void BuildString(hu_multiline_t *const w_coord, char *buf, int len,
|
||||
M_snprintf(buf + pos, len - pos, "%-*s", WIDGET_WIDTH - pos, "");
|
||||
}
|
||||
|
||||
HUlib_add_string_keep_space(w_coord, buf);
|
||||
ST_AddLine(widget, buf);
|
||||
}
|
||||
|
||||
static void FixedToString(hu_multiline_t *const w_coord, const char *label,
|
||||
static void FixedToString(sbe_widget_t *widget, const char *label,
|
||||
fixed_t x, char *buf, int len, int pos)
|
||||
{
|
||||
const split_fixed_t value = SplitFixed(x);
|
||||
@ -120,10 +122,10 @@ static void FixedToString(hu_multiline_t *const w_coord, const char *label,
|
||||
pos += M_snprintf(buf + pos, len - pos, "%s: %d", label, value.base);
|
||||
}
|
||||
|
||||
BuildString(w_coord, buf, len, pos);
|
||||
BuildString(widget, buf, len, pos);
|
||||
}
|
||||
|
||||
static void AngleToString(hu_multiline_t *const w_coord, const char *label,
|
||||
static void AngleToString(sbe_widget_t *widget, const char *label,
|
||||
angle_t x, char *buf, int len, int pos)
|
||||
{
|
||||
const split_angle_t value = SplitAngle(x);
|
||||
@ -138,10 +140,10 @@ static void AngleToString(hu_multiline_t *const w_coord, const char *label,
|
||||
pos += M_snprintf(buf + pos, len - pos, "%s: %d", label, value.base);
|
||||
}
|
||||
|
||||
BuildString(w_coord, buf, len, pos);
|
||||
BuildString(widget, buf, len, pos);
|
||||
}
|
||||
|
||||
static void MagnitudeToString(hu_multiline_t *const w_coord, const char *label,
|
||||
static void MagnitudeToString(sbe_widget_t *widget, const char *label,
|
||||
double x, char *buf, int len, int pos)
|
||||
{
|
||||
if (x)
|
||||
@ -153,10 +155,10 @@ static void MagnitudeToString(hu_multiline_t *const w_coord, const char *label,
|
||||
pos += M_snprintf(buf + pos, len - pos, "%s: 0", label);
|
||||
}
|
||||
|
||||
BuildString(w_coord, buf, len, pos);
|
||||
BuildString(widget, buf, len, pos);
|
||||
}
|
||||
|
||||
static void ComponentToString(hu_multiline_t *const w_coord, const char *label,
|
||||
static void ComponentToString(sbe_widget_t *widget, const char *label,
|
||||
fixed_t x, char *buf, int len, int pos)
|
||||
{
|
||||
const split_fixed_t value = SplitFixed(x);
|
||||
@ -173,41 +175,61 @@ static void ComponentToString(hu_multiline_t *const w_coord, const char *label,
|
||||
pos += M_snprintf(buf + pos, len - pos, "%s: %d", label, value.base);
|
||||
}
|
||||
|
||||
BuildString(w_coord, buf, len, pos);
|
||||
BuildString(widget, buf, len, pos);
|
||||
}
|
||||
|
||||
void HU_BuildCoordinatesEx(hu_multiline_t *const w_coord, const mobj_t *mo,
|
||||
char *buf, int len)
|
||||
void HU_BuildCoordinatesEx(sbe_widget_t *widget, const mobj_t *mo)
|
||||
{
|
||||
int pos;
|
||||
double magnitude;
|
||||
crange_idx_e color;
|
||||
|
||||
ST_ClearLines(widget);
|
||||
|
||||
#define LINE_SIZE 60
|
||||
|
||||
// Coordinates.
|
||||
|
||||
pos = M_snprintf(buf, len, "\x1b%c", '0' + CR_GREEN);
|
||||
FixedToString(w_coord, "X", mo->x, buf, len, pos);
|
||||
FixedToString(w_coord, "Y", mo->y, buf, len, pos);
|
||||
FixedToString(w_coord, "Z", mo->z, buf, len, pos);
|
||||
AngleToString(w_coord, "A", mo->angle, buf, len, pos);
|
||||
HUlib_add_string_keep_space(w_coord, " ");
|
||||
static char line1[LINE_SIZE];
|
||||
pos = M_snprintf(line1, sizeof(line1), GREEN_S);
|
||||
FixedToString(widget, "X", mo->x, line1, sizeof(line1), pos);
|
||||
static char line2[LINE_SIZE];
|
||||
pos = M_snprintf(line2, sizeof(line2), GREEN_S);
|
||||
FixedToString(widget, "Y", mo->y, line2, sizeof(line2), pos);
|
||||
static char line3[LINE_SIZE];
|
||||
pos = M_snprintf(line3, sizeof(line3), GREEN_S);
|
||||
FixedToString(widget, "Z", mo->z, line3, sizeof(line3), pos);
|
||||
static char line4[LINE_SIZE];
|
||||
pos = M_snprintf(line4, sizeof(line4), GREEN_S);
|
||||
AngleToString(widget, "A", mo->angle, line4, sizeof(line4), pos);
|
||||
ST_AddLine(widget, " ");
|
||||
|
||||
// "Momentum" per tic.
|
||||
|
||||
magnitude = CalcMomentum(mo);
|
||||
color = BLOCK_COLOR(magnitude, THRESH_M1, THRESH_M2, THRESH_M3);
|
||||
pos = M_snprintf(buf, len, "\x1b%c", '0' + color);
|
||||
MagnitudeToString(w_coord, "M", magnitude, buf, len, pos);
|
||||
ComponentToString(w_coord, "X", mo->momx, buf, len, pos);
|
||||
ComponentToString(w_coord, "Y", mo->momy, buf, len, pos);
|
||||
HUlib_add_string_keep_space(w_coord, " ");
|
||||
static char line5[LINE_SIZE];
|
||||
pos = M_snprintf(line5, sizeof(line5), "\x1b%c", '0' + color);
|
||||
MagnitudeToString(widget, "M", magnitude, line5, sizeof(line5), pos);
|
||||
static char line6[LINE_SIZE];
|
||||
pos = M_snprintf(line6, sizeof(line6), "\x1b%c", '0' + color);
|
||||
ComponentToString(widget, "X", mo->momx, line6, sizeof(line6), pos);
|
||||
static char line7[LINE_SIZE];
|
||||
pos = M_snprintf(line7, sizeof(line7), "\x1b%c", '0' + color);
|
||||
ComponentToString(widget, "Y", mo->momy, line7, sizeof(line7), pos);
|
||||
ST_AddLine(widget, " ");
|
||||
|
||||
// Distance per tic.
|
||||
|
||||
magnitude = CalcDistance(mo);
|
||||
color = BLOCK_COLOR(magnitude, THRESH_D1, THRESH_D2, THRESH_D3);
|
||||
pos = M_snprintf(buf, len, "\x1b%c", '0' + color);
|
||||
MagnitudeToString(w_coord, "D", magnitude, buf, len, pos);
|
||||
ComponentToString(w_coord, "X", mo->x - mo->oldx, buf, len, pos);
|
||||
ComponentToString(w_coord, "Y", mo->y - mo->oldy, buf, len, pos);
|
||||
static char line8[LINE_SIZE];
|
||||
pos = M_snprintf(line8, sizeof(line8), "\x1b%c", '0' + color);
|
||||
MagnitudeToString(widget, "D", magnitude, line8, sizeof(line8), pos);
|
||||
static char line9[LINE_SIZE];
|
||||
pos = M_snprintf(line9, sizeof(line9), "\x1b%c", '0' + color);
|
||||
ComponentToString(widget, "X", mo->x - mo->oldx, line9, sizeof(line9), pos);
|
||||
static char line10[LINE_SIZE];
|
||||
pos = M_snprintf(line10, sizeof(line10), "\x1b%c", '0' + color);
|
||||
ComponentToString(widget, "Y", mo->y - mo->oldy, line10, sizeof(line10), pos);
|
||||
}
|
||||
|
@ -19,13 +19,9 @@
|
||||
#ifndef __HU_COORDINATES__
|
||||
#define __HU_COORDINATES__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "hu_lib.h"
|
||||
|
||||
struct hu_multiline_s;
|
||||
struct sbe_widget_s;
|
||||
struct mobj_s;
|
||||
|
||||
void HU_BuildCoordinatesEx(struct hu_multiline_s *const w_coord,
|
||||
const struct mobj_s *mo, char *buf, int len);
|
||||
void HU_BuildCoordinatesEx(struct sbe_widget_s *widget, const struct mobj_s *mo);
|
||||
|
||||
#endif
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "hu_crosshair.h"
|
||||
#include "d_items.h"
|
||||
#include "doomstat.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "m_swap.h"
|
||||
#include "p_map.h"
|
||||
#include "p_mobj.h"
|
||||
@ -101,6 +100,33 @@ void HU_StartCrosshair(void)
|
||||
|
||||
mobj_t *crosshair_target; // [Alaux] Lock crosshair on target
|
||||
|
||||
static crange_idx_e CRByHealth(int health, int maxhealth, boolean invul)
|
||||
{
|
||||
if (invul)
|
||||
{
|
||||
return CR_GRAY;
|
||||
}
|
||||
|
||||
health = 100 * health / maxhealth;
|
||||
|
||||
if (health < health_red)
|
||||
{
|
||||
return CR_RED;
|
||||
}
|
||||
else if (health < health_yellow)
|
||||
{
|
||||
return CR_GOLD;
|
||||
}
|
||||
else if (health <= health_green)
|
||||
{
|
||||
return CR_GREEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CR_BLUE1;
|
||||
}
|
||||
}
|
||||
|
||||
void HU_UpdateCrosshair(void)
|
||||
{
|
||||
plr = &players[displayplayer];
|
||||
@ -109,9 +135,11 @@ void HU_UpdateCrosshair(void)
|
||||
crosshair.y = (screenblocks <= 10) ? (SCREENHEIGHT - ST_HEIGHT) / 2
|
||||
: SCREENHEIGHT / 2;
|
||||
|
||||
boolean invul = (plr->cheats & CF_GODMODE) || plr->powers[pw_invulnerability];
|
||||
|
||||
if (hud_crosshair_health)
|
||||
{
|
||||
crosshair.cr = HU_ColorByHealth(plr->health, 100, st_invul);
|
||||
crosshair.cr = colrngs[CRByHealth(plr->health, 100, invul)];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -152,9 +180,9 @@ void HU_UpdateCrosshair(void)
|
||||
// [Alaux] Color crosshair by target health
|
||||
if (hud_crosshair_target == crosstarget_health)
|
||||
{
|
||||
crosshair.cr = HU_ColorByHealth(
|
||||
crosshair.cr = colrngs[CRByHealth(
|
||||
crosshair_target->health,
|
||||
crosshair_target->info->spawnhealth, false);
|
||||
crosshair_target->info->spawnhealth, false)];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
604
src/hu_lib.c
@ -1,604 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 1999 by
|
||||
// id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
// Copyright (C) 2023 Fabian Greffrath
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION: heads-up text and input code
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomkeys.h"
|
||||
#include "doomstat.h"
|
||||
#include "hu_lib.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "m_misc.h"
|
||||
#include "m_swap.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_state.h"
|
||||
#include "v_video.h"
|
||||
|
||||
// [FG] horizontal alignment
|
||||
|
||||
#define HU_GAPX 2
|
||||
static int left_margin, right_margin;
|
||||
boolean hud_widescreen_widgets;
|
||||
|
||||
void HUlib_set_margins (void)
|
||||
{
|
||||
left_margin = HU_GAPX;
|
||||
|
||||
if (hud_widescreen_widgets)
|
||||
{
|
||||
left_margin -= video.deltaw;
|
||||
}
|
||||
|
||||
right_margin = SCREENWIDTH - left_margin;
|
||||
}
|
||||
|
||||
// [FG] vertical alignment
|
||||
|
||||
typedef enum {
|
||||
offset_topleft,
|
||||
offset_topright,
|
||||
|
||||
offset_bottomleft,
|
||||
offset_bottomright,
|
||||
|
||||
num_offsets,
|
||||
} offset_t;
|
||||
|
||||
static int align_offset[num_offsets];
|
||||
|
||||
void HUlib_reset_align_offsets (void)
|
||||
{
|
||||
int bottom = SCREENHEIGHT;
|
||||
|
||||
if (scaledviewheight < SCREENHEIGHT ||
|
||||
draw_crispy_hud ||
|
||||
automap_on)
|
||||
{
|
||||
bottom -= 32; // ST_HEIGHT
|
||||
}
|
||||
|
||||
align_offset[offset_topleft] = 0;
|
||||
align_offset[offset_topright] = 0;
|
||||
align_offset[offset_bottomleft] = bottom;
|
||||
align_offset[offset_bottomright] = bottom;
|
||||
}
|
||||
|
||||
// [FG] clear line
|
||||
|
||||
void HUlib_clear_line (hu_line_t *const l)
|
||||
{
|
||||
l->line[0] = '\0';
|
||||
l->len = 0;
|
||||
l->width = 0;
|
||||
}
|
||||
|
||||
void HUlib_clear_cur_line (hu_multiline_t *const m)
|
||||
{
|
||||
HUlib_clear_line(m->lines[m->curline]);
|
||||
}
|
||||
|
||||
void HUlib_clear_all_lines (hu_multiline_t *const m)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m->numlines; i++)
|
||||
{
|
||||
HUlib_clear_line(m->lines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] add single char to line, increasing its length but not its width
|
||||
|
||||
static boolean add_char_to_line(hu_line_t *const t, const char ch)
|
||||
{
|
||||
if (t->len == HU_MAXLINELENGTH - 1)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
t->line[t->len++] = ch;
|
||||
t->line[t->len] = '\0';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean del_char_from_line(hu_line_t* l)
|
||||
{
|
||||
return l->len ? l->line[--l->len] = '\0', true : false;
|
||||
}
|
||||
|
||||
// [FG] add printable char to line, handle Backspace and Enter (for w_chat)
|
||||
|
||||
boolean HUlib_add_key_to_line(hu_line_t *const l, unsigned char ch)
|
||||
{
|
||||
if (ch >= ' ' && ch <= '_')
|
||||
add_char_to_line(l, (char) ch);
|
||||
else if (ch == KEY_BACKSPACE) // phares
|
||||
del_char_from_line(l);
|
||||
else if (ch != KEY_ENTER) // phares
|
||||
return false; // did not eat key
|
||||
|
||||
return true; // ate the key
|
||||
}
|
||||
|
||||
boolean HUlib_add_key_to_cur_line(hu_multiline_t *const m, unsigned char ch)
|
||||
{
|
||||
hu_line_t *const l = m->lines[m->curline];
|
||||
|
||||
return HUlib_add_key_to_line(l, ch);
|
||||
}
|
||||
|
||||
// [FG] point curline to the next line in a multiline if available
|
||||
|
||||
static inline void inc_cur_line (hu_multiline_t *const m)
|
||||
{
|
||||
if (m->numlines > 1)
|
||||
{
|
||||
if (++m->curline >= m->numlines)
|
||||
{
|
||||
m->curline = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] add string to line, increasing its (length and) width
|
||||
|
||||
static void add_string_to_line(hu_line_t *const l, const hu_font_t *const f,
|
||||
const char *s, boolean keep_space)
|
||||
{
|
||||
int w = 0;
|
||||
unsigned char c;
|
||||
patch_t *const *const p = f->patches;
|
||||
|
||||
if (!*s)
|
||||
return;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
c = M_ToUpper(*s++);
|
||||
|
||||
if (c == '\x1b')
|
||||
{
|
||||
add_char_to_line(l, c);
|
||||
add_char_to_line(l, *s++);
|
||||
continue;
|
||||
}
|
||||
else if (c == '\t')
|
||||
w = (w + f->tab_width) & f->tab_mask;
|
||||
else if (c >= HU_FONTSTART && c <= HU_FONTEND + 6)
|
||||
w += SHORT(p[c - HU_FONTSTART]->width);
|
||||
else
|
||||
w += f->space_width;
|
||||
|
||||
add_char_to_line(l, c);
|
||||
}
|
||||
|
||||
if (!keep_space)
|
||||
{
|
||||
while (*--s == ' ')
|
||||
w -= f->space_width;
|
||||
}
|
||||
|
||||
l->width += w;
|
||||
}
|
||||
|
||||
// [FG] add string to current line, point to next line if available
|
||||
|
||||
void HUlib_add_strings_to_cur_line (hu_multiline_t *const m, const char *prefix, const char *s)
|
||||
{
|
||||
hu_line_t *const l = m->lines[m->curline];
|
||||
|
||||
HUlib_clear_line(l);
|
||||
|
||||
if (prefix)
|
||||
{
|
||||
add_string_to_line(l, *m->font, prefix, false);
|
||||
}
|
||||
|
||||
add_string_to_line(l, *m->font, s, false);
|
||||
|
||||
inc_cur_line(m);
|
||||
}
|
||||
|
||||
void HUlib_add_string_to_cur_line (hu_multiline_t *const m, const char *s)
|
||||
{
|
||||
HUlib_add_strings_to_cur_line(m, NULL, s);
|
||||
}
|
||||
|
||||
void HUlib_add_string_keep_space(hu_multiline_t *const m, const char *s)
|
||||
{
|
||||
hu_line_t *const l = m->lines[m->curline];
|
||||
|
||||
HUlib_clear_line(l);
|
||||
add_string_to_line(l, *m->font, s, true);
|
||||
inc_cur_line(m);
|
||||
}
|
||||
|
||||
// [FG] horizontal and vertical alignment
|
||||
|
||||
static int horz_align_widget(const hu_widget_t *const w, const hu_line_t *const l, const align_t h_align)
|
||||
{
|
||||
if (h_align == align_left)
|
||||
{
|
||||
return left_margin;
|
||||
}
|
||||
else if (h_align == align_right)
|
||||
{
|
||||
return right_margin - l->width;
|
||||
}
|
||||
else if (h_align == align_center)
|
||||
{
|
||||
return SCREENWIDTH/2 - l->width/2;
|
||||
}
|
||||
|
||||
// [FG] align_direct
|
||||
if (hud_widescreen_widgets)
|
||||
{
|
||||
if (w->x < SCREENWIDTH/2)
|
||||
{
|
||||
return w->x - video.deltaw;
|
||||
}
|
||||
else
|
||||
{
|
||||
return w->x + video.deltaw;
|
||||
}
|
||||
}
|
||||
|
||||
return w->x;
|
||||
}
|
||||
|
||||
static int vert_align_widget(const hu_widget_t *const w, const hu_multiline_t *const m, const hu_font_t *const f, const align_t h_align, const align_t v_align)
|
||||
{
|
||||
const int font_height = f->line_height;
|
||||
|
||||
int y = 0;
|
||||
|
||||
if (v_align == align_direct)
|
||||
{
|
||||
return w->y;
|
||||
}
|
||||
else if (v_align == align_secret)
|
||||
{
|
||||
return MAX(SCREENHEIGHT - 32, scaledviewheight) / 2 - 32;
|
||||
}
|
||||
// [FG] centered and Vanilla widgets are always exclusive,
|
||||
// i.e. they don't allow any other widget on the same line
|
||||
else if (h_align == align_center || m->exclusive)
|
||||
{
|
||||
if (v_align == align_top)
|
||||
{
|
||||
y = MAX(align_offset[offset_topleft],
|
||||
align_offset[offset_topright]);
|
||||
|
||||
align_offset[offset_topleft] =
|
||||
align_offset[offset_topright] = y + font_height;
|
||||
}
|
||||
else if (v_align == align_bottom)
|
||||
{
|
||||
y = MIN(align_offset[offset_bottomleft],
|
||||
align_offset[offset_bottomright]) - font_height;
|
||||
|
||||
align_offset[offset_bottomleft] =
|
||||
align_offset[offset_bottomright] = y;
|
||||
}
|
||||
}
|
||||
else if (v_align == align_top)
|
||||
{
|
||||
if (h_align == align_left)
|
||||
{
|
||||
y = align_offset[offset_topleft];
|
||||
align_offset[offset_topleft] += font_height;
|
||||
}
|
||||
else if (h_align == align_right)
|
||||
{
|
||||
y = align_offset[offset_topright];
|
||||
align_offset[offset_topright] += font_height;
|
||||
}
|
||||
}
|
||||
else if (v_align == align_bottom)
|
||||
{
|
||||
if (h_align == align_left)
|
||||
{
|
||||
align_offset[offset_bottomleft] -= font_height;
|
||||
y = align_offset[offset_bottomleft];
|
||||
}
|
||||
else if (h_align == align_right)
|
||||
{
|
||||
align_offset[offset_bottomright] -= font_height;
|
||||
y = align_offset[offset_bottomright];
|
||||
}
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
// [FG] draw a line to a given screen coordinates using the given font
|
||||
|
||||
static void draw_line_aligned (const hu_multiline_t *m, const hu_line_t *l, const hu_font_t *const f, int x, int y)
|
||||
{
|
||||
const int x0 = x;
|
||||
int i;
|
||||
unsigned char c;
|
||||
byte *cr = m->cr;
|
||||
patch_t *const *const p = f->patches;
|
||||
|
||||
// draw the new stuff
|
||||
for (i = 0; i < l->len; i++)
|
||||
{
|
||||
c = M_ToUpper(l->line[i]);
|
||||
|
||||
#if 0
|
||||
if (c == '\n')
|
||||
{
|
||||
// [FG] TODO line breaks!
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (c == '\t') // killough 1/23/98 -- support tab stops
|
||||
{
|
||||
x = x0 + (((x - x0) + f->tab_width) & f->tab_mask);
|
||||
}
|
||||
else if (c == '\x1b') //jff 2/17/98 escape code for color change
|
||||
{ //jff 3/26/98 changed to actual escape char
|
||||
if (++i < l->len)
|
||||
{
|
||||
if (l->line[i] >= '0' && l->line[i] <= '0'+CR_NONE)
|
||||
cr = colrngs[l->line[i]-'0'];
|
||||
else if (l->line[i] == '0'+CR_ORIG) // [FG] reset to original color
|
||||
cr = m->cr;
|
||||
}
|
||||
}
|
||||
else if (c >= HU_FONTSTART && c <= HU_FONTEND + 6)
|
||||
{
|
||||
int w = SHORT(p[c-HU_FONTSTART]->width);
|
||||
|
||||
if (x+w > right_margin + HU_GAPX)
|
||||
break;
|
||||
|
||||
// killough 1/18/98 -- support multiple lines:
|
||||
V_DrawPatchTranslated(x, y, p[c-HU_FONTSTART], cr);
|
||||
x += w;
|
||||
}
|
||||
else if ((x += f->space_width) >= right_margin + HU_GAPX)
|
||||
break;
|
||||
}
|
||||
|
||||
// draw the cursor if requested
|
||||
// killough 1/18/98 -- support multiple lines
|
||||
if (m->drawcursor &&
|
||||
x + SHORT(p['_'-HU_FONTSTART]->width) <= right_margin + HU_GAPX &&
|
||||
leveltime & 16)
|
||||
{
|
||||
cr = m->cr; //jff 2/17/98 restore original color
|
||||
V_DrawPatchTranslated(x, y, p['_' - HU_FONTSTART], cr);
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] shortcut for single-lined wigets
|
||||
|
||||
static void draw_widget_single (const hu_widget_t *const w, const hu_font_t *const f)
|
||||
{
|
||||
const hu_multiline_t *const m = w->multiline;
|
||||
const int h_align = w->h_align, v_align = w->v_align;
|
||||
|
||||
const int cl = m->curline;
|
||||
const hu_line_t *const l = m->lines[cl];
|
||||
|
||||
if (l->width || m->drawcursor)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
x = horz_align_widget(w, l, h_align);
|
||||
y = vert_align_widget(w, m, f, h_align, v_align);
|
||||
draw_line_aligned(m, l, f, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] the w_messages widget is drawn bottom-up if v_align == align_top,
|
||||
// i.e. the last message is drawn first, same for all other widgets
|
||||
// if v_align == align_bottom
|
||||
|
||||
static void draw_widget_bottomup (const hu_widget_t *const w, const hu_font_t *const f)
|
||||
{
|
||||
const hu_multiline_t *const m = w->multiline;
|
||||
const int h_align = w->h_align, v_align = w->v_align;
|
||||
|
||||
const int nl = m->numlines;
|
||||
int cl = m->curline - 1;
|
||||
|
||||
int i, x, y;
|
||||
|
||||
for (i = 0; i < nl; i++, cl--)
|
||||
{
|
||||
const hu_line_t *l;
|
||||
|
||||
if (cl < 0)
|
||||
cl = nl - 1;
|
||||
|
||||
l = m->lines[cl];
|
||||
|
||||
if (l->width)
|
||||
{
|
||||
x = horz_align_widget(w, l, h_align);
|
||||
y = vert_align_widget(w, m, f, h_align, v_align);
|
||||
draw_line_aligned(m, l, f, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] standard behavior, the first line is drawn first
|
||||
|
||||
static void draw_widget_topdown (const hu_widget_t *const w, const hu_font_t *const f)
|
||||
{
|
||||
const hu_multiline_t *const m = w->multiline;
|
||||
const int h_align = w->h_align, v_align = w->v_align;
|
||||
|
||||
const int nl = m->numlines;
|
||||
int cl = m->curline;
|
||||
|
||||
int i, x, y;
|
||||
|
||||
for (i = 0; i < nl; i++, cl++)
|
||||
{
|
||||
const hu_line_t *l;
|
||||
|
||||
if (cl >= nl)
|
||||
cl = 0;
|
||||
|
||||
l = m->lines[cl];
|
||||
|
||||
if (l->width)
|
||||
{
|
||||
x = horz_align_widget(w, l, h_align);
|
||||
y = vert_align_widget(w, m, f, h_align, v_align);
|
||||
draw_line_aligned(m, l, f, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HUlib_draw_widget (const hu_widget_t *const w)
|
||||
{
|
||||
const hu_multiline_t *const m = w->multiline;
|
||||
const hu_font_t *const f = *m->font;
|
||||
|
||||
if (m->numlines == 1)
|
||||
draw_widget_single(w, f);
|
||||
// [FG] Vanilla widget with top alignment,
|
||||
// or Boom widget with bottom alignment
|
||||
else if (m->bottomup ^ (w->v_align == align_bottom))
|
||||
draw_widget_bottomup(w, f);
|
||||
else
|
||||
draw_widget_topdown(w, f);
|
||||
}
|
||||
|
||||
void HUlib_init_multiline(hu_multiline_t *m,
|
||||
int nl,
|
||||
hu_font_t **f,
|
||||
byte *cr,
|
||||
boolean *on,
|
||||
void (*builder)(void))
|
||||
{
|
||||
int i;
|
||||
|
||||
// [FG] dynamically allocate lines array
|
||||
if (m->numlines != nl)
|
||||
{
|
||||
for (i = 0; i < m->numlines; i++)
|
||||
{
|
||||
free(m->lines[i]);
|
||||
m->lines[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m->numlines = nl;
|
||||
m->curline = 0;
|
||||
|
||||
for (i = 0; i < m->numlines; i++)
|
||||
{
|
||||
if (m->lines[i] == NULL)
|
||||
{
|
||||
m->lines[i] = malloc(sizeof(hu_line_t));
|
||||
}
|
||||
HUlib_clear_line(m->lines[i]);
|
||||
}
|
||||
|
||||
m->font = f;
|
||||
m->cr = cr;
|
||||
m->drawcursor = false;
|
||||
|
||||
m->on = on;
|
||||
|
||||
m->builder = builder;
|
||||
m->built = false;
|
||||
|
||||
m->exclusive = (on != NULL);
|
||||
m->bottomup = (on != NULL);
|
||||
}
|
||||
|
||||
void HUlib_erase_widget (const hu_widget_t *const w)
|
||||
{
|
||||
const hu_multiline_t *const m = w->multiline;
|
||||
const hu_font_t *const f = *m->font;
|
||||
|
||||
const int height = m->numlines * f->line_height;
|
||||
|
||||
int y = 0;
|
||||
for (int i = 0; i < m->numlines; ++i)
|
||||
{
|
||||
y = vert_align_widget(w, m, f, w->h_align, w->v_align);
|
||||
}
|
||||
|
||||
if (w->v_align == align_top)
|
||||
y += f->line_height - height;
|
||||
|
||||
if (y > scaledviewy && y < scaledviewy + scaledviewheight - height)
|
||||
{
|
||||
R_VideoErase(0, y, scaledviewx, height);
|
||||
R_VideoErase(scaledviewx + scaledviewwidth, y, scaledviewx, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_VideoErase(0, y, video.unscaledw, height);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log: hu_lib.c,v $
|
||||
// Revision 1.13 1998/05/11 10:13:26 jim
|
||||
// formatted/documented hu_lib
|
||||
//
|
||||
// Revision 1.12 1998/05/03 22:24:13 killough
|
||||
// Provide minimal headers at top; nothing else
|
||||
//
|
||||
// Revision 1.11 1998/04/29 09:24:33 jim
|
||||
// Fix compiler warning
|
||||
//
|
||||
// Revision 1.10 1998/04/28 15:53:46 jim
|
||||
// Fix message list bug in small screen mode
|
||||
//
|
||||
// Revision 1.9 1998/03/27 21:25:41 jim
|
||||
// Commented change of \ to ESC
|
||||
//
|
||||
// Revision 1.8 1998/03/26 20:06:24 jim
|
||||
// Fixed escape confusion in HU text drawer
|
||||
//
|
||||
// Revision 1.7 1998/02/26 22:58:33 jim
|
||||
// Added message review display to HUD
|
||||
//
|
||||
// Revision 1.6 1998/02/19 16:55:15 jim
|
||||
// Optimized HUD and made more configurable
|
||||
//
|
||||
// Revision 1.5 1998/02/18 00:59:01 jim
|
||||
// Addition of HUD
|
||||
//
|
||||
// Revision 1.4 1998/02/15 02:47:44 phares
|
||||
// User-defined keys
|
||||
//
|
||||
// Revision 1.3 1998/01/26 19:23:20 phares
|
||||
// First rev with no ^Ms
|
||||
//
|
||||
// Revision 1.2 1998/01/26 05:50:22 killough
|
||||
// Support more lines, and tab stops, in messages
|
||||
//
|
||||
// Revision 1.1.1.1 1998/01/19 14:02:55 rand
|
||||
// Lee's Jan 19 sources
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
183
src/hu_lib.h
@ -1,183 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 1999 by
|
||||
// id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
// Copyright (C) 2023 Fabian Greffrath
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION: none
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __HULIB__
|
||||
#define __HULIB__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
struct patch_s;
|
||||
|
||||
// [FG] font stuff
|
||||
|
||||
#define HU_FONTSTART '!' /* the first font characters */
|
||||
#define HU_FONTEND (0x7f) /*jff 2/16/98 '_' the last font characters */
|
||||
|
||||
// Calculate # of glyphs in font.
|
||||
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct patch_s *patches[HU_FONTSIZE+6];
|
||||
|
||||
int line_height;
|
||||
|
||||
const int space_width;
|
||||
|
||||
const int tab_width;
|
||||
const int tab_mask;
|
||||
} hu_font_t;
|
||||
|
||||
extern struct patch_s **hu_font;
|
||||
|
||||
// [FG] widget stuff
|
||||
|
||||
#define CR_ORIG (-1) // [FG] reset to original color
|
||||
|
||||
#define HU_MAXLINELENGTH 120
|
||||
|
||||
//jff 2/26/98 maximum number of messages allowed in refresh list
|
||||
#define HU_MAXMESSAGES 20
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// [FG] h_align / v_align
|
||||
align_direct,
|
||||
|
||||
// [FG] h_align
|
||||
align_left,
|
||||
align_right,
|
||||
align_center,
|
||||
|
||||
// [FG] v_align
|
||||
align_top,
|
||||
align_bottom,
|
||||
align_secret,
|
||||
|
||||
num_aligns,
|
||||
} align_t;
|
||||
|
||||
// [FG] a single line of information
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char line[HU_MAXLINELENGTH];
|
||||
|
||||
// [FG] length in chars
|
||||
int len;
|
||||
|
||||
// [FG] width in pixels
|
||||
int width;
|
||||
|
||||
} hu_line_t;
|
||||
|
||||
// [FG] an array of lines with common properties
|
||||
|
||||
typedef struct hu_multiline_s
|
||||
{
|
||||
hu_line_t *lines[HU_MAXMESSAGES]; // text lines to draw
|
||||
int numlines; // number of lines
|
||||
int curline; // current line number
|
||||
|
||||
hu_font_t **font; // font
|
||||
byte *cr; //jff 2/16/52 output color range
|
||||
boolean drawcursor;
|
||||
|
||||
// pointer to boolean stating whether to update window
|
||||
boolean *on;
|
||||
|
||||
void (*builder)(void);
|
||||
boolean built;
|
||||
|
||||
boolean exclusive;
|
||||
boolean bottomup;
|
||||
|
||||
} hu_multiline_t;
|
||||
|
||||
// [FG] configured alignment and coordinates for multilines
|
||||
|
||||
typedef struct hu_widget_s
|
||||
{
|
||||
hu_multiline_t *multiline;
|
||||
|
||||
align_t h_align, v_align;
|
||||
|
||||
// [FG] align_direct
|
||||
int x, y;
|
||||
|
||||
// [FG] back up for centered messages
|
||||
align_t h_align_orig;
|
||||
|
||||
} hu_widget_t;
|
||||
|
||||
void HUlib_set_margins (void);
|
||||
void HUlib_reset_align_offsets (void);
|
||||
|
||||
void HUlib_clear_line (hu_line_t *const l);
|
||||
void HUlib_clear_cur_line (hu_multiline_t *const m);
|
||||
void HUlib_clear_all_lines (hu_multiline_t *const m);
|
||||
|
||||
void HUlib_add_string_to_cur_line (hu_multiline_t *const m, const char *s);
|
||||
void HUlib_add_strings_to_cur_line (hu_multiline_t *const m, const char *prefix, const char *s);
|
||||
void HUlib_add_string_keep_space(hu_multiline_t *const m, const char *s);
|
||||
|
||||
void HUlib_draw_widget (const hu_widget_t *const w);
|
||||
|
||||
void HUlib_init_multiline (hu_multiline_t *const m, int nl, hu_font_t **f, byte *cr, boolean *on, void (*builder)(void));
|
||||
|
||||
boolean HUlib_add_key_to_line (hu_line_t *const l, unsigned char ch);
|
||||
boolean HUlib_add_key_to_cur_line (hu_multiline_t *const m, unsigned char ch);
|
||||
|
||||
void HUlib_erase_widget (const hu_widget_t *const w);
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log: hu_lib.h,v $
|
||||
// Revision 1.9 1998/05/11 10:13:31 jim
|
||||
// formatted/documented hu_lib
|
||||
//
|
||||
// Revision 1.8 1998/04/28 15:53:53 jim
|
||||
// Fix message list bug in small screen mode
|
||||
//
|
||||
// Revision 1.7 1998/02/26 22:58:44 jim
|
||||
// Added message review display to HUD
|
||||
//
|
||||
// Revision 1.6 1998/02/19 16:55:19 jim
|
||||
// Optimized HUD and made more configurable
|
||||
//
|
||||
// Revision 1.5 1998/02/18 00:58:58 jim
|
||||
// Addition of HUD
|
||||
//
|
||||
// Revision 1.4 1998/02/15 02:48:09 phares
|
||||
// User-defined keys
|
||||
//
|
||||
// Revision 1.3 1998/01/26 19:26:52 phares
|
||||
// First rev with no ^Ms
|
||||
//
|
||||
// Revision 1.2 1998/01/26 05:50:24 killough
|
||||
// Support more lines, and tab stops, in messages
|
||||
//
|
||||
// Revision 1.1.1.1 1998/01/19 14:02:55 rand
|
||||
// Lee's Jan 19 sources
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "m_misc.h"
|
||||
#include "net_client.h"
|
||||
#include "p_mobj.h"
|
||||
#include "v_video.h"
|
||||
|
||||
boolean show_obituary_messages;
|
||||
int hudcolor_obituary;
|
||||
@ -215,7 +216,7 @@ void HU_Obituary(mobj_t *target, mobj_t *source, method_t mod)
|
||||
break;
|
||||
}
|
||||
|
||||
doomprintf(&players[i], MESSAGES_OBITUARY, "\x1b%c%s",
|
||||
doomprintf(&players[i], MESSAGES_OBITUARY, "\x1b%c%s" ORIG_S,
|
||||
'0' + hudcolor_obituary, str);
|
||||
}
|
||||
|
||||
|
2429
src/hu_stuff.c
139
src/hu_stuff.h
@ -1,139 +0,0 @@
|
||||
// Copyright (C) 1999 by
|
||||
// id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
// Copyright (C) 2023 Fabian Greffrath
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION: Head up display
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __HU_STUFF_H__
|
||||
#define __HU_STUFF_H__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "hu_command.h"
|
||||
|
||||
struct event_s;
|
||||
struct mobj_s;
|
||||
|
||||
#define HU_BROADCAST 5
|
||||
|
||||
#define HU_MSGTIMEOUT (4*TICRATE)
|
||||
#define HU_MSGTIMEOUT2 (5*TICRATE/2) // [crispy] 2.5 seconds
|
||||
|
||||
//
|
||||
// Heads up text
|
||||
//
|
||||
void HU_Init(void);
|
||||
void HU_Start(void);
|
||||
void HU_disable_all_widgets (void);
|
||||
void HU_widget_rebuild_sttime(void);
|
||||
|
||||
boolean HU_Responder(struct event_s *ev);
|
||||
|
||||
void HU_Ticker(void);
|
||||
void HU_Drawer(void);
|
||||
char HU_dequeueChatChar(void);
|
||||
void HU_Erase(void);
|
||||
|
||||
boolean HU_DemoProgressBar(boolean force);
|
||||
|
||||
void HU_ResetMessageColors(void);
|
||||
|
||||
void WI_DrawWidgets(void);
|
||||
|
||||
// killough 5/2/98: moved from m_misc.c:
|
||||
|
||||
//jff 2/16/98 hud supported automap colors added
|
||||
extern int hudcolor_titl; // color range of automap level title
|
||||
extern int hudcolor_xyco; // color range of new coords on automap
|
||||
//jff 2/23/98 hud is currently displayed
|
||||
extern boolean hud_displayed; // hud is displayed
|
||||
//jff 2/18/98 hud/status control
|
||||
extern int hud_active; // hud mode 0=off, 1=small, 2=full
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SECRETMESSAGE_OFF,
|
||||
SECRETMESSAGE_ON,
|
||||
SECRETMESSAGE_COUNT
|
||||
} secretmessage_t;
|
||||
|
||||
extern secretmessage_t hud_secret_message; // "A secret is revealed!" message
|
||||
|
||||
extern int hud_player_coords, hud_level_stats, hud_level_time;
|
||||
extern boolean hud_widescreen_widgets;
|
||||
extern boolean hud_time_use;
|
||||
extern boolean show_messages;
|
||||
extern boolean show_toggle_messages;
|
||||
extern boolean show_pickup_messages;
|
||||
|
||||
extern boolean chat_on;
|
||||
extern boolean message_dontfuckwithme;
|
||||
|
||||
extern int playback_tic, playback_totaltics;
|
||||
|
||||
extern char **player_names[];
|
||||
|
||||
enum
|
||||
{
|
||||
HUD_TYPE_CRISPY,
|
||||
HUD_TYPE_BOOM_NO_BARS,
|
||||
HUD_TYPE_BOOM,
|
||||
|
||||
NUM_HUD_TYPES
|
||||
};
|
||||
|
||||
extern int hud_type;
|
||||
extern boolean draw_crispy_hud;
|
||||
|
||||
enum
|
||||
{
|
||||
HUD_WIDGET_OFF,
|
||||
HUD_WIDGET_AUTOMAP,
|
||||
HUD_WIDGET_HUD,
|
||||
HUD_WIDGET_ALWAYS,
|
||||
HUD_WIDGET_ADVANCED,
|
||||
};
|
||||
|
||||
void HU_BindHUDVariables(void);
|
||||
|
||||
byte* HU_ColorByHealth(int health, int maxhealth, boolean invul);
|
||||
|
||||
extern int speedometer;
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log: hu_stuff.h,v $
|
||||
// Revision 1.6 1998/05/10 19:03:50 jim
|
||||
// formatted/documented hu_stuff
|
||||
//
|
||||
// Revision 1.5 1998/05/03 22:25:03 killough
|
||||
// add external declarations for hud options
|
||||
//
|
||||
// Revision 1.4 1998/02/18 00:59:04 jim
|
||||
// Addition of HUD
|
||||
//
|
||||
// Revision 1.3 1998/02/15 02:48:12 phares
|
||||
// User-defined keys
|
||||
//
|
||||
// Revision 1.2 1998/01/26 19:26:54 phares
|
||||
// First rev with no ^Ms
|
||||
//
|
||||
// Revision 1.1.1.1 1998/01/19 14:02:56 rand
|
||||
// Lee's Jan 19 sources
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
@ -30,7 +30,6 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "info.h"
|
||||
#include "m_cheat.h"
|
||||
#include "m_fixed.h"
|
||||
@ -49,6 +48,7 @@
|
||||
#include "r_state.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "st_widgets.h"
|
||||
#include "tables.h"
|
||||
#include "u_mapinfo.h"
|
||||
#include "w_wad.h"
|
||||
@ -611,10 +611,10 @@ static void cheat_clev0()
|
||||
int epsd, map;
|
||||
char *cur, *next;
|
||||
|
||||
cur = M_StringDuplicate(MAPNAME(gameepisode, gamemap));
|
||||
cur = M_StringDuplicate(MapName(gameepisode, gamemap));
|
||||
|
||||
G_GotoNextLevel(&epsd, &map);
|
||||
next = MAPNAME(epsd, map);
|
||||
next = MapName(epsd, map);
|
||||
|
||||
if (W_CheckNumForName(next) != -1)
|
||||
displaymsg("Current: %s, Next: %s", cur, next);
|
||||
@ -657,7 +657,7 @@ static void cheat_clev(char *buf)
|
||||
epsd = 1;
|
||||
}
|
||||
|
||||
next = MAPNAME(epsd, map);
|
||||
next = MapName(epsd, map);
|
||||
|
||||
if (W_CheckNumForName(next) == -1)
|
||||
{
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "doomstat.h"
|
||||
#include "doomtype.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_flickstick.h"
|
||||
#include "i_gamepad.h"
|
||||
#include "i_gyro.h"
|
||||
@ -54,6 +53,7 @@
|
||||
#include "mn_internal.h"
|
||||
#include "r_main.h"
|
||||
#include "st_stuff.h"
|
||||
#include "st_widgets.h"
|
||||
#include "w_wad.h"
|
||||
#include "ws_stuff.h"
|
||||
#include "z_zone.h"
|
||||
@ -136,7 +136,7 @@ void M_InitConfig(void)
|
||||
G_BindWeapVariables();
|
||||
WS_BindVariables();
|
||||
|
||||
HU_BindHUDVariables();
|
||||
ST_BindHUDVariables();
|
||||
ST_BindSTSVariables();
|
||||
AM_BindAutomapVariables();
|
||||
|
||||
|
114
src/m_json.c
@ -15,50 +15,79 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "doomtype.h"
|
||||
#include "i_printf.h"
|
||||
#include "m_misc.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "cjson/cJSON.h"
|
||||
|
||||
json_t *JS_Open(const char *type, version_t version, const char *data)
|
||||
boolean JS_GetVersion(json_t *json, version_t *version)
|
||||
{
|
||||
const char *s;
|
||||
json_t *js_version = JS_GetObject(json, "version");
|
||||
if (!JS_IsString(js_version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
json_t *json = cJSON_Parse(data);
|
||||
const char *string = JS_GetString(js_version);
|
||||
if (sscanf(string, "%d.%d.%d", &version->major, &version->minor,
|
||||
&version->revision) == 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
json_t *JS_Open(const char *lump, const char *type, version_t maxversion)
|
||||
{
|
||||
int lumpnum = W_CheckNumForName(lump);
|
||||
if (lumpnum < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
json_t *json = cJSON_Parse(W_CacheLumpNum(lumpnum, PU_CACHE));
|
||||
if (json == NULL)
|
||||
{
|
||||
I_Printf(VB_ERROR, "%s: error before %s", type, cJSON_GetErrorPtr());
|
||||
const char *error_ptr = cJSON_GetErrorPtr();
|
||||
if (error_ptr)
|
||||
{
|
||||
I_Printf(VB_ERROR, "%s: parsing error before %s", lump, error_ptr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
json_t *js_type = JS_GetObject(json, "type");
|
||||
if (!JS_IsString(js_type))
|
||||
{
|
||||
I_Printf(VB_ERROR, "%s: no type string", type);
|
||||
I_Printf(VB_ERROR, "%s: no type string", lump);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = JS_GetString(js_type);
|
||||
const char *s = JS_GetString(js_type);
|
||||
if (strcmp(s, type))
|
||||
{
|
||||
I_Printf(VB_ERROR, "%s: wrong type %s", type, s);
|
||||
I_Printf(VB_ERROR, "%s: wrong type %s", lump, s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
json_t *js_version = JS_GetObject(json, "version");
|
||||
if (!JS_IsString(js_version))
|
||||
{
|
||||
I_Printf(VB_ERROR, "%s: no version string", type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = JS_GetString(js_version);
|
||||
version_t v = {0};
|
||||
sscanf(s, "%d.%d.%d", &v.major, &v.minor, &v.revision);
|
||||
if (!(v.major == version.major && v.minor == version.minor
|
||||
&& v.revision == version.revision))
|
||||
if (!JS_GetVersion(json, &v))
|
||||
{
|
||||
I_Printf(VB_ERROR, "%s: unsupported version %d.%d.%d", type, v.major,
|
||||
v.minor, v.revision);
|
||||
I_Printf(VB_ERROR, "%s: no version string", lump);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((maxversion.major < v.major
|
||||
|| (maxversion.major <= v.major && maxversion.minor < v.minor)
|
||||
|| (maxversion.major <= v.major && maxversion.minor <= v.minor
|
||||
&& maxversion.revision < v.revision)))
|
||||
{
|
||||
I_Printf(VB_ERROR, "%s: max supported version %d.%d.%d", lump,
|
||||
maxversion.major, maxversion.minor, maxversion.revision);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -70,11 +99,21 @@ void JS_Close(json_t *json)
|
||||
cJSON_Delete(json);
|
||||
}
|
||||
|
||||
boolean JS_IsObject(json_t *json)
|
||||
{
|
||||
return cJSON_IsObject(json);
|
||||
}
|
||||
|
||||
boolean JS_IsNull(json_t *json)
|
||||
{
|
||||
return cJSON_IsNull(json);
|
||||
}
|
||||
|
||||
boolean JS_IsBoolean(json_t *json)
|
||||
{
|
||||
return cJSON_IsBool(json);
|
||||
}
|
||||
|
||||
boolean JS_IsNumber(json_t *json)
|
||||
{
|
||||
return cJSON_IsNumber(json);
|
||||
@ -105,11 +144,26 @@ json_t *JS_GetArrayItem(json_t *json, int index)
|
||||
return cJSON_GetArrayItem(json, index);
|
||||
}
|
||||
|
||||
boolean JS_GetBoolean(json_t *json)
|
||||
{
|
||||
return !!json->valueint;
|
||||
}
|
||||
|
||||
double JS_GetNumber(json_t *json)
|
||||
{
|
||||
return json->valuedouble;
|
||||
}
|
||||
|
||||
double JS_GetNumberValue(json_t *json, const char *string)
|
||||
{
|
||||
json_t *obj = JS_GetObject(json, string);
|
||||
if (JS_IsNumber(obj))
|
||||
{
|
||||
return obj->valuedouble;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JS_GetInteger(json_t *json)
|
||||
{
|
||||
return json->valueint;
|
||||
@ -119,3 +173,23 @@ const char *JS_GetString(json_t *json)
|
||||
{
|
||||
return json->valuestring;
|
||||
}
|
||||
|
||||
const char *JS_GetStringRef(json_t *json, const char *string)
|
||||
{
|
||||
json_t *obj = JS_GetObject(json, string);
|
||||
if (JS_IsString(obj))
|
||||
{
|
||||
return obj->valuestring;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *JS_GetStringCopy(json_t *json, const char *string)
|
||||
{
|
||||
json_t *obj = JS_GetObject(json, string);
|
||||
if (JS_IsString(obj))
|
||||
{
|
||||
return M_StringDuplicate(obj->valuestring);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
10
src/m_json.h
@ -25,19 +25,27 @@ typedef struct
|
||||
int revision;
|
||||
} version_t;
|
||||
|
||||
json_t *JS_Open(const char *type, version_t version, const char *data);
|
||||
boolean JS_GetVersion(json_t *json, version_t *version);
|
||||
|
||||
json_t *JS_Open(const char *lump, const char *type, version_t maxversion);
|
||||
void JS_Close(json_t *json);
|
||||
|
||||
json_t *JS_GetObject(json_t *json, const char *string);
|
||||
|
||||
boolean JS_IsObject(json_t *json);
|
||||
boolean JS_IsNull(json_t *json);
|
||||
boolean JS_IsBoolean(json_t *json);
|
||||
boolean JS_IsNumber(json_t *json);
|
||||
boolean JS_IsString(json_t *json);
|
||||
boolean JS_IsArray(json_t *json);
|
||||
|
||||
boolean JS_GetBoolean(json_t *json);
|
||||
double JS_GetNumber(json_t *json);
|
||||
double JS_GetNumberValue(json_t *json, const char *string);
|
||||
int JS_GetInteger(json_t *json);
|
||||
const char *JS_GetString(json_t *json);
|
||||
const char *JS_GetStringRef(json_t *json, const char *string);
|
||||
const char *JS_GetStringCopy(json_t *json, const char *string);
|
||||
|
||||
int JS_GetArraySize(json_t *json);
|
||||
json_t *JS_GetArrayItem(json_t *json, int index);
|
||||
|
@ -62,7 +62,6 @@ void MN_InitDefaults(void);
|
||||
extern const char *gamma_strings[];
|
||||
void MN_ResetGamma(void);
|
||||
void MN_DrawDelVerify(void);
|
||||
void MN_SizeDisplay(int choice);
|
||||
|
||||
boolean MN_SetupCursorPostion(int x, int y);
|
||||
boolean MN_SetupMouseResponder(int x, int y);
|
||||
|
@ -36,8 +36,6 @@
|
||||
#include "doomtype.h"
|
||||
#include "dstrings.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_lib.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_input.h"
|
||||
#include "i_printf.h"
|
||||
#include "i_system.h"
|
||||
@ -57,6 +55,9 @@
|
||||
#include "r_main.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "st_sbardef.h"
|
||||
#include "st_stuff.h"
|
||||
#include "st_widgets.h"
|
||||
#include "u_mapinfo.h"
|
||||
#include "v_fmt.h"
|
||||
#include "v_video.h"
|
||||
@ -76,10 +77,6 @@
|
||||
// int detailLevel; obsolete -- killough
|
||||
int screenblocks; // has default
|
||||
|
||||
int saved_screenblocks;
|
||||
|
||||
static int screenSize; // temp for screenblocks (0-9)
|
||||
|
||||
static int quickSaveSlot; // -1 = no quicksave slot picked!
|
||||
|
||||
static int messageToPrint; // 1 = message to be printed
|
||||
@ -102,8 +99,6 @@ static int saveCharIndex; // which char we're editing
|
||||
// old save description before edit
|
||||
static char saveOldString[SAVESTRINGSIZE];
|
||||
|
||||
boolean inhelpscreens; // indicates we are in or just left a help screen
|
||||
|
||||
boolean menuactive; // The menus are up
|
||||
|
||||
static boolean options_active;
|
||||
@ -333,9 +328,6 @@ static menu_t MainDef = {
|
||||
|
||||
static void M_DrawMainMenu(void)
|
||||
{
|
||||
// [crispy] force status bar refresh
|
||||
inhelpscreens = true;
|
||||
|
||||
options_active = false;
|
||||
|
||||
V_DrawPatch(94, 2, V_CachePatchName("M_DOOM", PU_CACHE));
|
||||
@ -441,8 +433,6 @@ static void M_FinishHelp(int choice) // killough 10/98
|
||||
|
||||
static void M_DrawReadThis1(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
V_DrawPatchFullScreen(V_CachePatchName("HELP2", PU_CACHE));
|
||||
}
|
||||
|
||||
@ -453,8 +443,6 @@ static void M_DrawReadThis1(void)
|
||||
|
||||
static void M_DrawReadThis2(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
// We only ever draw the second page if this is
|
||||
// gameversion == exe_doom_1_9 and gamemode == registered
|
||||
|
||||
@ -463,8 +451,6 @@ static void M_DrawReadThis2(void)
|
||||
|
||||
static void M_DrawReadThisCommercial(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
V_DrawPatchFullScreen(V_CachePatchName("HELP", PU_CACHE));
|
||||
}
|
||||
|
||||
@ -582,9 +568,6 @@ void M_AddEpisode(const char *map, const char *gfx, const char *txt,
|
||||
|
||||
static void M_DrawEpisode(void)
|
||||
{
|
||||
// [crispy] force status bar refresh
|
||||
inhelpscreens = true;
|
||||
|
||||
MN_DrawTitle(54, EpiDef.y - 25, "M_EPISOD", "Which Episode?");
|
||||
}
|
||||
|
||||
@ -656,9 +639,6 @@ static menu_t NewDef = {
|
||||
|
||||
static void M_DrawNewGame(void)
|
||||
{
|
||||
// [crispy] force status bar refresh
|
||||
inhelpscreens = true;
|
||||
|
||||
MN_DrawTitle(96, 14, "M_NEWG", "NEW GAME");
|
||||
MN_DrawTitle(54, 38, "M_SKILL", "Choose Skill Level:");
|
||||
}
|
||||
@ -933,9 +913,6 @@ static void M_DrawSaveLoadBottomLine(void)
|
||||
const int x = currentMenu->x;
|
||||
const int y = currentMenu->y + LINEHEIGHT * (currentMenu->numitems - 1);
|
||||
|
||||
// [crispy] force status bar refresh
|
||||
inhelpscreens = true;
|
||||
|
||||
int index = (menu_input == mouse_mode ? highlight_item : itemOn);
|
||||
|
||||
int flags = currentMenu->menuitems[index].flags;
|
||||
@ -1333,7 +1310,7 @@ void MN_SetQuickSaveSlot(int slot)
|
||||
// [FG] generate a default save slot name when the user saves to an empty slot
|
||||
static void SetDefaultSaveName(char *name, const char *append)
|
||||
{
|
||||
char *maplump = MAPNAME(gameepisode, gamemap);
|
||||
char *maplump = MapName(gameepisode, gamemap);
|
||||
int maplumpnum = W_CheckNumForName(maplump);
|
||||
|
||||
if (gamemapinfo && U_CheckField(gamemapinfo->label))
|
||||
@ -1793,8 +1770,6 @@ static void M_ChangeMessages(int choice)
|
||||
{
|
||||
displaymsg("%s", s_MSGON); // Ty 03/27/98 - externalized
|
||||
}
|
||||
|
||||
message_dontfuckwithme = true;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
@ -1806,33 +1781,21 @@ static void M_ChangeMessages(int choice)
|
||||
// hud_displayed is toggled by + or = in fullscreen
|
||||
// hud_displayed is cleared by -
|
||||
|
||||
void MN_SizeDisplay(int choice)
|
||||
static void M_SizeDisplay(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 0:
|
||||
if (screenSize > 0)
|
||||
{
|
||||
screenblocks--;
|
||||
screenSize--;
|
||||
hud_displayed = 0;
|
||||
}
|
||||
screenblocks--;
|
||||
break;
|
||||
case 1:
|
||||
if (screenSize < 8)
|
||||
{
|
||||
screenblocks++;
|
||||
screenSize++;
|
||||
}
|
||||
else
|
||||
{
|
||||
hud_displayed = !hud_displayed;
|
||||
HU_disable_all_widgets();
|
||||
}
|
||||
screenblocks++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
screenblocks = BETWEEN(3, 12, screenblocks);
|
||||
R_SetViewSize(screenblocks /*, detailLevel obsolete -- killough */);
|
||||
saved_screenblocks = screenblocks;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -1931,8 +1894,6 @@ static void M_ExtHelp(int choice)
|
||||
static void M_DrawExtHelp(void)
|
||||
{
|
||||
char namebfr[] = "HELPnn"; // [FG] char array!
|
||||
|
||||
inhelpscreens = true; // killough 5/1/98
|
||||
namebfr[4] = extended_help_index / 10 + 0x30;
|
||||
namebfr[5] = extended_help_index % 10 + 0x30;
|
||||
V_DrawPatchFullScreen(V_CachePatchName(namebfr, PU_CACHE));
|
||||
@ -1956,7 +1917,6 @@ static void M_DrawHelp(void)
|
||||
helplump = W_CheckNumForName("HELP1");
|
||||
}
|
||||
|
||||
inhelpscreens = true; // killough 10/98
|
||||
V_DrawPatchFullScreen(V_CachePatchNum(helplump, PU_CACHE));
|
||||
}
|
||||
|
||||
@ -2181,9 +2141,6 @@ static void M_Setup(int choice)
|
||||
|
||||
void MN_ClearMenus(void)
|
||||
{
|
||||
// force status bar refresh
|
||||
inhelpscreens = true;
|
||||
|
||||
menuactive = 0;
|
||||
options_active = false;
|
||||
print_warning_about_changes = 0; // killough 8/15/98
|
||||
@ -2270,8 +2227,6 @@ void M_Init(void)
|
||||
highlight_item = 0;
|
||||
whichSkull = 0;
|
||||
skullAnimCounter = 10;
|
||||
saved_screenblocks = screenblocks;
|
||||
screenSize = screenblocks - 3;
|
||||
messageToPrint = 0;
|
||||
messageString = NULL;
|
||||
messageLastMenuActive = menuactive;
|
||||
@ -2552,7 +2507,7 @@ boolean M_ShortcutResponder(const event_t *ev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MN_SizeDisplay(0);
|
||||
M_SizeDisplay(0);
|
||||
M_StartSound(sfx_stnmov);
|
||||
return true;
|
||||
}
|
||||
@ -2563,7 +2518,7 @@ boolean M_ShortcutResponder(const event_t *ev)
|
||||
{ // key_hud==key_zoomin
|
||||
return false;
|
||||
}
|
||||
MN_SizeDisplay(1);
|
||||
M_SizeDisplay(1);
|
||||
M_StartSound(sfx_stnmov);
|
||||
return true;
|
||||
}
|
||||
@ -2575,19 +2530,20 @@ boolean M_ShortcutResponder(const event_t *ev)
|
||||
return false; // HUD mode control
|
||||
}
|
||||
|
||||
if (screenSize < 8) // function on default F5
|
||||
if (screenblocks < 10)
|
||||
{
|
||||
while (screenSize < 8 || !hud_displayed) // make hud visible
|
||||
{
|
||||
MN_SizeDisplay(1); // when configuring it
|
||||
}
|
||||
screenblocks = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
hud_displayed = 1; // jff 3/3/98 turn hud on
|
||||
hud_active = (hud_active + 1) % 3; // cycle hud_active
|
||||
HU_disable_all_widgets();
|
||||
++screenblocks;
|
||||
if (screenblocks > 12)
|
||||
{
|
||||
screenblocks = 10;
|
||||
}
|
||||
}
|
||||
|
||||
R_SetViewSize(screenblocks);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3467,7 +3423,6 @@ void M_Drawer(void)
|
||||
|
||||
if (MN_MenuIsShaded())
|
||||
{
|
||||
inhelpscreens = true;
|
||||
V_ShadeScreen();
|
||||
}
|
||||
|
||||
|
@ -97,8 +97,6 @@ void MN_InitMenuStrings(void);
|
||||
|
||||
boolean MN_StartsWithMapIdentifier(char *str);
|
||||
|
||||
extern boolean inhelpscreens;
|
||||
|
||||
int MN_GetPixelWidth(const char *ch);
|
||||
void MN_DrawString(int cx, int cy, int color, const char *ch);
|
||||
|
||||
|
152
src/mn_setup.c
@ -13,6 +13,7 @@
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
|
||||
#include "hu_command.h"
|
||||
#include "mn_internal.h"
|
||||
|
||||
#include "am_map.h"
|
||||
@ -23,8 +24,6 @@
|
||||
#include "doomtype.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_crosshair.h"
|
||||
#include "hu_lib.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_gamepad.h"
|
||||
#include "i_gyro.h"
|
||||
#include "i_input.h"
|
||||
@ -53,7 +52,10 @@
|
||||
#include "r_sky.h" // [FG] R_InitSkyMap()
|
||||
#include "r_voxel.h"
|
||||
#include "s_sound.h"
|
||||
#include "st_sbardef.h"
|
||||
#include "st_stuff.h"
|
||||
#include "sounds.h"
|
||||
#include "st_widgets.h"
|
||||
#include "v_fmt.h"
|
||||
#include "v_video.h"
|
||||
#include "w_wad.h"
|
||||
@ -317,8 +319,7 @@ enum
|
||||
str_curve,
|
||||
str_center_weapon,
|
||||
str_screensize,
|
||||
str_hudtype,
|
||||
str_hudmode,
|
||||
str_stlayout,
|
||||
str_show_widgets,
|
||||
str_show_adv_widgets,
|
||||
str_stats_format,
|
||||
@ -1510,8 +1511,6 @@ void MN_KeyBindings(int choice)
|
||||
|
||||
void MN_DrawKeybnd(void)
|
||||
{
|
||||
inhelpscreens = true; // killough 4/6/98: Force status bar redraw
|
||||
|
||||
// Set up the Key Binding screen
|
||||
|
||||
DrawBackground("FLOOR4_6"); // Draw background
|
||||
@ -1771,8 +1770,6 @@ void MN_Weapons(int choice)
|
||||
|
||||
void MN_DrawWeapons(void)
|
||||
{
|
||||
inhelpscreens = true; // killough 4/6/98: Force status bar redraw
|
||||
|
||||
DrawBackground("FLOOR4_6"); // Draw background
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_WEAP", "Weapons");
|
||||
DrawTabs();
|
||||
@ -1802,43 +1799,23 @@ static setup_tab_t stat_tabs[] = {
|
||||
|
||||
static void SizeDisplayAlt(void)
|
||||
{
|
||||
int choice = -1;
|
||||
R_SetViewSize(screenblocks);
|
||||
}
|
||||
|
||||
if (screenblocks > saved_screenblocks)
|
||||
{
|
||||
choice = 1;
|
||||
}
|
||||
else if (screenblocks < saved_screenblocks)
|
||||
{
|
||||
choice = 0;
|
||||
}
|
||||
|
||||
screenblocks = saved_screenblocks;
|
||||
|
||||
if (choice != -1)
|
||||
{
|
||||
MN_SizeDisplay(choice);
|
||||
}
|
||||
|
||||
hud_displayed = (screenblocks == 11);
|
||||
static void RefreshSolidBackground(void)
|
||||
{
|
||||
st_refresh_background = true;
|
||||
}
|
||||
|
||||
static const char *screensize_strings[] = {
|
||||
"", "", "", "Status Bar",
|
||||
"Status Bar", "Status Bar", "Status Bar", "Status Bar",
|
||||
"Status Bar", "Status Bar", "Status Bar", "Fullscreen"
|
||||
"", "", "", "Status Bar", "Status Bar",
|
||||
"Status Bar", "Status Bar", "Status Bar", "Status Bar", "Status Bar",
|
||||
"Status Bar", "Fullscreen", "Fullscreen"
|
||||
};
|
||||
|
||||
static const char *hudtype_strings[] = {"Crispy", "Boom No Bars", "Boom"};
|
||||
|
||||
static const char **GetHUDModeStrings(void)
|
||||
{
|
||||
static const char *crispy_strings[] = {"Off", "Original", "Widescreen"};
|
||||
static const char *boom_strings[] = {"Minimal", "Compact", "Distributed"};
|
||||
return hud_type ? boom_strings : crispy_strings;
|
||||
}
|
||||
|
||||
static void UpdateHUDModeStrings(void);
|
||||
static const char *st_layout_strings[] = {
|
||||
"Original", "Wide"
|
||||
};
|
||||
|
||||
#define H_X_THRM8 (M_X_THRM8 - 14)
|
||||
#define H_X (M_X - 14)
|
||||
@ -1850,34 +1827,24 @@ static setup_menu_t stat_settings1[] = {
|
||||
|
||||
MI_GAP,
|
||||
|
||||
{"Layout", S_CHOICE, H_X, M_SPC, {"st_layout"},
|
||||
.strings_id = str_stlayout},
|
||||
|
||||
MI_GAP,
|
||||
|
||||
{"Status Bar", S_SKIP | S_TITLE, H_X, M_SPC},
|
||||
|
||||
{"Colored Numbers", S_ONOFF | S_COSMETIC, H_X, M_SPC, {"sts_colored_numbers"}},
|
||||
|
||||
{"Gray Percent Sign", S_ONOFF | S_COSMETIC, H_X, M_SPC, {"sts_pct_always_gray"}},
|
||||
|
||||
{"Solid Background Color", S_ONOFF, H_X, M_SPC, {"st_solidbackground"}},
|
||||
|
||||
MI_GAP,
|
||||
|
||||
{"Fullscreen HUD", S_SKIP | S_TITLE, H_X, M_SPC},
|
||||
|
||||
{"HUD Type", S_CHOICE, H_X, M_SPC, {"hud_type"},
|
||||
.strings_id = str_hudtype, .action = UpdateHUDModeStrings},
|
||||
|
||||
{"HUD Mode", S_CHOICE, H_X, M_SPC, {"hud_active"},
|
||||
.strings_id = str_hudmode},
|
||||
|
||||
MI_GAP,
|
||||
|
||||
{"Backpack Shifts Ammo Color", S_ONOFF, H_X, M_SPC, {"hud_backpack_thresholds"}},
|
||||
{"Solid Background Color", S_ONOFF, H_X, M_SPC, {"st_solidbackground"},
|
||||
.action = RefreshSolidBackground},
|
||||
|
||||
{"Armor Color Matches Type", S_ONOFF, H_X, M_SPC, {"hud_armor_type"}},
|
||||
|
||||
{"Animated Health/Armor Count", S_ONOFF, H_X, M_SPC, {"hud_animated_counts"}},
|
||||
|
||||
{"Blink Missing Keys", S_ONOFF, H_X, M_SPC, {"hud_blink_keys"}},
|
||||
|
||||
MI_RESET,
|
||||
|
||||
MI_END
|
||||
@ -1904,29 +1871,15 @@ static setup_menu_t stat_settings2[] = {
|
||||
.strings_id = str_show_widgets},
|
||||
|
||||
{"Show Player Coords", S_CHOICE | S_STRICT, H_X, M_SPC,
|
||||
{"hud_player_coords"}, .strings_id = str_show_adv_widgets,
|
||||
.action = HU_Start},
|
||||
{"hud_player_coords"}, .strings_id = str_show_adv_widgets},
|
||||
|
||||
{"Show Command History", S_ONOFF | S_STRICT, H_X, M_SPC,
|
||||
{"hud_command_history"}, .action = HU_ResetCommandHistory},
|
||||
|
||||
{"Use-Button Timer", S_ONOFF, H_X, M_SPC, {"hud_time_use"}},
|
||||
|
||||
MI_GAP,
|
||||
|
||||
{"Widget Appearance", S_SKIP | S_TITLE, H_X, M_SPC},
|
||||
|
||||
{"Level Stats Format", S_CHOICE, H_X, M_SPC, {"hud_stats_format"},
|
||||
.strings_id = str_stats_format, .action = HU_Start},
|
||||
|
||||
{"Use Doom Font", S_CHOICE, H_X, M_SPC, {"hud_widget_font"},
|
||||
.strings_id = str_show_widgets},
|
||||
|
||||
{"Widescreen Alignment", S_ONOFF, H_X, M_SPC, {"hud_widescreen_widgets"},
|
||||
.action = HU_Start},
|
||||
|
||||
{"Vertical Layout", S_ONOFF, H_X, M_SPC, {"hud_widget_layout"},
|
||||
.action = HU_Start},
|
||||
.strings_id = str_stats_format},
|
||||
|
||||
MI_END
|
||||
};
|
||||
@ -1974,9 +1927,8 @@ static setup_menu_t stat_settings4[] = {
|
||||
{"Show Toggle Messages", S_ONOFF, H_X, M_SPC, {"show_toggle_messages"}},
|
||||
{"Show Pickup Messages", S_ONOFF, H_X, M_SPC, {"show_pickup_messages"}},
|
||||
{"Show Obituaries", S_ONOFF, H_X, M_SPC, {"show_obituary_messages"}},
|
||||
{"Center Messages", S_ONOFF, H_X, M_SPC, {"message_centered"}},
|
||||
{"Colorize Messages", S_ONOFF, H_X, M_SPC, {"message_colorized"},
|
||||
.action = HU_ResetMessageColors},
|
||||
.action = ST_ResetMessageColors},
|
||||
MI_END
|
||||
};
|
||||
|
||||
@ -1997,6 +1949,8 @@ static void UpdateCrosshairItems(void)
|
||||
DisableItem(
|
||||
!(hud_crosshair && hud_crosshair_target == crosstarget_highlight),
|
||||
stat_settings3, "hud_crosshair_target_color");
|
||||
|
||||
HU_StartCrosshair();
|
||||
}
|
||||
|
||||
// Setting up for the Status Bar / HUD screen. Turn on flags, set pointers,
|
||||
@ -2018,8 +1972,6 @@ void MN_StatusBar(int choice)
|
||||
|
||||
void MN_DrawStatusHUD(void)
|
||||
{
|
||||
inhelpscreens = true; // killough 4/6/98: Force status bar redraw
|
||||
|
||||
DrawBackground("FLOOR4_6"); // Draw background
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_STAT", "Status Bar/HUD");
|
||||
DrawTabs();
|
||||
@ -2111,8 +2063,6 @@ void MN_Automap(int choice)
|
||||
|
||||
void MN_DrawAutoMap(void)
|
||||
{
|
||||
inhelpscreens = true; // killough 4/6/98: Force status bar redraw
|
||||
|
||||
DrawBackground("FLOOR4_6"); // Draw background
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_AUTO", "Automap");
|
||||
DrawInstructions();
|
||||
@ -2191,8 +2141,6 @@ void MN_Enemy(int choice)
|
||||
|
||||
void MN_DrawEnemy(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
DrawBackground("FLOOR4_6"); // Draw background
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_ENEM", "Enemies");
|
||||
DrawInstructions();
|
||||
@ -2292,8 +2240,6 @@ void MN_Compat(int choice)
|
||||
|
||||
void MN_DrawCompat(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
DrawBackground("FLOOR4_6"); // Draw background
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_COMPAT", "Compatibility");
|
||||
DrawInstructions();
|
||||
@ -2684,10 +2630,9 @@ static void MN_Midi(void)
|
||||
current_tabs = midi_tabs;
|
||||
SetupMenuSecondary();
|
||||
}
|
||||
|
||||
void MN_DrawMidi(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
DrawBackground("FLOOR4_6");
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
|
||||
DrawTabs();
|
||||
@ -2775,8 +2720,6 @@ static void MN_Equalizer(void)
|
||||
|
||||
void MN_DrawEqualizer(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
DrawBackground("FLOOR4_6");
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
|
||||
DrawTabs();
|
||||
@ -3033,8 +2976,6 @@ static void MN_PadAdv(void)
|
||||
|
||||
void MN_DrawPadAdv(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
DrawBackground("FLOOR4_6");
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
|
||||
DrawTabs();
|
||||
@ -3226,8 +3167,6 @@ static void MN_Gyro(void)
|
||||
|
||||
void MN_DrawGyro(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
DrawBackground("FLOOR4_6");
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
|
||||
DrawTabs();
|
||||
@ -3392,8 +3331,6 @@ void MN_General(int choice)
|
||||
|
||||
void MN_DrawGeneral(void)
|
||||
{
|
||||
inhelpscreens = true;
|
||||
|
||||
DrawBackground("FLOOR4_6"); // Draw background
|
||||
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
|
||||
DrawTabs();
|
||||
@ -3686,21 +3623,18 @@ void MN_DrawStringCR(int cx, int cy, byte *cr1, byte *cr2, const char *ch)
|
||||
{
|
||||
c = *ch++; // get next char
|
||||
|
||||
if (c == '\x1b')
|
||||
if (c == '\x1b' && *ch)
|
||||
{
|
||||
if (ch)
|
||||
c = *ch++;
|
||||
if (c >= '0' && c <= '0' + CR_NONE)
|
||||
{
|
||||
c = *ch++;
|
||||
if (c >= '0' && c <= '0' + CR_NONE)
|
||||
{
|
||||
cr = colrngs[c - '0'];
|
||||
}
|
||||
else if (c == '0' + CR_ORIG)
|
||||
{
|
||||
cr = cr1;
|
||||
}
|
||||
continue;
|
||||
cr = colrngs[c - '0'];
|
||||
}
|
||||
else if (c == '0' + CR_ORIG)
|
||||
{
|
||||
cr = cr1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
c = M_ToUpper(c) - HU_FONTSTART;
|
||||
@ -4480,7 +4414,6 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
|
||||
set_weapon_active = false;
|
||||
default_verify = false; // phares 4/19/98
|
||||
print_warning_about_changes = false; // [FG] reset
|
||||
HU_Start(); // catch any message changes // phares 4/19/98
|
||||
M_StartSound(sfx_swtchx);
|
||||
return true;
|
||||
}
|
||||
@ -4797,8 +4730,7 @@ static const char **selectstrings[] = {
|
||||
curve_strings,
|
||||
center_weapon_strings,
|
||||
screensize_strings,
|
||||
hudtype_strings,
|
||||
NULL, // str_hudmode
|
||||
st_layout_strings,
|
||||
show_widgets_strings,
|
||||
show_adv_widgets_strings,
|
||||
stats_format_strings,
|
||||
@ -4845,11 +4777,6 @@ static const char **GetStrings(int id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void UpdateHUDModeStrings(void)
|
||||
{
|
||||
selectstrings[str_hudmode] = GetHUDModeStrings();
|
||||
}
|
||||
|
||||
static void UpdateWeaponSlotStrings(void)
|
||||
{
|
||||
selectstrings[str_weapon_slots] = GetWeaponSlotStrings();
|
||||
@ -4862,7 +4789,6 @@ static const char **GetMidiPlayerStrings(void)
|
||||
|
||||
void MN_InitMenuStrings(void)
|
||||
{
|
||||
UpdateHUDModeStrings();
|
||||
UpdateWeaponSlotLabels();
|
||||
UpdateWeaponSlotStrings();
|
||||
selectstrings[str_resolution_scale] = GetResolutionScaleStrings();
|
||||
|
@ -259,7 +259,6 @@ int EV_DoLockedDoor(line_t *line, vldoor_e type, mobj_t *thing)
|
||||
{
|
||||
doomprintf(p, MESSAGES_NONE, "%s", s_PD_BLUEO); // Ty 03/27/98 - externalized
|
||||
S_StartSound(p->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(p, KEYBLINK_EITHER, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -270,7 +269,6 @@ int EV_DoLockedDoor(line_t *line, vldoor_e type, mobj_t *thing)
|
||||
{
|
||||
doomprintf(p, MESSAGES_NONE, "%s", s_PD_REDO); // Ty 03/27/98 - externalized
|
||||
S_StartSound(p->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(p, KEYBLINK_NONE, KEYBLINK_NONE, KEYBLINK_EITHER);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -281,7 +279,6 @@ int EV_DoLockedDoor(line_t *line, vldoor_e type, mobj_t *thing)
|
||||
{
|
||||
doomprintf(p, MESSAGES_NONE, "%s", s_PD_YELLOWO); // Ty 03/27/98 - externalized
|
||||
S_StartSound(p->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(p, KEYBLINK_NONE, KEYBLINK_EITHER, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -409,7 +406,6 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_BLUEK); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_EITHER, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -422,7 +418,6 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_YELLOWK); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_EITHER, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -435,7 +430,6 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_REDK); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_NONE, KEYBLINK_EITHER);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
33
src/p_mobj.c
@ -25,7 +25,6 @@
|
||||
#include "doomstat.h"
|
||||
#include "dsdhacked.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_printf.h"
|
||||
#include "info.h"
|
||||
#include "m_random.h"
|
||||
@ -1143,7 +1142,6 @@ void P_SpawnPlayer (mapthing_t* mthing)
|
||||
if (mthing->type-1 == consoleplayer)
|
||||
{
|
||||
ST_Start(); // wake up the status bar
|
||||
HU_Start(); // wake up the heads up text
|
||||
}
|
||||
}
|
||||
|
||||
@ -1329,37 +1327,6 @@ spawnit:
|
||||
{
|
||||
mobj->health = 1000 + musid;
|
||||
}
|
||||
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
switch (mobj->sprite)
|
||||
{
|
||||
case SPR_BKEY:
|
||||
st_keyorskull[it_bluecard] |= KEYBLINK_CARD;
|
||||
break;
|
||||
|
||||
case SPR_BSKU:
|
||||
st_keyorskull[it_bluecard] |= KEYBLINK_SKULL;
|
||||
break;
|
||||
|
||||
case SPR_RKEY:
|
||||
st_keyorskull[it_redcard] |= KEYBLINK_CARD;
|
||||
break;
|
||||
|
||||
case SPR_RSKU:
|
||||
st_keyorskull[it_redcard] |= KEYBLINK_SKULL;
|
||||
break;
|
||||
|
||||
case SPR_YKEY:
|
||||
st_keyorskull[it_yellowcard] |= KEYBLINK_CARD;
|
||||
break;
|
||||
|
||||
case SPR_YSKU:
|
||||
st_keyorskull[it_yellowcard] |= KEYBLINK_SKULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1604,7 +1604,7 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
|
||||
// W_Reload (); killough 1/31/98: W_Reload obsolete
|
||||
|
||||
// find map name
|
||||
strcpy(lumpname, MAPNAME(episode, map));
|
||||
strcpy(lumpname, MapName(episode, map));
|
||||
|
||||
lumpnum = W_GetNumForName(lumpname);
|
||||
|
||||
@ -1662,8 +1662,6 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
|
||||
|
||||
// [crispy] fix long wall wobble
|
||||
P_SegLengths(false);
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
memset(st_keyorskull, 0, sizeof(st_keyorskull));
|
||||
|
||||
// Note: you don't need to clear player queue slots --
|
||||
// a much simpler fix is in g_game.c -- killough 10/98
|
||||
|
11
src/p_spec.c
@ -35,7 +35,6 @@
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_obituary.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "i_system.h"
|
||||
#include "info.h"
|
||||
#include "m_argv.h"
|
||||
@ -61,6 +60,7 @@
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "st_stuff.h"
|
||||
#include "st_widgets.h"
|
||||
#include "tables.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
@ -817,7 +817,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_ANY); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_EITHER, KEYBLINK_EITHER, KEYBLINK_EITHER);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -827,7 +826,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_REDK : s_PD_REDC); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_CARD);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -837,7 +835,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_BLUEK : s_PD_BLUEC); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, skulliscard ? KEYBLINK_EITHER : KEYBLINK_CARD, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -847,7 +844,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_YELLOWK : s_PD_YELLOWC); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_CARD, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -857,7 +853,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_REDK : s_PD_REDS); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_SKULL);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -867,7 +862,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_BLUEK : s_PD_BLUES); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, skulliscard ? KEYBLINK_EITHER : KEYBLINK_SKULL, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -877,7 +871,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_YELLOWK : s_PD_YELLOWS); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_SKULL, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -892,7 +885,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_ALL6); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_BOTH, KEYBLINK_BOTH, KEYBLINK_BOTH);
|
||||
return false;
|
||||
}
|
||||
if (skulliscard &&
|
||||
@ -904,7 +896,6 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_ALL3); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_EITHER, KEYBLINK_EITHER, KEYBLINK_EITHER);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
54
src/p_user.c
@ -28,7 +28,6 @@
|
||||
#include "doomstat.h"
|
||||
#include "doomtype.h"
|
||||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "info.h"
|
||||
#include "m_cheat.h"
|
||||
#include "p_map.h"
|
||||
@ -39,6 +38,7 @@
|
||||
#include "r_defs.h"
|
||||
#include "r_main.h"
|
||||
#include "st_stuff.h"
|
||||
#include "st_widgets.h"
|
||||
|
||||
static fixed_t PlayerSlope(player_t *player)
|
||||
{
|
||||
@ -591,6 +591,58 @@ void P_PlayerThink (player_t* player)
|
||||
player->powers[pw_infrared] > 4*32 || player->powers[pw_infrared] & 8;
|
||||
}
|
||||
|
||||
boolean P_EvaluateItemOwned(itemtype_t item, player_t *player)
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case item_bluecard:
|
||||
case item_yellowcard:
|
||||
case item_redcard:
|
||||
case item_blueskull:
|
||||
case item_yellowskull:
|
||||
case item_redskull:
|
||||
return player->cards[item - item_bluecard] != 0;
|
||||
|
||||
case item_backpack:
|
||||
return player->backpack;
|
||||
|
||||
case item_greenarmor:
|
||||
case item_bluearmor:
|
||||
return player->armortype == (item - item_greenarmor + 1);
|
||||
|
||||
case item_areamap:
|
||||
return player->powers[pw_allmap] != 0;
|
||||
|
||||
case item_lightamp:
|
||||
return player->powers[pw_infrared] != 0;
|
||||
|
||||
case item_berserk:
|
||||
return player->powers[pw_strength] != 0;
|
||||
|
||||
case item_invisibility:
|
||||
return player->powers[pw_invisibility] != 0;
|
||||
|
||||
case item_radsuit:
|
||||
return player->powers[pw_ironfeet] != 0;
|
||||
|
||||
case item_invulnerability:
|
||||
return player->powers[pw_invulnerability] != 0;
|
||||
|
||||
case item_healthbonus:
|
||||
case item_stimpack:
|
||||
case item_medikit:
|
||||
case item_soulsphere:
|
||||
case item_megasphere:
|
||||
case item_armorbonus:
|
||||
case item_noitem:
|
||||
case item_messageonly:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log: p_user.c,v $
|
||||
|
@ -22,6 +22,7 @@
|
||||
#ifndef __P_USER__
|
||||
#define __P_USER__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "m_fixed.h"
|
||||
#include "tables.h"
|
||||
|
||||
@ -51,6 +52,8 @@ typedef enum
|
||||
|
||||
extern death_use_state_t death_use_state;
|
||||
|
||||
boolean P_EvaluateItemOwned(itemtype_t item, struct player_s *player);
|
||||
|
||||
extern boolean onground; // whether player is on ground or in air
|
||||
|
||||
#endif // __P_USER__
|
||||
|
@ -58,6 +58,7 @@ static const char *params[] = {
|
||||
|
||||
static const char *params_with_args[] = {
|
||||
"-config",
|
||||
"-dumptranmap",
|
||||
"-file",
|
||||
"-iwad",
|
||||
"-save",
|
||||
|
19
src/r_data.c
@ -1044,6 +1044,25 @@ void R_InitTranMap(int progress)
|
||||
Z_ChangeTag(playpal, PU_CACHE);
|
||||
free(fname);
|
||||
}
|
||||
|
||||
//!
|
||||
// @category mod
|
||||
// @arg <name>
|
||||
//
|
||||
// Dump tranmap lump.
|
||||
//
|
||||
|
||||
int p = M_CheckParmWithArgs("-dumptranmap", 1);
|
||||
if (p > 0)
|
||||
{
|
||||
char *path = malloc(strlen(myargv[p + 1]) + 5);
|
||||
strcpy(path, myargv[p + 1]);
|
||||
AddDefaultExtension(path, ".lmp");
|
||||
|
||||
M_WriteFile(path, main_tranmap, 256 * 256);
|
||||
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -549,7 +549,7 @@ int setblocks;
|
||||
void R_SetViewSize(int blocks)
|
||||
{
|
||||
setsizeneeded = true;
|
||||
setblocks = blocks;
|
||||
setblocks = MIN(blocks, 11);
|
||||
}
|
||||
|
||||
//
|
||||
@ -673,8 +673,7 @@ void R_ExecuteSetViewSize (void)
|
||||
}
|
||||
}
|
||||
|
||||
// [crispy] forcefully initialize the status bar backing screen
|
||||
ST_refreshBackground();
|
||||
st_refresh_background = true;
|
||||
|
||||
pspr_interp = false;
|
||||
}
|
||||
@ -1032,7 +1031,7 @@ void R_BindRenderVariables(void)
|
||||
BIND_NUM_GENERAL(invul_mode, INVUL_MBF, INVUL_VANILLA, INVUL_GRAY,
|
||||
"Invulnerability effect (0 = Vanilla; 1 = MBF; 2 = Gray)");
|
||||
BIND_BOOL(flashing_hom, true, "Enable flashing of the HOM indicator");
|
||||
BIND_NUM(screenblocks, 10, 3, 11, "Size of game-world screen");
|
||||
BIND_NUM(screenblocks, 10, 3, 12, "Size of game-world screen");
|
||||
|
||||
M_BindBool("translucency", &translucency, NULL, true, ss_gen, wad_yes,
|
||||
"Translucency for some things");
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "m_fixed.h"
|
||||
#include "m_json.h"
|
||||
#include "m_misc.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
static boolean ParseFire(json_t *json, fire_t *out)
|
||||
{
|
||||
@ -130,23 +129,16 @@ static boolean ParseFlatMap(json_t *json, flatmap_t *out)
|
||||
|
||||
skydefs_t *R_ParseSkyDefs(void)
|
||||
{
|
||||
int lumpnum = W_CheckNumForName("SKYDEFS");
|
||||
if (lumpnum < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
json_t *json = JS_Open("skydefs", (version_t){1, 0, 0},
|
||||
W_CacheLumpNum(lumpnum, PU_CACHE));
|
||||
json_t *json = JS_Open("SKYDEFS", "skydefs", (version_t){1, 0, 0});
|
||||
if (json == NULL)
|
||||
{
|
||||
JS_Close(json);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
json_t *data = JS_GetObject(json, "data");
|
||||
if (JS_IsNull(data))
|
||||
if (JS_IsNull(data) || !JS_IsObject(data))
|
||||
{
|
||||
I_Printf(VB_ERROR, "SBARDEF: no data");
|
||||
JS_Close(json);
|
||||
return NULL;
|
||||
}
|
||||
|
295
src/st_lib.c
@ -1,295 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 1999 by
|
||||
// id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// The status bar widget code.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "st_lib.h"
|
||||
|
||||
#include "m_swap.h"
|
||||
#include "r_defs.h"
|
||||
#include "v_video.h"
|
||||
#include "v_fmt.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
boolean sts_colored_numbers; //jff 2/18/98 control to disable status color changes
|
||||
boolean sts_pct_always_gray; // killough 2/21/98: always gray %'s? bug or feature?
|
||||
|
||||
patch_t* sttminus;
|
||||
|
||||
//
|
||||
// STlib_init()
|
||||
//
|
||||
// Hack display negative frags. Loads and store the stminus lump.
|
||||
//
|
||||
// Passed nothing, returns nothing
|
||||
//
|
||||
void STlib_init(void)
|
||||
{
|
||||
// [FG] allow playing with the Doom v1.2 IWAD which is missing the STTMINUS lump
|
||||
if (W_CheckNumForName("STTMINUS") >= 0)
|
||||
sttminus = V_CachePatchName("STTMINUS", PU_STATIC);
|
||||
else
|
||||
sttminus = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// STlib_initNum()
|
||||
//
|
||||
// Initializes an st_number_t widget
|
||||
//
|
||||
// Passed the widget, its position, the patches for the digits, a pointer
|
||||
// to the value displayed, a pointer to the on/off control, and the width
|
||||
// Returns nothing
|
||||
//
|
||||
void STlib_initNum
|
||||
( st_number_t* n,
|
||||
int x,
|
||||
int y,
|
||||
patch_t** pl,
|
||||
int* num,
|
||||
boolean* on,
|
||||
int width )
|
||||
{
|
||||
n->x = x;
|
||||
n->y = y;
|
||||
n->oldnum = 0;
|
||||
n->width = width;
|
||||
n->num = num;
|
||||
n->on = on;
|
||||
n->p = pl;
|
||||
}
|
||||
|
||||
//
|
||||
// STlib_drawNum()
|
||||
//
|
||||
// A fairly efficient way to draw a number based on differences from the
|
||||
// old number.
|
||||
//
|
||||
// Passed a st_number_t widget and a color range for output.
|
||||
// Returns nothing
|
||||
//
|
||||
static void STlib_drawNum
|
||||
( st_number_t* n,
|
||||
byte *outrng ) //jff 2/16/98 add color translation to digit output
|
||||
{
|
||||
int numdigits = n->width;
|
||||
int num = *n->num;
|
||||
|
||||
int w = SHORT(n->p[0]->width);
|
||||
int x = n->x;
|
||||
|
||||
int neg;
|
||||
|
||||
n->oldnum = *n->num;
|
||||
|
||||
neg = num < 0;
|
||||
|
||||
if (neg)
|
||||
{
|
||||
if (numdigits == 2 && num < -9)
|
||||
num = -9;
|
||||
else if (numdigits == 3 && num < -99)
|
||||
num = -99;
|
||||
|
||||
num = -num;
|
||||
}
|
||||
|
||||
// if non-number, do not draw it
|
||||
if (num == LARGENUMBER)
|
||||
return;
|
||||
|
||||
//jff 2/16/98 add color translation to digit output
|
||||
// in the special case of 0, you draw 0
|
||||
if (!num)
|
||||
{
|
||||
if (outrng && sts_colored_numbers)
|
||||
V_DrawPatchTranslated(x - w, n->y, n->p[ 0 ],outrng);
|
||||
else //jff 2/18/98 allow use of faster draw routine from config
|
||||
V_DrawPatch(x - w, n->y, n->p[ 0 ]);
|
||||
}
|
||||
|
||||
// draw the new number
|
||||
//jff 2/16/98 add color translation to digit output
|
||||
while (num && numdigits--)
|
||||
{
|
||||
x -= w;
|
||||
if (outrng && sts_colored_numbers)
|
||||
V_DrawPatchTranslated(x, n->y, n->p[ num % 10 ],outrng);
|
||||
else //jff 2/18/98 allow use of faster draw routine from config
|
||||
V_DrawPatch(x, n->y, n->p[ num % 10 ]);
|
||||
num /= 10;
|
||||
}
|
||||
|
||||
// draw a minus sign if necessary
|
||||
//jff 2/16/98 add color translation to digit output
|
||||
if (neg && sttminus)
|
||||
{
|
||||
w = SHORT(sttminus->width);
|
||||
if (outrng && sts_colored_numbers)
|
||||
V_DrawPatchTranslated(x - w, n->y, sttminus,outrng);
|
||||
else //jff 2/18/98 allow use of faster draw routine from config
|
||||
V_DrawPatch(x - w, n->y, sttminus);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// STlib_updateNum()
|
||||
//
|
||||
// Draws a number conditionally based on the widget's enable
|
||||
//
|
||||
// Passed a number widget and the output color range
|
||||
// Returns nothing
|
||||
//
|
||||
void STlib_updateNum
|
||||
( st_number_t* n,
|
||||
byte *outrng ) //jff 2/16/98 add color translation to digit output
|
||||
{
|
||||
if (*n->on) STlib_drawNum(n, outrng);
|
||||
}
|
||||
|
||||
//
|
||||
// STlib_initPercent()
|
||||
//
|
||||
// Initialize a st_percent_t number with percent sign widget
|
||||
//
|
||||
// Passed a st_percent_t widget, the position, the digit patches, a pointer
|
||||
// to the number to display, a pointer to the enable flag, and patch
|
||||
// for the percent sign.
|
||||
// Returns nothing.
|
||||
//
|
||||
void STlib_initPercent
|
||||
( st_percent_t* p,
|
||||
int x,
|
||||
int y,
|
||||
patch_t** pl,
|
||||
int* num,
|
||||
boolean* on,
|
||||
patch_t* percent )
|
||||
{
|
||||
STlib_initNum(&p->n, x, y, pl, num, on, 3);
|
||||
p->p = percent;
|
||||
}
|
||||
|
||||
//
|
||||
// STlib_updatePercent()
|
||||
//
|
||||
// Draws a number/percent conditionally based on the widget's enable
|
||||
//
|
||||
// Passed a precent widget and the output color range
|
||||
// Returns nothing
|
||||
//
|
||||
void STlib_updatePercent
|
||||
( st_percent_t* per,
|
||||
byte *outrng ) //jff 2/16/98 add color translation to digit output
|
||||
{
|
||||
// Remove the check for 'refresh' because this causes percent symbols to always appear
|
||||
// in automap overlay mode.
|
||||
if (*per->n.on) // killough 2/21/98: fix percents not updated;
|
||||
{
|
||||
V_DrawPatchTranslated
|
||||
(
|
||||
per->n.x,
|
||||
per->n.y,
|
||||
per->p,
|
||||
// [FG] fix always gray percent / always red mismatch
|
||||
sts_pct_always_gray ? cr_gray :
|
||||
!sts_colored_numbers ? NULL :
|
||||
outrng
|
||||
);
|
||||
}
|
||||
|
||||
STlib_updateNum(&per->n, outrng);
|
||||
}
|
||||
|
||||
//
|
||||
// STlib_initMultIcon()
|
||||
//
|
||||
// Initialize a st_multicon_t widget, used for a multigraphic display
|
||||
// like the status bar's keys.
|
||||
//
|
||||
// Passed a st_multicon_t widget, the position, the graphic patches, a pointer
|
||||
// to the numbers representing what to display, and pointer to the enable flag
|
||||
// Returns nothing.
|
||||
//
|
||||
void STlib_initMultIcon
|
||||
( st_multicon_t* i,
|
||||
int x,
|
||||
int y,
|
||||
patch_t** il,
|
||||
int* inum,
|
||||
boolean* on )
|
||||
{
|
||||
i->x = x;
|
||||
i->y = y;
|
||||
i->oldinum = -1;
|
||||
i->inum = inum;
|
||||
i->on = on;
|
||||
i->p = il;
|
||||
}
|
||||
|
||||
//
|
||||
// STlib_updateMultIcon()
|
||||
//
|
||||
// Draw a st_multicon_t widget, used for a multigraphic display
|
||||
// like the status bar's keys. Displays each when the control
|
||||
// numbers change
|
||||
//
|
||||
// Passed a st_multicon_t widget
|
||||
// Returns nothing.
|
||||
//
|
||||
void STlib_updateMultIcon
|
||||
( st_multicon_t* mi )
|
||||
{
|
||||
if (*mi->on)
|
||||
{
|
||||
if (*mi->inum != -1) // killough 2/16/98: redraw only if != -1
|
||||
V_DrawPatch(mi->x, mi->y, mi->p[*mi->inum]);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log: st_lib.c,v $
|
||||
// Revision 1.8 1998/05/11 10:44:42 jim
|
||||
// formatted/documented st_lib
|
||||
//
|
||||
// Revision 1.7 1998/05/03 22:58:17 killough
|
||||
// Fix header #includes at top, nothing else
|
||||
//
|
||||
// Revision 1.6 1998/02/23 04:56:34 killough
|
||||
// Fix percent sign problems
|
||||
//
|
||||
// Revision 1.5 1998/02/19 16:55:09 jim
|
||||
// Optimized HUD and made more configurable
|
||||
//
|
||||
// Revision 1.4 1998/02/18 00:59:13 jim
|
||||
// Addition of HUD
|
||||
//
|
||||
// Revision 1.3 1998/02/17 06:17:03 killough
|
||||
// Add support for erasing keys in status bar
|
||||
//
|
||||
// Revision 1.2 1998/01/26 19:24:56 phares
|
||||
// First rev with no ^Ms
|
||||
//
|
||||
// Revision 1.1.1.1 1998/01/19 14:03:03 rand
|
||||
// Lee's Jan 19 sources
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
179
src/st_lib.h
@ -1,179 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 1999 by
|
||||
// id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// The status bar widget definitions and prototypes
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __STLIB__
|
||||
#define __STLIB__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
#define LARGENUMBER 1994
|
||||
|
||||
// We are referring to patches.
|
||||
struct patch_s;
|
||||
|
||||
extern boolean sts_colored_numbers;// status numbers do not change colors
|
||||
extern boolean sts_pct_always_gray;// status percents do not change colors
|
||||
|
||||
//
|
||||
// Typedefs of widgets
|
||||
//
|
||||
|
||||
// Number widget
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// upper right-hand corner
|
||||
// of the number (right-justified)
|
||||
int x;
|
||||
int y;
|
||||
|
||||
// max # of digits in number
|
||||
int width;
|
||||
|
||||
// last number value
|
||||
int oldnum;
|
||||
|
||||
// pointer to current value
|
||||
int* num;
|
||||
|
||||
// pointer to boolean stating
|
||||
// whether to update number
|
||||
boolean* on;
|
||||
|
||||
// list of patches for 0-9
|
||||
struct patch_s** p;
|
||||
|
||||
// user data
|
||||
int data;
|
||||
} st_number_t;
|
||||
|
||||
// Percent widget ("child" of number widget,
|
||||
// or, more precisely, contains a number widget.)
|
||||
typedef struct
|
||||
{
|
||||
// number information
|
||||
st_number_t n;
|
||||
|
||||
// percent sign graphic
|
||||
struct patch_s* p;
|
||||
} st_percent_t;
|
||||
|
||||
// Multiple Icon widget
|
||||
typedef struct
|
||||
{
|
||||
// center-justified location of icons
|
||||
int x;
|
||||
int y;
|
||||
|
||||
// last icon number
|
||||
int oldinum;
|
||||
|
||||
// pointer to current icon
|
||||
int* inum;
|
||||
|
||||
// pointer to boolean stating
|
||||
// whether to update icon
|
||||
boolean* on;
|
||||
|
||||
// list of icons
|
||||
struct patch_s** p;
|
||||
|
||||
// user data
|
||||
int data;
|
||||
|
||||
} st_multicon_t;
|
||||
|
||||
//
|
||||
// Widget creation, access, and update routines
|
||||
//
|
||||
|
||||
// Initializes widget library.
|
||||
// More precisely, initialize STMINUS,
|
||||
// everything else is done somewhere else.
|
||||
//
|
||||
void STlib_init(void);
|
||||
|
||||
// Number widget routines
|
||||
void STlib_initNum
|
||||
( st_number_t* n,
|
||||
int x,
|
||||
int y,
|
||||
struct patch_s** pl,
|
||||
int* num,
|
||||
boolean* on,
|
||||
int width );
|
||||
|
||||
void STlib_updateNum
|
||||
( st_number_t* n,
|
||||
byte *outrng ); //jff 1/16/98 add color translation to digit output
|
||||
|
||||
|
||||
// Percent widget routines
|
||||
void STlib_initPercent
|
||||
( st_percent_t* p,
|
||||
int x,
|
||||
int y,
|
||||
struct patch_s** pl,
|
||||
int* num,
|
||||
boolean* on,
|
||||
struct patch_s* percent );
|
||||
|
||||
|
||||
void STlib_updatePercent
|
||||
( st_percent_t* per,
|
||||
byte *outrng ); //jff 1/16/98 add color translation to percent output
|
||||
|
||||
|
||||
// Multiple Icon widget routines
|
||||
void STlib_initMultIcon
|
||||
( st_multicon_t* mi,
|
||||
int x,
|
||||
int y,
|
||||
struct patch_s** il,
|
||||
int* inum,
|
||||
boolean* on );
|
||||
|
||||
|
||||
void STlib_updateMultIcon
|
||||
( st_multicon_t* mi );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log: st_lib.h,v $
|
||||
// Revision 1.5 1998/05/11 10:44:46 jim
|
||||
// formatted/documented st_lib
|
||||
//
|
||||
// Revision 1.4 1998/02/19 16:55:12 jim
|
||||
// Optimized HUD and made more configurable
|
||||
//
|
||||
// Revision 1.3 1998/02/18 00:59:16 jim
|
||||
// Addition of HUD
|
||||
//
|
||||
// Revision 1.2 1998/01/26 19:27:55 phares
|
||||
// First rev with no ^Ms
|
||||
//
|
||||
// Revision 1.1.1.1 1998/01/19 14:03:03 rand
|
||||
// Lee's Jan 19 sources
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
511
src/st_sbardef.c
Normal file
@ -0,0 +1,511 @@
|
||||
//
|
||||
// Copyright(C) 2024 Roman Fomin
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
#include "st_sbardef.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "i_printf.h"
|
||||
#include "m_array.h"
|
||||
#include "m_json.h"
|
||||
#include "m_misc.h"
|
||||
#include "m_swap.h"
|
||||
#include "r_defs.h"
|
||||
#include "v_fmt.h"
|
||||
#include "v_video.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
static boolean ParseSbarCondition(json_t *json, sbarcondition_t *out)
|
||||
{
|
||||
json_t *condition = JS_GetObject(json, "condition");
|
||||
json_t *param = JS_GetObject(json, "param");
|
||||
if (!JS_IsNumber(condition) || !JS_IsNumber(param))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->condition = JS_GetInteger(condition);
|
||||
out->param = JS_GetInteger(param);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean ParseSbarFrame(json_t *json, sbarframe_t *out)
|
||||
{
|
||||
json_t *lump = JS_GetObject(json, "lump");
|
||||
if (!JS_IsString(lump))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->patch_name = M_StringDuplicate(JS_GetString(lump));
|
||||
|
||||
json_t *duration = JS_GetObject(json, "duration");
|
||||
if (!JS_IsNumber(duration))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->duration = JS_GetNumber(duration) * TICRATE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean ParseSbarElem(json_t *json, sbarelem_t *out);
|
||||
|
||||
static boolean ParseSbarElemType(json_t *json, sbarelementtype_t type,
|
||||
sbarelem_t *out)
|
||||
{
|
||||
out->type = type;
|
||||
|
||||
json_t *x_pos = JS_GetObject(json, "x");
|
||||
json_t *y_pos = JS_GetObject(json, "y");
|
||||
json_t *alignment = JS_GetObject(json, "alignment");
|
||||
if (!JS_IsNumber(x_pos) || !JS_IsNumber(y_pos) || !JS_IsNumber(alignment))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->x_pos = JS_GetInteger(x_pos);
|
||||
out->y_pos = JS_GetInteger(y_pos);
|
||||
out->alignment = JS_GetInteger(alignment);
|
||||
|
||||
const char *tranmap = JS_GetStringRef(json, "tranmap");
|
||||
if (tranmap)
|
||||
{
|
||||
out->tranmap = W_CacheLumpName(tranmap, PU_STATIC);
|
||||
}
|
||||
|
||||
const char *translation = JS_GetStringRef(json, "translation");
|
||||
out->cr = translation ? V_CRByName(translation) : CR_NONE;
|
||||
out->crboom = CR_NONE;
|
||||
|
||||
json_t *js_conditions = JS_GetObject(json, "conditions");
|
||||
json_t *js_condition = NULL;
|
||||
JS_ArrayForEach(js_condition, js_conditions)
|
||||
{
|
||||
sbarcondition_t condition = {0};
|
||||
if (ParseSbarCondition(js_condition, &condition))
|
||||
{
|
||||
array_push(out->conditions, condition);
|
||||
}
|
||||
}
|
||||
|
||||
json_t *js_children = JS_GetObject(json, "children");
|
||||
json_t *js_child = NULL;
|
||||
JS_ArrayForEach(js_child, js_children)
|
||||
{
|
||||
sbarelem_t elem = {0};
|
||||
if (ParseSbarElem(js_child, &elem))
|
||||
{
|
||||
array_push(out->children, elem);
|
||||
}
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case sbe_graphic:
|
||||
{
|
||||
sbe_graphic_t *graphic = calloc(1, sizeof(*graphic));
|
||||
json_t *patch = JS_GetObject(json, "patch");
|
||||
if (!JS_IsString(patch))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
graphic->patch_name = M_StringDuplicate(JS_GetString(patch));
|
||||
out->subtype.graphic = graphic;
|
||||
}
|
||||
break;
|
||||
|
||||
case sbe_animation:
|
||||
{
|
||||
sbe_animation_t *animation = calloc(1, sizeof(*animation));
|
||||
json_t *js_frames = JS_GetObject(json, "frames");
|
||||
json_t *js_frame = NULL;
|
||||
JS_ArrayForEach(js_frame, js_frames)
|
||||
{
|
||||
sbarframe_t frame = {0};
|
||||
if (ParseSbarFrame(js_frame, &frame))
|
||||
{
|
||||
array_push(animation->frames, frame);
|
||||
}
|
||||
}
|
||||
out->subtype.animation = animation;
|
||||
}
|
||||
break;
|
||||
|
||||
case sbe_number:
|
||||
case sbe_percent:
|
||||
{
|
||||
sbe_number_t *number = calloc(1, sizeof(*number));
|
||||
json_t *font = JS_GetObject(json, "font");
|
||||
if (!JS_IsString(font))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
number->font_name = M_StringDuplicate(JS_GetString(font));
|
||||
|
||||
json_t *type = JS_GetObject(json, "type");
|
||||
json_t *param = JS_GetObject(json, "param");
|
||||
json_t *maxlength = JS_GetObject(json, "maxlength");
|
||||
if (!JS_IsNumber(type) || !JS_IsNumber(param)
|
||||
|| !JS_IsNumber(maxlength))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
number->type = JS_GetInteger(type);
|
||||
number->param = JS_GetInteger(param);
|
||||
number->maxlength = JS_GetInteger(maxlength);
|
||||
out->subtype.number = number;
|
||||
}
|
||||
break;
|
||||
|
||||
case sbe_widget:
|
||||
{
|
||||
sbe_widget_t *widget = calloc(1, sizeof(*widget));
|
||||
|
||||
json_t *font = JS_GetObject(json, "font");
|
||||
if (!JS_IsString(font))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
widget->font_name = M_StringDuplicate(JS_GetString(font));
|
||||
|
||||
json_t *type = JS_GetObject(json, "type");
|
||||
if (!JS_IsNumber(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
widget->type = JS_GetInteger(type);
|
||||
|
||||
switch (widget->type)
|
||||
{
|
||||
case sbw_message:
|
||||
case sbw_secret:
|
||||
widget->duration =
|
||||
JS_GetNumberValue(json, "duration") * TICRATE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
out->subtype.widget = widget;
|
||||
}
|
||||
break;
|
||||
|
||||
case sbe_face:
|
||||
{
|
||||
sbe_face_t *face = calloc(1, sizeof(*face));
|
||||
out->subtype.face = face;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char *sbe_names[] =
|
||||
{
|
||||
[sbe_canvas] = "canvas",
|
||||
[sbe_graphic] = "graphic",
|
||||
[sbe_animation] = "animation",
|
||||
[sbe_face] = "face",
|
||||
[sbe_facebackground] = "facebackground",
|
||||
[sbe_number] = "number",
|
||||
[sbe_percent] = "percent",
|
||||
[sbe_widget] = "widget"
|
||||
};
|
||||
|
||||
static boolean ParseSbarElem(json_t *json, sbarelem_t *out)
|
||||
{
|
||||
for (sbarelementtype_t type = sbe_none + 1; type < sbe_max; ++type)
|
||||
{
|
||||
json_t *obj = JS_GetObject(json, sbe_names[type]);
|
||||
if (obj && JS_IsObject(obj))
|
||||
{
|
||||
return ParseSbarElemType(obj, type, out);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean ParseNumberFont(json_t *json, numberfont_t *out)
|
||||
{
|
||||
json_t *name = JS_GetObject(json, "name");
|
||||
if (!JS_IsString(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->name = M_StringDuplicate(JS_GetString(name));
|
||||
|
||||
const char *stem = JS_GetStringRef(json, "stem");
|
||||
if (!stem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
json_t *type = JS_GetObject(json, "type");
|
||||
if (!JS_IsNumber(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->type = JS_GetInteger(type);
|
||||
|
||||
char lump[9] = {0};
|
||||
int found;
|
||||
int maxwidth = 0;
|
||||
int maxheight = 0;
|
||||
|
||||
for (int num = 0; num < 10; ++num)
|
||||
{
|
||||
M_snprintf(lump, sizeof(lump), "%sNUM%d", stem, num);
|
||||
found = W_CheckNumForName(lump);
|
||||
if (found < 0)
|
||||
{
|
||||
I_Printf(VB_ERROR, "SBARDEF: patch \"%s\" not found", lump);
|
||||
continue;
|
||||
}
|
||||
out->numbers[num] = V_CachePatchNum(found, PU_STATIC);
|
||||
maxwidth = MAX(maxwidth, SHORT(out->numbers[num]->width));
|
||||
maxheight = MAX(maxheight, SHORT(out->numbers[num]->height));
|
||||
}
|
||||
|
||||
out->maxheight = maxheight;
|
||||
|
||||
M_snprintf(lump, sizeof(lump), "%sMINUS", stem);
|
||||
found = W_CheckNumForName(lump);
|
||||
if (found >= 0)
|
||||
{
|
||||
out->minus = V_CachePatchNum(found, PU_STATIC);
|
||||
maxwidth = MAX(maxwidth, SHORT(out->minus->width));
|
||||
}
|
||||
|
||||
M_snprintf(lump, sizeof(lump), "%sPRCNT", stem);
|
||||
found = W_CheckNumForName(lump);
|
||||
if (found >= 0)
|
||||
{
|
||||
out->percent = V_CachePatchNum(found, PU_STATIC);
|
||||
maxwidth = MAX(maxwidth, SHORT(out->percent->width));
|
||||
}
|
||||
|
||||
switch (out->type)
|
||||
{
|
||||
case sbf_mono0:
|
||||
out->monowidth = SHORT(out->numbers[0]->width);
|
||||
break;
|
||||
case sbf_monomax:
|
||||
out->monowidth = maxwidth;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean ParseHUDFont(json_t *json, hudfont_t *out)
|
||||
{
|
||||
json_t *name = JS_GetObject(json, "name");
|
||||
if (!JS_IsString(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->name = M_StringDuplicate(JS_GetString(name));
|
||||
|
||||
const char *stem = JS_GetStringRef(json, "stem");
|
||||
if (!stem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
json_t *type = JS_GetObject(json, "type");
|
||||
if (!JS_IsNumber(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->type = JS_GetInteger(type);
|
||||
|
||||
char lump[9] = {0};
|
||||
int found;
|
||||
int maxwidth = 0;
|
||||
int maxheight = 0;
|
||||
|
||||
for (int i = 0; i < HU_FONTSIZE; ++i)
|
||||
{
|
||||
M_snprintf(lump, sizeof(lump), "%s%03d", stem, i + HU_FONTSTART);
|
||||
found = W_CheckNumForName(lump);
|
||||
if (found < 0)
|
||||
{
|
||||
out->characters[i] = NULL;
|
||||
continue;
|
||||
}
|
||||
out->characters[i] = V_CachePatchNum(found, PU_STATIC);
|
||||
maxwidth = MAX(maxwidth, SHORT(out->characters[i]->width));
|
||||
maxheight = MAX(maxheight, SHORT(out->characters[i]->height));
|
||||
}
|
||||
|
||||
out->maxheight = maxheight;
|
||||
|
||||
switch (out->type)
|
||||
{
|
||||
case sbf_mono0:
|
||||
out->monowidth = SHORT(out->characters[0]->width);
|
||||
break;
|
||||
case sbf_monomax:
|
||||
out->monowidth = maxwidth;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean ParseStatusBar(json_t *json, statusbar_t *out)
|
||||
{
|
||||
json_t *height = JS_GetObject(json, "height");
|
||||
json_t *fullscreenrender = JS_GetObject(json, "fullscreenrender");
|
||||
if (!JS_IsNumber(height) || !JS_IsBoolean(fullscreenrender))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
out->height = JS_GetInteger(height);
|
||||
out->fullscreenrender = JS_GetBoolean(fullscreenrender);
|
||||
|
||||
out->fillflat = JS_GetStringCopy(json, "fillflat");
|
||||
|
||||
json_t *js_children = JS_GetObject(json, "children");
|
||||
json_t *js_child = NULL;
|
||||
JS_ArrayForEach(js_child, js_children)
|
||||
{
|
||||
sbarelem_t elem = {0};
|
||||
if (ParseSbarElem(js_child, &elem))
|
||||
{
|
||||
array_push(out->children, elem);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
sbardef_t *ST_ParseSbarDef(void)
|
||||
{
|
||||
json_t *json = JS_Open("SBARDEF", "statusbar", (version_t){1, 1, 0});
|
||||
if (json == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
boolean load_defaults = false;
|
||||
version_t v = {0};
|
||||
JS_GetVersion(json, &v);
|
||||
if (v.major == 1 && v.minor < 1)
|
||||
{
|
||||
load_defaults = true;
|
||||
}
|
||||
|
||||
json_t *data = JS_GetObject(json, "data");
|
||||
if (JS_IsNull(data) || !JS_IsObject(data))
|
||||
{
|
||||
I_Printf(VB_ERROR, "SBARDEF: no data");
|
||||
JS_Close(json);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sbardef_t *out = calloc(1, sizeof(*out));
|
||||
|
||||
json_t *js_numberfonts = JS_GetObject(data, "numberfonts");
|
||||
json_t *js_numberfont = NULL;
|
||||
|
||||
JS_ArrayForEach(js_numberfont, js_numberfonts)
|
||||
{
|
||||
numberfont_t numberfont = {0};
|
||||
if (ParseNumberFont(js_numberfont, &numberfont))
|
||||
{
|
||||
array_push(out->numberfonts, numberfont);
|
||||
}
|
||||
}
|
||||
|
||||
json_t *js_hudfonts = JS_GetObject(data, "hudfonts");
|
||||
json_t *js_hudfont = NULL;
|
||||
|
||||
JS_ArrayForEach(js_hudfont, js_hudfonts)
|
||||
{
|
||||
hudfont_t hudfont = {0};
|
||||
if (ParseHUDFont(js_hudfont, &hudfont))
|
||||
{
|
||||
array_push(out->hudfonts, hudfont);
|
||||
}
|
||||
}
|
||||
|
||||
json_t *js_statusbars = JS_GetObject(data, "statusbars");
|
||||
json_t *js_statusbar = NULL;
|
||||
|
||||
JS_ArrayForEach(js_statusbar, js_statusbars)
|
||||
{
|
||||
statusbar_t statusbar = {0};
|
||||
if (ParseStatusBar(js_statusbar, &statusbar))
|
||||
{
|
||||
array_push(out->statusbars, statusbar);
|
||||
}
|
||||
}
|
||||
|
||||
JS_Close(json);
|
||||
|
||||
if (!load_defaults)
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
json = JS_Open("SBHUDDEF", "hud", (version_t){1, 0, 0});
|
||||
if (json == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = JS_GetObject(json, "data");
|
||||
|
||||
js_hudfonts = JS_GetObject(data, "hudfonts");
|
||||
js_hudfont = NULL;
|
||||
|
||||
JS_ArrayForEach(js_hudfont, js_hudfonts)
|
||||
{
|
||||
hudfont_t hudfont = {0};
|
||||
if (ParseHUDFont(js_hudfont, &hudfont))
|
||||
{
|
||||
array_push(out->hudfonts, hudfont);
|
||||
}
|
||||
}
|
||||
|
||||
statusbar_t *statusbar;
|
||||
array_foreach(statusbar, out->statusbars)
|
||||
{
|
||||
json_t *js_widgets = JS_GetObject(data, "widgets");
|
||||
json_t *js_widget = NULL;
|
||||
|
||||
JS_ArrayForEach(js_widget, js_widgets)
|
||||
{
|
||||
sbarelem_t elem = {0};
|
||||
if (ParseSbarElem(js_widget, &elem))
|
||||
{
|
||||
elem.y_pos += (statusbar->height - SCREENHEIGHT);
|
||||
array_push(statusbar->children, elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JS_Close(json);
|
||||
|
||||
return out;
|
||||
}
|
272
src/st_sbardef.h
Normal file
@ -0,0 +1,272 @@
|
||||
//
|
||||
// Copyright(C) 2024 Roman Fomin
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
#ifndef ST_SBARDEF_H
|
||||
#define ST_SBARDEF_H
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "r_defs.h"
|
||||
#include "v_video.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sbf_none = -1,
|
||||
sbf_mono0,
|
||||
sbf_monomax,
|
||||
sbf_proportional,
|
||||
} fonttype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sbc_none = -1,
|
||||
sbc_weaponowned,
|
||||
sbc_weaponselected,
|
||||
sbc_weaponnotselected,
|
||||
sbc_weaponhasammo,
|
||||
sbc_selectedweaponhasammo,
|
||||
sbc_selectedweaponammotype,
|
||||
sbc_weaponslotowned,
|
||||
sbc_weaponslotnotowned,
|
||||
sbc_weaponslotselected,
|
||||
sbc_weaponslotnotselected,
|
||||
sbc_itemowned,
|
||||
sbc_itemnotowned,
|
||||
sbc_featurelevelgreaterequal,
|
||||
sbc_featurelevelless,
|
||||
sbc_sessiontypeeequal,
|
||||
sbc_sessiontypenotequal,
|
||||
sbc_modeeequal,
|
||||
sbc_modenotequal,
|
||||
sbc_hudmodeequal,
|
||||
|
||||
// Woof!
|
||||
sbc_widgetmode,
|
||||
sbc_widgetenabled,
|
||||
sbc_widgetdisabled,
|
||||
|
||||
sbc_max,
|
||||
} sbarconditiontype_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sbarconditiontype_t condition;
|
||||
int param;
|
||||
} sbarcondition_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sbc_mode_none,
|
||||
sbc_mode_automap = 0x01,
|
||||
sbc_mode_overlay = 0x02,
|
||||
sbc_mode_hud = 0x04,
|
||||
} sbc_mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sbn_none = -1,
|
||||
sbn_health,
|
||||
sbn_armor,
|
||||
sbn_frags,
|
||||
sbn_ammo,
|
||||
sbn_ammoselected,
|
||||
sbn_maxammo,
|
||||
sbn_weaponammo,
|
||||
sbn_weaponmaxammo,
|
||||
|
||||
sbn_max,
|
||||
} sbarnumbertype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sbe_none = -1,
|
||||
sbe_canvas,
|
||||
sbe_graphic,
|
||||
sbe_animation,
|
||||
sbe_face,
|
||||
sbe_facebackground,
|
||||
sbe_number,
|
||||
sbe_percent,
|
||||
|
||||
// Woof!
|
||||
sbe_widget,
|
||||
|
||||
sbe_max,
|
||||
} sbarelementtype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sbw_monsec,
|
||||
sbw_time,
|
||||
sbw_coord,
|
||||
sbw_fps,
|
||||
sbw_rate,
|
||||
sbw_cmd,
|
||||
sbw_speed,
|
||||
|
||||
sbw_message,
|
||||
sbw_secret,
|
||||
sbw_chat,
|
||||
sbw_title,
|
||||
} sbarwidgettype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sbe_h_left = 0x00,
|
||||
sbe_h_middle = 0x01,
|
||||
sbe_h_right = 0x02,
|
||||
|
||||
sbe_h_mask = 0x03,
|
||||
|
||||
sbe_v_top = 0x00,
|
||||
sbe_v_middle = 0x04,
|
||||
sbe_v_bottom = 0x08,
|
||||
|
||||
sbe_v_mask = 0x0C,
|
||||
|
||||
// Woof!
|
||||
sbe_wide_left = 0x10,
|
||||
sbe_wide_right = 0x20,
|
||||
} sbaralignment_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *patch_name;
|
||||
patch_t *patch;
|
||||
int duration;
|
||||
} sbarframe_t;
|
||||
|
||||
typedef struct sbarelem_s sbarelem_t;
|
||||
typedef struct numberfont_s numberfont_t;
|
||||
typedef struct hudfont_s hudfont_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *patch_name;
|
||||
patch_t *patch;
|
||||
} sbe_graphic_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sbarframe_t *frames;
|
||||
int frame_index;
|
||||
int duration_left;
|
||||
} sbe_animation_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *font_name;
|
||||
numberfont_t *font;
|
||||
sbarnumbertype_t type;
|
||||
int param;
|
||||
int maxlength;
|
||||
int value;
|
||||
int numvalues;
|
||||
int oldvalue;
|
||||
int xoffset;
|
||||
} sbe_number_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int faceindex;
|
||||
int facecount;
|
||||
int oldhealth;
|
||||
} sbe_face_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *string;
|
||||
int totalwidth;
|
||||
int xoffset;
|
||||
} widgetline_t;
|
||||
|
||||
typedef struct sbe_widget_s
|
||||
{
|
||||
sbarwidgettype_t type;
|
||||
const char *font_name;
|
||||
hudfont_t *font;
|
||||
widgetline_t *lines;
|
||||
|
||||
// message
|
||||
int duration;
|
||||
} sbe_widget_t;
|
||||
|
||||
struct sbarelem_s
|
||||
{
|
||||
sbarelementtype_t type;
|
||||
int x_pos;
|
||||
int y_pos;
|
||||
sbaralignment_t alignment;
|
||||
sbarcondition_t *conditions;
|
||||
sbarelem_t *children;
|
||||
|
||||
byte *tranmap;
|
||||
crange_idx_e cr;
|
||||
crange_idx_e crboom;
|
||||
|
||||
union
|
||||
{
|
||||
sbe_graphic_t *graphic;
|
||||
sbe_animation_t *animation;
|
||||
sbe_number_t *number;
|
||||
sbe_face_t *face;
|
||||
|
||||
// Woof!
|
||||
sbe_widget_t *widget;
|
||||
} subtype;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int height;
|
||||
boolean fullscreenrender;
|
||||
const char *fillflat;
|
||||
sbarelem_t *children;
|
||||
} statusbar_t;
|
||||
|
||||
struct numberfont_s
|
||||
{
|
||||
const char *name;
|
||||
fonttype_t type;
|
||||
int monowidth;
|
||||
int maxheight;
|
||||
patch_t *numbers[10];
|
||||
patch_t *percent;
|
||||
patch_t *minus;
|
||||
};
|
||||
|
||||
#define HU_FONTSTART '!' /* the first font characters */
|
||||
#define HU_FONTEND (0x7f) /*jff 2/16/98 '_' the last font characters */
|
||||
|
||||
// Calculate # of glyphs in font.
|
||||
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
|
||||
#define SPACEWIDTH 4
|
||||
|
||||
struct hudfont_s
|
||||
{
|
||||
const char *name;
|
||||
fonttype_t type;
|
||||
int monowidth;
|
||||
int maxheight;
|
||||
patch_t *characters[HU_FONTSIZE];
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
numberfont_t *numberfonts;
|
||||
hudfont_t *hudfonts;
|
||||
statusbar_t *statusbars;
|
||||
} sbardef_t;
|
||||
|
||||
sbardef_t *ST_ParseSbarDef(void);
|
||||
|
||||
#endif
|
2881
src/st_stuff.c
@ -27,6 +27,7 @@
|
||||
|
||||
struct event_s;
|
||||
struct player_s;
|
||||
struct patch_s;
|
||||
|
||||
// Size of statusbar.
|
||||
// Now sensitive for scaling.
|
||||
@ -46,49 +47,31 @@ boolean ST_Responder(struct event_s *ev);
|
||||
void ST_Ticker(void);
|
||||
|
||||
// Called by main loop.
|
||||
void ST_Drawer(boolean fullscreen, boolean refresh);
|
||||
void ST_Drawer(void);
|
||||
|
||||
void ST_Erase(void);
|
||||
|
||||
// Called when the console player is spawned on each level.
|
||||
void ST_Start(void);
|
||||
|
||||
// Called by startup code.
|
||||
void ST_Init(void);
|
||||
void ST_Warnings(void);
|
||||
|
||||
void ST_ResetPalette(void);
|
||||
|
||||
// [crispy] forcefully initialize the status bar backing screen
|
||||
void ST_refreshBackground(void);
|
||||
extern boolean st_refresh_background;
|
||||
|
||||
void ST_InitRes(void);
|
||||
|
||||
// killough 5/2/98: moved from m_misc.c:
|
||||
|
||||
// [Alaux]
|
||||
extern int st_health;
|
||||
extern int st_armor;
|
||||
|
||||
extern int health_red; // health amount less than which status is red
|
||||
extern int health_yellow; // health amount less than which status is yellow
|
||||
extern int health_green; // health amount above is blue, below is green
|
||||
extern int armor_red; // armor amount less than which status is red
|
||||
extern int armor_yellow; // armor amount less than which status is yellow
|
||||
extern int armor_green; // armor amount above is blue, below is green
|
||||
extern int ammo_red; // ammo percent less than which status is red
|
||||
extern int ammo_yellow; // ammo percent less is yellow more green
|
||||
|
||||
#define KEYBLINKMASK 0x8
|
||||
#define KEYBLINKTICS (7*KEYBLINKMASK)
|
||||
extern void ST_SetKeyBlink(struct player_s *player, int blue, int yellow, int red);
|
||||
extern int ST_BlinkKey(struct player_s *player, int index);
|
||||
extern int st_keyorskull[3];
|
||||
|
||||
extern boolean hud_backpack_thresholds; // backpack changes thresholds
|
||||
extern boolean hud_armor_type; // color of armor depends on type
|
||||
|
||||
extern boolean palette_changes;
|
||||
|
||||
extern boolean st_invul;
|
||||
extern struct patch_s **hu_font;
|
||||
|
||||
void WI_DrawWidgets(void);
|
||||
|
||||
void ST_BindSTSVariables(void);
|
||||
|
||||
|
1121
src/st_widgets.c
Normal file
83
src/st_widgets.h
Normal file
@ -0,0 +1,83 @@
|
||||
//
|
||||
// Copyright(C) 2024 Roman Fomin
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
#ifndef ST_WIDGETS_H
|
||||
#define ST_WIDGETS_H
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
struct sbarelem_s;
|
||||
struct sbe_widget_s;
|
||||
struct player_s;
|
||||
struct event_s;
|
||||
|
||||
#define HU_MAXMESSAGES 20
|
||||
#define HU_MAXLINELENGTH 120
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HUD_WIDGET_OFF,
|
||||
HUD_WIDGET_AUTOMAP,
|
||||
HUD_WIDGET_HUD,
|
||||
HUD_WIDGET_ALWAYS,
|
||||
HUD_WIDGET_ADVANCED,
|
||||
} widgetstate_t;
|
||||
|
||||
extern boolean show_messages;
|
||||
extern boolean show_toggle_messages;
|
||||
extern boolean show_pickup_messages;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SECRETMESSAGE_OFF,
|
||||
SECRETMESSAGE_ON,
|
||||
SECRETMESSAGE_COUNT
|
||||
} secretmessage_t;
|
||||
|
||||
extern secretmessage_t hud_secret_message; // "A secret is revealed!" message
|
||||
|
||||
extern boolean chat_on;
|
||||
|
||||
extern widgetstate_t hud_level_stats;
|
||||
extern widgetstate_t hud_level_time;
|
||||
extern widgetstate_t hud_player_coords;
|
||||
extern int hudcolor_titl;
|
||||
extern int hudcolor_xyco;
|
||||
|
||||
extern boolean hud_time_use;
|
||||
|
||||
extern struct sbarelem_s *st_time_elem;
|
||||
|
||||
void ST_ResetTitle(void);
|
||||
|
||||
void ST_ClearLines(struct sbe_widget_s *widget);
|
||||
void ST_AddLine(struct sbe_widget_s *widget, const char *string);
|
||||
void ST_UpdateWidget(struct sbarelem_s *elem, struct player_s *player);
|
||||
|
||||
void ST_UpdateChatMessage(void);
|
||||
boolean ST_MessagesResponder(struct event_s *ev);
|
||||
|
||||
char ST_DequeueChatChar(void);
|
||||
|
||||
extern char **player_names[];
|
||||
extern int speedometer;
|
||||
|
||||
extern int playback_tic, playback_totaltics;
|
||||
boolean ST_DemoProgressBar(boolean force);
|
||||
|
||||
void ST_InitWidgets(void);
|
||||
void ST_ResetMessageColors(void);
|
||||
|
||||
void ST_BindHUDVariables(void);
|
||||
|
||||
#endif
|