yquake2/yquake2 — pull request #24 by alericoveri (2013-05-03 22:40:01+00:00)
Title: FEATURE: Refresher and Client with no imports and exports (no polymorphism).

### IMPORTANT NOTE: Although this has been heavily tested across systems, it still needs to be tested, THIS IS A BIG CHANGE so please take your time to test, evaluate and discuss this branch. I really wish to (at least) discuss this. All has been designed to make quake2 subsystems a lot simpler but without altering any of its behaviours.

With the intention of making quake2 a lot more simple, **I have made this branch who implements a refresher and a client who have been heavily modified**. They are now tightly embedded into the Q2 kernel so that there is no polymorphism and crazy imports/exports between client and refresher who were sharing a bunch of function pointers, it was perfectly OK back in 1997 but I do not see it anymore relevant today.

I have run several tests on this branch on the following platforms:

* Ubuntu 12.10 x86_64 Intel(R) Pentium(R) CPU G645 @ 2.90GHz + Intel® Sandybridge Desktop + 3.0 Mesa DRI Sandbridge Desktop
* Ubuntu 13.04 x86_64 Intel(R) Pentium(R) CPU G645 @ 2.90GHz + Intel® Sandybridge Desktop + 3.0 Mesa DRI Sandbridge Desktop
* Apple iMac mid '07 OSX 10.8.2 Intel Core 2 Duo @ 2.0 GHz + ATI Radeon HD 2400 XT 128MB GDDR3
* Ubuntu 13.04 x86_64 Intel Pentium E2160 @ 1.8 GHz + Geforce 8600GT 512MB DDR3 + nvidia-glx 310.44
* Ubuntu 13.04 x86_64 Intel Pentium Dual Core E5700 @ 3.00 Ghz + Intel G41 + 3.0 Mesa DRI Intel G41

*I know already I have no Windows boxes in my place or office :(, I work on Ubuntu machines mostly :) ...* I will preciate your help on this matter

In resume, these are the changes I have made:

* `Makefile` severely modified, it doesn't build `ref_gl.so` anymore, refresher source files now compile with kernel, client and server subsystems to make an unique `quake2` executable, that means: no more `ref_gl.so` :). The same build options are still available and working.
* It was necessary to reimplement input backend from client's point of view (`backends/generic/vid.c`) thus, original `IN_` pointers are no longer useful.
* Refresh imports and exports were eliminated and their function pointers references were translated to their equivalent function. For example `ri.Sys_GetProcAddress` -> `Sys_GetProcAdress`, `re.DrawChar` -> `Draw_Char`. In consequence, several function declarations (like R_'s and VID_'s) were moved to certain headers (`src/client/header/vid.h` and `src/client/header/ref.h`) so they become 'public'.
* `R_GetRefAPI` is no longer necessary.
* In consequence, `vid_ref` cvar became no longer relevant, so it's now eliminated, changes were made so that `vid_fullscreen` is checked in every `VID_CheckChanges` to determine if a `VID_LoadRefresh` is necessary or not.
* It has been compiled with `gcc` and `clang` (on OSX and Ubuntu)

I know that C polymorphism was more than a neat solution back in 1997 and that was because basically PC game software engineering was a lot different than it is now. But today, an engine who switches dynamically between different renderers in such way doesn't seem to be relevant anymore, in fact, despite it is a nice solution for abstraction it tends to complicate things a lot. Support for OpenGL implementations is rock solid now, and for that OpenGL is the *de facto* standard for computer game programming. This is only my point of view and thus, it can be discussed as well, I'm open to your opinions.

This is my part of my huge effort of cleaning up and organizing quake2 source code, so I know there's still much left to do and I hope this will ease things up a little bit. In advance, I want to apologize for my english, because I know it's no so good :p ...

Cheers,
Alejandro Ricoveri