Commit Graph

25 Commits

Author SHA1 Message Date
Christoph Oelckers 553906b186 - fixed: BaseStatusbar::GetAmount returned the default item's amount if the player held none of the given type. This should only be done for MaxAmount. 2017-04-01 13:33:42 +02:00
Christoph Oelckers 3a1228bf95 - exported the clipping rectangle to scripting and added a statusbar scaling wrapper for it.
- fixed: BaseStatusBar.Fill did not pass its flags parameter to the native function.
2017-03-30 12:13:28 +02:00
Christoph Oelckers 1dcc017daf - reimplemented the position display, but changed its position a bit upward.
- activated the RenderOverlay event, now that it can be called from the correct spot, i.e. right after the top level HUD messages are drawn. The system's status output will still be drawn on top of them.
2017-03-29 23:51:53 +02:00
Christoph Oelckers b38934b532 - fixed declaration of ACS getters for status bar.
- fixed some uninitialized variables in font print code.
2017-03-29 21:54:11 +02:00
Christoph Oelckers 1d4ab0cc2a - implemented proper scaling for the status bar itself.
This allows using the UI scale or its own value, like all other scaling values.
In addition there is a choice between preserving equal pixel size or aspect ratio because the squashed non-corrected versions tend to look odd, but since proper scaling requires ununiform pixel sizes it is an option.

- changed how status bar sizes are being handled.

This has to recalculate all scaling and positioning factors, which can cause problems if the drawer leaves with some temporary values that do not reflect the status bar as a whole.
Changed it so that the status bar stores the base values and restores them after drawing is complete.
2017-03-29 19:23:40 +02:00
Christoph Oelckers 7ba6860102 - scriptified the automap HUD and made it obey hud_scale instead of always being fully scaled. 2017-03-29 14:20:22 +02:00
Christoph Oelckers 2f06c09681 - fixed map name display on the automap HUD
This would cut off overlong names and the handling for status bars with protruding elements was far too simplistic and worse, making assumptions based on game mode.
It now uses a virtual function to query the status bar itself for returning this information so it can be overridden and uses V_BreakLines to split the text if it is wider than the display.
2017-03-29 10:36:16 +02:00
Christoph Oelckers b9485d4edf - ported the Hexen status bar to zscript.
Note that DrawBar with a background texture does not work yet because the clipping rectangle is not done yet.
2017-03-28 11:00:05 +02:00
Christoph Oelckers bac464f2b7 - added the inventory bar on Heretic's status bar. 2017-03-27 21:30:05 +02:00
Christoph Oelckers a6bf93c624 - implemented the Heretic status bar. 2017-03-27 21:01:40 +02:00
Christoph Oelckers 0fdd118906 - change statusbar drawers to use the top left of the virtual screen as origin, not the top left of the actual status bar, to bring this in line with SBARINFO.
The Strife status bar which was still native code had it differently and that was used as the initial guideline.
2017-03-27 09:52:30 +02:00
Christoph Oelckers a112b29c43 - implemented the inventory bar. This object is a bit special because it requires a lot of parameters, most of which are easily set to defaults. To make handling easier, most are passed through a container object which does some processing up front.
- finished work on the Doom status bar. I also took the opportunity to fix the layout of the inventory bar which is a bit broken in SBARINFO.
- tuned the selection rules for deciding what creates the status bar, so that the most recent definition that can be found is chosen.
2017-03-27 01:02:10 +02:00
Christoph Oelckers e791c957d9 - implemented the regular Doom status bar.
The DOOM status bar and HUD are complete, except the inventory bar.
2017-03-26 22:04:58 +02:00
Christoph Oelckers 08b3c38304 - simplified the parameters of the HUD draw functions by moving all booleans into one flags word and ordering them so that the less likely ones to be used can be made optional.
- got rid of the image list in the Doom status bar. The cost of the texture lookup is mostly irrelevant here so clearer and shorter code is preferrable.
- moved the box fitting code from DrawTexture into the native function to have all coordinate calculations in one place which is necessary to implement proper alignment default handling. Without higher level functions altering positioning the default can be set to automatic alignment determination, i.e. the value's sign decides where something is placed. Of course for special cases this can be overridden.
- use ANIMDEFS to animate the inventory arrow,
2017-03-26 18:41:24 +02:00
Christoph Oelckers 1c71d038dd - Doom keybar is working.
I did not implement an equivalent to SBARINFO's DrawKeyBar. This is too limiting because it needs to consider any possibility. It really is easier to let a mod implement this itself and custom adjust it to its needs.

- fixed some stuff, in particular use DrawInventoryIcon to get smarter icon lookup.
2017-03-25 23:43:19 +01:00
Christoph Oelckers 3e67a8bafa - let hud_scale act like an override to uiscale, just like con_scale does.
- better handling of ForceScale for the fullscreen HUD that doesn't mess around with CVARs.
- moved the mug shot into the status bar, because this is global state that needs to be shared between different pieces of code which want to display a mug shot.
- SBARINFO should work off the current status bar settings instead of the ones stored in its script object
2017-03-25 18:32:47 +01:00
Christoph Oelckers bdb9275f8c - made the mugshot accessible to ZScript.
Note that there is no direct access, all this exposes is a single function to get the current face's texture which then can be drawn using the existing functions.
2017-03-25 01:22:42 +01:00
Christoph Oelckers b17b8d32ad completely redid the active powerup drawer for the HUD
- replaced Inventory.DrawPowerup with a GetPowerupIcon method so that the calling code can handle the drawing and apply its own rules. This was a major design flaw of allowing the inventory items to handle the drawing themselves, because they were unable to adjust to different HUD frontends. Note that any mod that overrides DrawPowerup will not draw any icon that expects to be handled that way!
- the alternative HUD now has its own, separate drawer that obeys the AltHUD's rules, and not the ones of the normal fullscreen HUD.
- the standard drawer has been scriptified as a virtual function.
- Both drawers now handle positioning of the icon inside its assigned box themselves instead of trusting the powerup item to do it correctly.
- DTA_HUDRules and Screen.DrawHUDTexture are to be considered deprecated because both do not integrate into the redesigned HUD code.
2017-03-24 22:58:16 +01:00
Christoph Oelckers 6760e01a0d - implemented the status bar's DrawString function and ported the fullscreen HUD part of the Strife status bar to use the new functionality. 2017-03-24 20:09:50 +01:00
Christoph Oelckers b5720ee1e7 - initial work on DrawString method. 2017-03-24 02:38:44 +01:00
Christoph Oelckers 617934e1c2 - added a few exports for game strings which the SBARINFO string drawer can access and which should also be available by ZScript.
- merged BaseStatusBar and CustomStatusBar back together.

Since the low level draw functions are better done in native code for both performance and debuggability the split has become pointless.
2017-03-24 02:12:36 +01:00
Christoph Oelckers a3ee3c287e - major progress on the status bar code: SBARINFO's DrawGraphic has been ported into a generic function of the base statusbar class and put to use for a few items on the Strife status bar.
- decided to ditch the widget system I had started to lay out. As it turns out that would make things far more complicated and slower than they need to be.
2017-03-24 00:47:08 +01:00
Christoph Oelckers f0e4f54c80 - one more bit of scriptification. 2017-03-22 18:38:09 +01:00
Christoph Oelckers 1423d5f42a - scriptified the SBARINFO wrapper.
This serves no purpose in itself but it removes a native side class from the status bar class hierarchy which allows for better editing options later.
2017-03-22 17:29:13 +01:00
Christoph Oelckers 9bffe4ee50 - scriptified the main statusbar interface and the Strife status bar.
Note that the Strife status bar does not draw the health bars yet. I tried to replace the hacky custom texture with a single fill operation but had to find out that all the coordinate mangling for the status bar is being done deep in the video code. This needs to be fixed before this can be made to work.

Currently this is not usable in mods because they cannot initialize custom status bars yet.
2017-03-22 00:32:52 +01:00