Author: noccy
Thanks for the patch!
Format and additional changes by me.
Close ticket:2110
(cherry picked from commit e979b6ad620f27e746f119fefd1f613bbb61b8a4)
Conflicts:
src/keybind.c
src/keybind.h
These cases of bitshifting are premature optimisations ''only'',
especially since they obscure what's really going on (finding the center
of a range).
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
rendSurface isn't used by rendmode.c, so define it in piemode.c where it
is both used and its contents are defined.
Additionally remove unnecessary #includes from rendmode.h and include
the correct headers at places where rendmode.h was included.
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
Global pointer psRendSurface only ever contains &rendSurface (another
global), provided that it isn't undefined (isn't statically NULL
initialised). So replace the use of this pointer with using
rendSurface.
Additionally remove function iV_RenderAssign, which only wraps the
psRendSurface assignment along with a debug() call, and inline it at its
only call-site.
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
Remove the write only member variable `flags` from struct iSurface.
Additionally remove the macros REND_SURFACE_(UNDEFINED|SCREEN|USR) which
were only used to assign to the `flags` variable.
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
Mark the prototypes of all (fixed point) trigonometric functions as
pure. This declares that these functions don't have any side-effects.
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
In 697a97ff18, my interpretation of the
performed matrix math was wrong as a result of (wrongly) reading [xyz]^2
as [xyz]*2. This commit fixes that error.
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
Use multiplication and division instead of bitshifting as its
conceptually easier to understand (mathematically).
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
The variables [xy]pshift only ever contain the constant value `10`, so
instead of bothering to keep the variables around use the
STRETCHED_Z_SHIFT constant. This constant serves the same purpose as
[xy]pshift (only for the Z coordinate) and is defined to `10` as well.
Signed-off-by: Giel van Schijndel <giel@wz2100.net>
Don't retrieve the current matrix mode prior to changing it, and restore
this mode after drawing text. Instead rely on the assumption that the
current matrix mode is GL_MODELVIEW, which currently is a valid
assumption.
Reason for this change is that OpenGL retrieving the current matrix mode
isn't possible in OpenGL implementations without fixed pipeline, which
lack a matrix mode, e.g. OpenGL ES 2.0 and OpenGL 3.0.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11699 4a71c877-e1ca-e34f-864e-861f7616d084
Almost completely (one corner case requires reading GL specs) replace
immediate-mode rendering with VA-based rendering by means of
glDrawArrays.
This, when completed, makes porting to OpenGL ES 2.0 and OpenGL 3.0
without backwards compatibility easier.
This closes#2172
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11686 4a71c877-e1ca-e34f-864e-861f7616d084
Add a header to allow platform-indepent inclusion of the OpenGL API,
removing our dependency on SDL_opengl.h and consolidating
platform-specific code in that single header.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11677 4a71c877-e1ca-e34f-864e-861f7616d084