Commit Graph

2875 Commits

Author SHA1 Message Date
Simon McVittie 01bfb1540f UI_BuildFindPlayerList: avoid array underflow
This function is used in the Team Arena menus

I don't think it's actually possible to reach this line with
foundPlayerServerNames < 1, because by the time we get here we have
set it to 1 + the actual number of servers; but if we did, it would
clearly underflow into foundPlayerServerNames[-1], which would be
undefined behaviour. gcc 6 diagnoses this with a warning:

code/ui/ui_main.c: In function ‘UI_BuildFindPlayerList’:
code/ui/ui_main.c:4138:16: warning: array subscript is below array bounds [-Warray-bounds]

Also correct the sizeof() invocation to make it more obviously
correct (in fact the buffers for names and addresses happen to both
be of size MAX_ADDRESSLENGTH, so it was fine, but it's good to be
obvious).
2016-09-25 17:13:47 +01:00
Simon McVittie c5b6bb0d4b snd_wavelet: avoid undefined pointer below array bounds
Given an array b[] of length n, pointers to &b[0]..&b[n] are defined
(where only &b[0]..&b[n-1] can be validly dereferenced). &b[-1], or
equivalently b-1, is not something we can use in valid Standard C.

gcc 6 diagnoses this as:

code/client/snd_wavelet.c:33:9: warning: array subscript is below array bounds [-Warray-bounds]

and might take this undefined behaviour as permission to emit
"more efficient" object code that is not what the author expected,
for example nothing at all. Use a macro to fake a 1-based array instead.
2016-09-25 17:13:40 +01:00
SmileTheory 8417c184b4 OpenGL2: Clamp entity lighting to more resemble OpenGL1. 2016-09-14 04:19:46 -07:00
SmileTheory 8749d62bbd OpenGL2: Remove per fragment tangent space calculation code. 2016-09-14 03:57:51 -07:00
SmileTheory 4faf1008a0 OpenGL2: Remove map color scaling and r_forceSunMapLightScale.
Also simplify overbright code in ComputeShaderColors().
2016-09-14 02:59:54 -07:00
Tim Angus 4c169ab574 Merge pull request #221 from tkoeppe/strncpy
[code/botlib/l_precomp.c] Fix string buffer overflow
2016-09-13 13:55:08 +01:00
Thomas Köppe 90f2f02c55 [code/botlib/l_precomp.c] Fix string buffer overflow 2016-09-13 13:37:19 +01:00
Tim Angus bd062f713a Merge pull request #216 from tkoeppe/abs
[renderergl2/tr_main.c] Use floating-point fabsf() for floating-point values
2016-09-13 10:34:48 +01:00
SmileTheory bbc9e263f0 OpenGL2: Fix more reversed VectorCopy4() usage. 2016-09-13 01:41:46 -07:00
Tim Angus 7d063ba81d Merge pull request #220 from tkoeppe/shift
[qcommon/msg.c] Remove dead code
2016-09-12 18:00:21 +01:00
Thomas Köppe fe111df610 [qcommon/msg.c] Remove dead code (which had undefined behaviour) 2016-09-12 13:32:59 +01:00
SmileTheory ec3779988c OpenGL2: Fix reversed VectorCopy4() usage. 2016-09-11 16:08:18 -07:00
SmileTheory 497a74f22a Fix undefined behavior when shifting left by 32.
https://bugzilla.icculus.org/show_bug.cgi?id=6432
2016-09-07 16:56:23 -07:00
SmileTheory 927c9cc23c OpenGL2: Make R_FreeSurfaceGridMeshData() static. 2016-09-07 14:59:19 -07:00
SmileTheory f9e5712311 OpenGL2: Fix missing bounds calculation when loading BSP surfaces. 2016-09-06 19:44:14 -07:00
SmileTheory dfbaf50324 OpenGL2: Store normals/tangents as int16_t[4]. 2016-09-06 00:57:15 -07:00
Thomas Köppe 0eb72cd8c4 [renderergl2/tr_main.c] Use floating-point fabsf() for floating-point values 2016-09-01 17:29:32 +01:00
Tim Angus 762f50757d Merge pull request #213 from tkoeppe/abs
[game/ai_main.c] Use floating-point fabs() for floating-point values
2016-08-23 21:19:36 +01:00
Thomas Köppe 3c8da8ca07 [game/ai_main.c] Use floating-point fabs() for floating-point values 2016-08-23 19:36:27 +01:00
SmileTheory c5c01e771a Fix joystick w/o controller mapping not working with SDL update. 2016-08-16 19:01:18 -07:00
James Canete fb65e1232f Merge pull request #212 from MAN-AT-ARMS/sdl204-stripped
Add stripped SDL2 reference dll's to repo
2016-08-16 18:57:30 -07:00
MAN-AT-ARMS 966d39efed Add stripped SDL2 reference dll's to repo 2016-08-16 10:50:24 -04:00
James Canete e8c5b3a535 Merge pull request #207 from MAN-AT-ARMS/sdl204
Update SDL2 to 2.0.4
2016-08-16 01:18:05 -07:00
MAN-AT-ARMS 4f9310dfa4 Update SDL2 to 2.0.4 2016-08-15 22:20:00 -04:00
SmileTheory 4ce600f5ac Missing bit of previous commit. 2016-08-14 22:33:48 -07:00
SmileTheory fe8ac838e2 OpenGL2: Preallocate grid surfaces like other BSP surfaces. 2016-08-14 22:22:20 -07:00
SmileTheory 1cf0b21cda Fix black screen when in_joystick disabled but controller connected. 2016-08-11 00:46:43 -07:00
Zachary J. Slater f47aaa2a61 Minor URL change. 2016-08-07 23:53:38 -10:00
SmileTheory 6262972488 Fix stricmp usage in previous commit. 2016-08-08 02:43:02 -07:00
SmileTheory b7f2ebd477 Better gamepad support. 2016-08-08 02:36:10 -07:00
Zachary J. Slater 879fb555a5 Minor updates to README.md
Removed some language about the old mailing list, pointed to forums,
and more accurately to the
wiki, updated reference to SDL.
Zardoz speaks to you, His chosen ones.
2016-08-04 21:05:33 -10:00
SmileTheory d09866861e Controller hot plug support. 2016-08-04 21:32:35 -07:00
SmileTheory 1972128927 Better defaults for joystick axes.
These changed from SDL1->SDL2 afaict.
2016-08-04 21:31:26 -07:00
SmileTheory 5252e28163 OpenGL2: Fix shader error logs. 2016-08-04 20:16:22 -07:00
SmileTheory 29ac117154 OpenGL2: Let unlit materials use parallax maps. 2016-07-29 01:53:50 -07:00
SmileTheory e022abeebb OpenGL2: Fix GL_EXT_direct_state_access function names. 2016-07-28 20:04:25 -07:00
Tim Angus 1051df45e3 Merge pull request #197 from tkoeppe/null
[null/null_glimp.c] Fix bitrot in null impl
2016-07-26 11:03:22 +01:00
Thomas Köppe bbe99a8c6b [null/null_glimp.c] Fix up bitrot in null impl 2016-07-26 10:52:15 +01:00
SmileTheory 716438168f OpenGL2: Use loader for all extension funcs. 2016-07-26 00:41:31 -07:00
Tim Angus 2ef99c8528 Merge pull request #195 from tkoeppe/intfix
Fix signedness and float/int issues with abs()
2016-07-25 21:08:07 +01:00
Thomas Köppe 18d6c8fda2 [botlib] Use floating point absolute value rather than truncate to integer 2016-07-25 18:36:31 +01:00
Thomas Köppe 9a5add2b60 [tools/asm/q3asm.c] Remove 'abs(unsigned)', which is unnecessary and potentially wrong 2016-07-25 18:35:33 +01:00
SmileTheory f0086e8c2a OpenGL2: Add new GL function loader. 2016-07-25 06:30:25 -07:00
SmileTheory 251c983681 OpenGL2: Require OpenGL 2.0. 2016-07-24 21:29:13 -07:00
James Canete ebc7894777 Fix OpenGL2 readme missing text in md 2016-07-11 20:47:39 -07:00
Zack Middleton 0ad4381a11 Make using Yacc optional, disabled by default
A built-in GNU Make rule causes code/tools/lcc/lburg/gram.y to replace
gram.c if gram.y has a newer modified time. This causes git diff to
pick up changes to gram.c, which seems to have been manually modified
to fix warnings and may vary by Yacc used to create it. It also
requires installing a program to generate a file that already exists
in a usable state in the code repository.

So replace the built-in rule so it is only used if USE_YACC is 1
(defaults to 0). The Yacc executable name can be overriden using
`make YACC=yacc` like before.

I preferred to touch gram.c instead of installing Yacc because of the
problems it causes. It doesn't really seem like a good idea to recommend
others do that instead of disabling Yacc the Makefile though.
2016-07-11 07:51:34 -05:00
Zack Middleton 4474297af8 Fix bot team order to kill last player it killed
Bot's lastkilledplayer was set to -1 after carrying out an ordered kill.
Later in BotChat_Random() the PlayerName function was passed -1 which
caused a "Error: PlayerName: playernum out of range" message.

I think the reason it was set to negative one is so that if the bot is
ordered to kill the player again, the bot will not say it's done and
drop the goal. Though, if the bot killed the player based on it's own
decision, it will just say it's done and drop the goal (bug?).

Let's check the time of the last kill to see if it happened since the
team order was received instead of setting lastkilledplayer to -1
after completing the team ordered kill. This fixes bot dropping goal
if target player was the last player they killed and the PlayerName
out of range error.
2016-07-11 05:20:36 -05:00
Zack Middleton 274fa898b1 Fix typo of empty in ai_main.c 2016-06-27 21:13:27 -05:00
Thilo Schulz 9d6a95d4ad Missed this Cvar_Get() on com_introPlayed 2016-06-16 03:29:26 +02:00
Thilo Schulz bb7ad55382 Only play logo/intro if their filenames have been defined in q_shared.h 2016-06-16 03:01:21 +02:00