GNU platforms (Linux, kFreeBSD, Hurd) have endian.h to determine
endianness, so all architectures except x86_64 are in fact treated
identically, except that their ARCH_STRING is different.
The ARCH_STRING must always be identical to the ARCH from the Makefile,
otherwise the engine will not find its cgame, game and ui plugins
under their expected names and startup will fail. If we pass it in
from the Makefile, then an identical value is guaranteed, and we can
get rid of an increasingly long list of defined(__some_cpu__) tests.
The one remaining quirk is that we test __x86_64__ to determine
whether to define idx64; I've kept that, but separated it from
the ARCH_STRING.
On non-Linux platforms we only support a few architectures anyway,
so keeping the list up to date is less of a burden; *BSD porters
could probably use the same technique to get support for lots of
architectures with little effort, but I have not done that here,
because I cannot test it.
Windows must continue to support preprocessor-based architecture tests
in any case, so that the MSVC solutions (which do not use the Makefile)
can continue to work. However, Windows only runs on a few CPU families,
so this shouldn't be a significant burden in practice.
When cross-compiling, the tools are compiled for the build architecture
(COMPILE_PLATFORM, COMPILE_ARCH) rather than the host architecture
(PLATFORM, ARCH), so define ARCH_STRING to COMPILE_ARCH on a GNU
COMPILE_PLATFORM.
MASK_REG in EmitMovEDXStack would incorrectly emit asm if 'andit' was 0.
'andit' would never be 0 though so it wasn't causing issues.
Found by Coverity.
Windows' Sys_ListFiles would add files that contain the extension anywhere,
not only at the end of the file name.
Example: "word.pk3omghacks" use to be loaded as a pk3 file.
My last commit made it so that CGame "waterlevel 1" is feet in water,
but before it was erroneously about waist deep in water. The places
where it is checked it is suppose to be view position underwater.
Change comparisons to use correct value for view position underwater.
CG_WaterLevel() added lerpOrigin to itself instead of adding view height
when checking for waterlevel 2 and 3. This did not cause issues because
ioq3 only compared the calculated waterlevel to more or equal to 1.
Cinematic's startTime and lastTime are always set from CL_ScaledMilliseconds
which returns int and are converted back and forth to int and unsigned int.
This fixes a warning that abs() is used on an unsigned int.
If a bot is accompanying someone before map change or restart, the bot would
continue accompanying them but press up against them and orbit around them.
This is caused by the bot's formation distance being 0.
Save the formation distance so they maintain proper distance and do not
orbit around the player.
When the engine is compiled with Clang it appears that the return value
is being written to the WRONG address, either due to the vm_ variables being
changed (unexpectedly) elsewhere, or as a result of bad assembly assumptions;
having a stack variable pointing to where to write the return value seems
to do the trick.
This fixes the case where, for a trap_Register()-like call, weird numbers
are being returned when, during the process, an error message is printed
(which in Tremulous results in a QVM call and (nested) system call).
The renderer color is set to health color when drawing crosshair. After
drawing the crosshair, the renderer color was not cleared and could affect
other things. With cg_draw3dicons 0 and cg_drawCrosshairNames 0 it affected
the attacker icon.
Hopefully fixes the following warning
cg_draw.c:2315 assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Wstrict-overflow]
Revert last commit so that grapple sky check is compatible with BSPC
BotImport_Trace in (removed from repo) code/bspc/be_aas_bspq3.c.
Set bsp_trace_t::surface.flags instead of surface.value to trace_t::surfaceFlags.
surface.flags is only used for the sky check for grapple AAS reachability.
surface.value is not used at all.
bsp_trace_t is not part of the game VM API, so this does not affect VM compatibility.
BotAI_Trace in game was changed to match server. surface.value/flags are not used in game.
Only send mouse events if both values are non-zero.
Hopefully this helps with the event overflow spam that can sometimes
happen on loads or laggy situations.
q3_ui would shown bot at index of number of bots in list.
game would send empty name to addbot command and command would think skill
(i.e., 2.000000) was the bot name.
"orders" menu script is not used by Team Arena.
The same C format string was given an int or string argument depending on if
ordering a single person or everyone. Make it always use int.
Sys_SetFloatEnv in sys_unix.c existed but was not called. It sets the
rounding mode to "to nearest" which is the default on Linux. Might be
required on other platforms, I don't know.
Using unix mode 0666 for creat was causing crashes when compiled with MSVC.
So use the marcos recommended by MSDN. MinGW also has the marcos, so apply
to Windows builds in general.
Similar to one of the changes by Tim Angus in fd986da: mbstowcs' third
argument is the number of wchar_t available in dest, not the number
of bytes.
This does not appear to be exploitable, because ioquake3 does
not actually call mumble_set_identity() or mumble_set_description()
anywhere, but it might be relevant to derivatives.
Spotted via compiler warnings.
Fixed LCC to correctly diagnose expressions with NPC. It no longer reports messages such as
warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent
[17:58] <Jacker> hey, you might be interested in checking out this
4da5a397b5 (diff-acaedc9d8b492f9af8966ae68597392cR615)
[17:58] <Jacker> its related to the ddos protection code you wrote
[17:59] <Jacker> in continuation to:
ab9b08e584
[17:59] <Jacker> in a case if the client has in the past connected to
the server days/weeks earlier and time wraps the client wont be able to
connect
[18:00] <Jacker> since in that case if the bucket of that clients ip
still exists it wont get checked correctly
Game sets CS_INTERMISSION to 1 at intermission, but does not clear it at
map_restart so it's only sent the first time. CG_MapRestart manually clears
cg.intermissionStarted (which is set to value of CS_INTERMISSION when it's
modified). So subsequent intermissions do not have cg.intermissionStarted
enabled.
Now CS_INTERMISSION is cleared and sent each time intermission is started
and cg.intermissionStarted is enabled each time.
This makes subsequent intermissions not play sounds in CG_CheckLocalSounds
during the 1 second between intermission starting and switching to scoreboard
(PM_INTERMISSION) and makes Team Arena voice chats not play.
Team Arena's text functions cast signed char values to int and use as an array index.
This works fine for values 0 to 127, but not for -128 to -1 which are a negative array index.
Instead use "character & 255" like client and original Q3 ui/cgame string drawing code.
The glyph for character 255 (lower case y with two dots above it) was
rendered, but it's glyph information was not stored in fontInfo_t and
not saved into .dat file (including the ones in Team Arena).
Attempting to load it from existing .dat font files is fine because
shader name is "" and gets 0 handle. The handle was already 0 anyway.
Stencil shadow is not drawn if a mesh, or multiple meshes with the same
entity and shader, have more than 500 vertexes. The issue is caused by storing
the projected positions in the tess vertex buffer. Use a new array instead.
GL1's R_CreateImage sets GL texture to 0 before it ends, so border color is not
applied to the fog image. GL_CLAMP is not used for fog image (in either renderer),
so it would presumably not be used even if applied to the fog image.
When starting the game in windowed mode, the window buffer used whatever
was on the screen before running the game. Kind of like you could see
through the window, but it doesn't update what happens behind it.
It makes it look like something is broken or non-responsive.
So clear the window opengl buffer to black.
Credit to theinvsblman for the code.
Fix CalcFog in generic_vp.glsl to fog fogged surfaces.
Now it's the same as CalcFog in fogpass_vp.glsl.
Fixes shaders that use adjustColorsForFog. Impact wallmarks, blood sprites, flame textures and so on.
This makes pasting in client console and UI edit fields work on X11 and OS X.
Sys_GetClipboardData is only used by client, so returning NULL in dedicated is fine.
External GLSL should probably only be used for development testing,
not released products. The GLSL files are tied to the code, and the
code changes some what often.
Fixes using OpenArena 0.8.8 which has incompatible GLSL files in a pk3.
The text lines don't meet at top of the sceen in 1920x1080, restore
drawing a cut off line across the top. In 640x480 this line isn't seen
at all. This is still better then trying to draw twice as many lines
than are actually seen (the way it was before the last commit).
In the renderers, dlightbits are never cleared from world surfaces.
The dlight image does not repeat, so if it draws on extra surfaces it's
not visible.
However if using a repeating image (tr.defaultImage instead of tr.dlightImage);
* In OpenGL1 image is only drawn on surfaces close to dlight origin.
* In OpenGL2 image is draw on surfaces clearly outside the dlight radius, including past non-dlighted surfaces.
It seems there was a similar issue with pshadowBits. So update surface
dlightBits even if 0, like already done for pshadowBits. This causes
only surfaces close to origin to be affected. (Though it is a little
farther than in OpenGL1.)
I have no idea why this isn't a problem in OpenGL1.
Zero length lightmap lump will have NULL tr.lightmaps.
OpenGL1 already has this check, because r_vertexLight 1
would crash Team Arena. OpenGL2 does not disable loading lightmaps
when r_vertexLight is 1 though, so it does not have that issue.
SDL1.2 branch disables key repeat when key catcher is 0.
Presumably to prevent binds from executing multiple times.
SDL2 replaced being able to disabled key repeat using SDL_EnableKeyRepeat
with a non-zero repeat value in the key event.
UI's PositionRotatedEntityOnTag is different than CGame's and
UI has switched pitch/roll for Gauntlet/BFG axis to get it to
look like /close to/ how it looks in CGame.
Making UI use the same *PositionRotatedEntityOnTag and axis as
CGame fixes the Gauntlet blade being wobbly in controls menu.
In Team Arena's Harvester mode, players corrupt your memory from beyond
the grave. Gib the players to stop the corruption!
CG_PlayerTokens is called for player entities, including corpses.
The entity number is used for the index in cg.skulltrails which only has
MAX_CLIENTS elements. This results in incorrect memory being overwritten
for corpse entities (as the entity number is >= MAX_CLIENTS).
So limit skull trails to valid entities (entity number < MAX_CLIENTS).
If a pk3 search path is passed to FS_FOpenFileReadDir, a non-zero
file handle is returned if file is not found. This causes incorrect
behavior in FS_ReadFileDir (when a pk3 search path is passed in)
which only checks file handle, not length, for seeing if file exists.
I don't know of any issues in ioq3 caused by this.
Setting SDL_GL_ACCELERATED_VISUAL was disabled for ioq3 SDL 1.2
for other reasons. However, it causes creating GL context to fail
if multisampling is enabled on X11 for both SDL1.2 and SDL2.
Tested using nVidia proprietary driver on Debian 7.
It doubles the size of the data compared to the default (22050),
so increase the buffer automatically. Likewise, decreasing speed
doesn't need as much (though that doesn't really matter).
If spawn var key or value is "" it caused R_GetEntityToken (available to
cgame, used by opengl2) to stop parsing, whereas game VM would continue.
Changed it to match parsing used for game VM
(see G_GET_ENTITY_TOKEN in code/server/sv_game.c).
The map poq3dm5 has a "wait" key with value "".
When R_GetEntityToken returns qfalse it resets pointer for parsing, by
R_ParseSpawnVars not returning qfalse it could cause an infinite loop.
Also add newlines to printfs.
Vertex lite surfaces being brighter than light maps looks bad,
they're meant to look the same. Especially in ET, which mixes
them fequently. It's noticeable in Q3 too though.
BSP lightmaps (i.e. not external HDR lightmaps) use
R_ColorShiftLightingBytes, now *Floats (used by vertex colors)
has the same behavior.
This may be a problem for HDR lightmaps, as the RGB will always be
scaled to 0.0 to 1.0 range.
I had enabled this for non-HDR before, but now HDR needs it too.