* Fixes regression from e1ee9bc83c. +='ing the angle by 16 gave a noticeable hiccup, but was keeping the poor math before in-check so the angle didn't drift.
* Using more temp data fields in hittype, properly define a min/max using the initial camera angle and the hitag which is conveniently the camera's viewing arc.
This is needed to extend a few fields that are too narrow - e.g. the texture offset fields have no room for interpolating scrolling textures.
Blood not done yet, will also need to be changed to get rid of the limits.
* Duke/RR: Fix `SB_CENTERVIEW` not clearing while `cl_syncinput 1`.
* Duke/RR: Remove superfluous call to `apply_seasick()`.
* RR: Change two calls from `playerSetAngle()` to `playerAddAngle()` Updated version of `playerSetAngle()` doesn't stop setting angle until target is reached, a bit too strict for this and compromised vehicle turning.
* `applylook()`: Remove dead flag. Was only used with Duke, no other game called the function when dead anyway. Since the input helpers are processed outside of `applylook()` now this is not needed.
* `applylook()`: Extend function with a bit of commentary.
* For Blood/SW, exposes `SB_LOOK_LEFT`/`SB_LOOK_RIGHT` to games, hooking up `q16look_ang` and `q16rotscrnang` within.
* For SW, use Duke & Blood's return to center function and remove `PF_TURN_180` bit.
* For RR, replace a few misused bits with some bools inside of `player_struct`.
* Since bulk of functionality is sourced from Duke (30Hz), apply proper scaling so SW speed matches (40Hz).
* For Duke/SW, we continually apply `SB_CENTERVIEW` only if it was previously a toggled action, similar to Blood.
* For SW, we remove two SW-specific bits (`PF_LOCK_HORIZ` and `PF_LOOKING`) that are no longer needed.
* For Duke, we remove `return_to_center` and just use the `SB_CENTERVIEW` action bit as required.
* For `sethorizon()`, feature set and adjustment speeds are an averaged out accumulation across Duke/SW:
** GameTicRate is factored in for adjustment decisions to provide consistency for SW being the faster game.
** Adjustment amounts are half way between Duke/SW.
* Need SW's input helpers available for Blood but therefore also need an angle delta function that does not seem to exist in Blood.
* Realise that gamecontrol.h/cpp might not be the most appropriate place, but it's a shared location and these will go into binaryangle.h when its utilisation can be more realised.
* Because SW's logic was reversed, in that param #1 was the new angle and param #2 was the current, all calls have been reversed.
* By happenstance, also fixes an issue with multiple 180° turns in quick succession.
They created different code depending on the passed index, this was changed to always emit the optional parameter, even when not needed, so that the interpreter does not need to second-guess.
Not everything will do something, though. This was some incredibly careless code operating without a safety net allowing uncontrolled write access to the map structure.
Most of the critical fields have been made read-only, which has been the only mode of access in the mods I checked.
Note that this does not enable scripting of the weapon sprite drawer, only the gameplay related features were done.
Since the added values are not scaled, doing this per frame has the potential risk of achieving too high total velocity when combined with other means of input.
The change here was kept as simple as possible.
This unexpectedly turned out a complete rewrite so now it is under my own license.
Also moved the remaining parts of map hack loading into the engine.
Overall I have to say that the feature is not what I expected, it's merely used to fudge the positioning of model sprites and for adding Polymer lights.
This isn't active, though, because load times are so short these days that all this results in is an irritating screen flash before the level starts.
It may be activated later when hires assets are in use.
Fixes#10 (or not...? ;) )
A nearly typical problem of this code. Not all relevant properties of the camera target were changed at once - there was a two frame discrepancy in which the camera pointed in some undefined direction after the change.
Fixes#15
A classic result of trying to add new stuff to Duke's spaghetti code, shit like this would not happen if this code wasn't this poorly structured.
Fixes#360 and most of #357
* Provide read-only/const results from `CONTROL_GetInput()` so games can't change received input.
* Change non-descript `info` to `hidInput` (Human Interface Device).
* Remove a few unused prototypes.
The remaining excpetions are the "give" CCMD and any level change action.
Unfortunately the implementation of most cheats is not multiplayer safe so right now it'd only be useful for demo recording (assuming that worked to begin with... ;))
This includes loading a level and busy-waiting for a sound to play.
Also block these loops and the sounds they wait for in network games to avoid problems from longer delays here.
The problem seems to be directly inherited from ZDoom which shows the same issue with screen wipes.
Fixes#297
* Remove fix16.h/cpp and utilise library from m_fixed.h.
* Extend m_fixed.h with two inline functions for int to/from float operations.
* Replace fix16_floor operations with those from xs_Float.h
* Replace multiple Q16.16 conversions from 0 to just be 0.
* Replaced all found in-game bit-shifts and multiplications/divisions with inline functions from m_fixed.h
* Replaced many casts of FRACUNIT as double in SW's panel.cpp as it is converted to double by way of type promotion.
* Fixed missed precision fixes in SW's panel.cpp where some types weren't declared correctly.
* Replaced 100+ `Cos()/Sin() >> 16` operations for Blood with inline functions `CosScale16()/SinScale16()`.
This is because 'classic' aim mode will reset the view if the mouseaim key is not pressed.
The problem with this is that an empty input packet will trigger a view reset. If the meaning is inverted the default aim mode is free mouse view which doesn't try to alter any view state and is therefore preferable for an empty packet.
Fixes#292
Timer values in interface code are undefined, these should not access anything that changes at real time.
Also use smoothratio to do the calculation in frame time, not tic time.
This has a threshold that could lead to different behavior, depending on whether synchronized or unsynchronized input is used, it also used an undefined state of gameclock for its calculations.
By basing this on the levelclock consistency is ensured.
This timer only gets incremented by the main game ticker when the playsim is running.
This timer gets used for all playsim-related timing and animations so that these are decoupled from imprecisions in the global timer.
* On the fence about this. Lower makes the game harder, and higher could mean the difference between life and death. I do think that if we're showing amounts in the magazine, full ammo should constitute a full magazine. I think the max of 200 is an oversight from the original devs as all other games have proper defaults that reflect the magazine or cylinder capacity.
The new main loop code cannot handle that. Instead set a start value for gameclock so that gameclock can be based on an arbitrary time value instead of directly representing global time.
* moved the part that alters the input before queuing it to GetInput
* moved moveloop into the main function
* reshuffled a few things for better grouping by task.
In particular this means to remove the option to disable widescreen aspect ratios. The way this was handled makes no sense with the current render backend.
The aspect ratio code will have to be redone entirely to properly obey the backend's settings.
* I doubt anyone will be running this on a system where computing a tic might take longer than a tic, but it's more consistent with the other games and is what it was.
None of this was really working anymore, but will have to be rethought once a network stream exists again.
But even then, this is better sent as a separate command, and in MP only.
Currently the bit fields are still separate and they have to be merged, but for now the added memory does not matter.
Having this structure in the common parts will allow work on consolidating the input code, though.
This needs to be called unconditionally for every frame being rendered, not all of the game modules did that.
Placing this call here ensures that it is independent of anything the games do.
* removed the timer callback stuff that came back through the backdoor.
* do not use gameclock in the UI code - use the underlying timer directly.
* UpdateSounds must still use totalclock, until this can be refactored in its entirety.
* Breaks every other game except Duke unless/until they get migrated. Done for the purpose of demonstrating PR #244.
# Conflicts:
# source/build/src/timer.cpp
# source/games/duke/src/game.cpp
* It's also better that everything be based off the one tic clock and not call `I_GetBuildTime()` to set `gameclock`. This also ensures that `gameclock` always increases in intervals of 4.
This reverts commit 63eac13d6442357fdab57067ec913a2ce8ce72db.
* Build timer still requires initialisation due to multiple `timerSetCallback()` that still need to work.
# Conflicts:
# source/core/menu/menu.cpp
# source/games/duke/src/game.cpp
* rewrote all uses of timerSetCallback. Most were unnecessary or long obsolete, the sound updates need to run per frame, not per tic and the UI tickers need to be handled in the main loop anyway.
* Use a more precise timer to animate the menu transition.
* uncouple other menu animations from the game timer.
This removes most of the InputState class because it is no longer used.
The only remaining places still checking scan codes are the modifiers for sizeup and sizedown.
All the rest was remapped to safer methods. The multiplayer taunts are currently inoperable, they will need support of shift-bindings to get proper support.
This is to cut down on boilerplate code because these encode the virtual screen size in the mode parameter, making it unnecessary to specify a virtual size separately.
* use a CVAR to decide whether to show them at the top or bottom
* draw them on top of the screen border so that they don't get overdrawn on smaller windows.