Changes in [122:4a3bae9504ee:2:10c3bca620af]
- Files:
-
- 1 added
- 4 removed
- 74 modified
-
ChangeLog (modified) (1 diff)
-
Makefile (modified) (18 diffs)
-
misc/entities.def (modified) (1 diff)
-
misc/release.sh (deleted)
-
misc/server.cfg (added)
-
misc/tremulous-server (deleted)
-
misc/tremulous-server.bat (deleted)
-
src/cgame/cg_buildable.c (modified) (15 diffs)
-
src/cgame/cg_consolecmds.c (modified) (2 diffs)
-
src/cgame/cg_draw.c (modified) (19 diffs)
-
src/cgame/cg_event.c (modified) (5 diffs)
-
src/cgame/cg_local.h (modified) (9 diffs)
-
src/cgame/cg_main.c (modified) (11 diffs)
-
src/cgame/cg_players.c (modified) (3 diffs)
-
src/cgame/cg_predict.c (modified) (5 diffs)
-
src/cgame/cg_scanner.c (modified) (2 diffs)
-
src/cgame/cg_servercmds.c (modified) (4 diffs)
-
src/cgame/cg_snapshot.c (modified) (1 diff)
-
src/cgame/cg_tutorial.c (modified) (3 diffs)
-
src/cgame/cg_view.c (modified) (8 diffs)
-
src/cgame/cg_weapons.c (modified) (3 diffs)
-
src/client/cl_cgame.c (modified) (1 diff)
-
src/client/cl_console.c (modified) (3 diffs)
-
src/client/cl_curl.c (modified) (3 diffs)
-
src/client/cl_curl.h (modified) (2 diffs)
-
src/client/cl_keys.c (modified) (2 diffs)
-
src/client/cl_main.c (modified) (9 diffs)
-
src/client/cl_scrn.c (modified) (6 diffs)
-
src/client/client.h (modified) (3 diffs)
-
src/client/keys.h (modified) (1 diff)
-
src/client/qal.c (modified) (1 diff)
-
src/client/qal.h (modified) (2 diffs)
-
src/client/snd_codec.c (modified) (1 diff)
-
src/client/snd_codec_ogg.c (modified) (1 diff)
-
src/client/snd_openal.c (modified) (2 diffs)
-
src/game/bg_lib.c (modified) (12 diffs)
-
src/game/bg_lib.h (modified) (2 diffs)
-
src/game/bg_misc.c (modified) (81 diffs)
-
src/game/bg_pmove.c (modified) (20 diffs)
-
src/game/bg_public.h (modified) (31 diffs)
-
src/game/bg_slidemove.c (modified) (1 diff)
-
src/game/g_active.c (modified) (25 diffs)
-
src/game/g_admin.c (modified) (46 diffs)
-
src/game/g_admin.h (modified) (6 diffs)
-
src/game/g_buildable.c (modified) (42 diffs)
-
src/game/g_client.c (modified) (14 diffs)
-
src/game/g_cmds.c (modified) (51 diffs)
-
src/game/g_combat.c (modified) (11 diffs)
-
src/game/g_local.h (modified) (18 diffs)
-
src/game/g_main.c (modified) (35 diffs)
-
src/game/g_maprotation.c (modified) (5 diffs)
-
src/game/g_misc.c (modified) (1 diff)
-
src/game/g_missile.c (modified) (1 diff)
-
src/game/g_mover.c (modified) (2 diffs)
-
src/game/g_physics.c (modified) (1 diff)
-
src/game/g_public.h (modified) (4 diffs)
-
src/game/g_session.c (modified) (3 diffs)
-
src/game/g_spawn.c (modified) (1 diff)
-
src/game/g_svcmds.c (modified) (3 diffs)
-
src/game/g_syscalls.c (modified) (1 diff)
-
src/game/g_team.c (modified) (2 diffs)
-
src/game/g_trigger.c (modified) (2 diffs)
-
src/game/g_utils.c (modified) (5 diffs)
-
src/game/g_weapon.c (modified) (12 diffs)
-
src/libs/win32/libSDL.la (deleted)
-
src/qcommon/cmd.c (modified) (12 diffs)
-
src/qcommon/common.c (modified) (3 diffs)
-
src/qcommon/files.c (modified) (3 diffs)
-
src/qcommon/q_shared.h (modified) (3 diffs)
-
src/qcommon/qcommon.h (modified) (2 diffs)
-
src/server/sv_ccmds.c (modified) (3 diffs)
-
src/server/sv_client.c (modified) (2 diffs)
-
src/server/sv_main.c (modified) (2 diffs)
-
src/ui/ui_local.h (modified) (3 diffs)
-
src/ui/ui_main.c (modified) (47 diffs)
-
src/ui/ui_players.c (modified) (2 diffs)
-
src/ui/ui_shared.c (modified) (28 diffs)
-
ui/infopanes.def.h (modified) (1 diff)
-
ui/menudef.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r38 r0 1 DnC Eggy r12 ------------3 4 Major features changes5 -----------------------6 * replace tremulous svn923 "callvote draw" by the old "callvote nextmap"7 * Added !warn admin command, use g_adminWarnMessage to change default8 displayed message.9 * Added jetpack power limit support, using cvar g_jetpackLimit10 * www download (TJW)11 * dretch punt (TJW)12 * Backporting tremulous protocol13 (http://www.mercenariesguild.net/patches/?do=details&task_id=2)14 * New defaults (np)15 * enable friendly fire16 * enable team force balance17 * set vote limit to 218 * set max client to 1219 * set chat team prefix to 120 * set mark deconstruct to 021 * set g_MapsConfigs to "mapconfigs"22 * Credit transfer system (sharing) (mnp)23 * Sudden death modes (tjw)24 * Recovers ckit with blaster (risujin)25 * Set a min admin level to talk during spec (lakitu7)26 * Add a !restart keepteam and !restart switchteam options (lakitu7)27 * Permit to aliens to evolve near overmind, even if there a28 human near (david)29 * Disable chomp during a pounce (tjw)30 * Use a node to teleport to another node (risujin)31 * Add an !info command to print informations about server (benmachine)32 * Add a value to unlagged to give a half-unlagged effect33 * Donate feature to share credits to all team34 * add a g_grangerMode cvar to make alien bulider always respawn basic35 granger when overmind down36 * Add a !slap command (Risujing)37 * Add cvar g_reactorBuildPoints, g_repeaterBuildPoints,38 g_overmindBuildPoints and g_eggBuildPoints, to give buildpoint capacity39 to buildings. Buildings can be built with one of there power generator40 only if generator has enough buildpoints. Enable or disable the feature41 with g_zoneBuildPoints42 * Set a cvar g_autoDonate, which autodonate money to your teammates43 if you reach your max money.44 * Make a flood protection (lakitu7, r1ch)45 * Repeater can be built to s1. Add a g_repeaterOnReactor cvar. If on,46 players selecting a reactor when reactor allready built choose a repeater47 instead. It permit to select a repeater from UI without changes on client.48 * Add arguments to '!' commands and /exec command49 * Add cvar substitution50 * Add commands /if, /math and /concat51 * Add cvars g_version, and cg_version containing game version of game52 binary and cgame binary.53 54 Minor features changes55 -----------------------56 * Prevent connecting players from being vote kicked57 * Max ping override for admins58 * Improved !listadmins, see59 http://www.mercenariesguild.net/patches/?do=details&task_id=8960 * teamkill messages (TJW)61 * vote message in console (TJW)62 * No echo to console (TJW)63 * Colorize chat console messages (Napkin)64 * Display building message (Peoro)65 * Reset credit cost when having full life (Moci)66 * LogOnlyPrintf function (Napkin)67 * Add clientTeamClass log entry (Wolfwings)68 * Stick a spec to a player. If player die, spectator keep player69 following (r1ch)70 * Change team message (Peoro)71 * Improve team messages (Peoro)72 * Namelog show prohibitions (Peoro)73 * Deny black names (np)74 * Privmsg can target console user (npa)75 * Muted can't change name (kristall)76 * Deny names starting with digits to be sure it don't make confusion77 with slot numbers (lakitu7)78 * Add a Realtime entry to logs at mapstart79 * Permit to decon exploding building during SD80 * Make private message are invisible to console and logs81 82 Bug fixes/development issues83 ----------------------------84 * Remove -ffast-math compilation flag (to fix 99 damages pounce85 with a .so game file bug)86 * Fixed team change messages87 * Removed useless checks in team managment system88 * Fix autobalance bug89 * Fix "spawn is NULL" crash bug90 * Fix to bug where crouching and moving wouldn't replenish stamina91 (tremulous svn 1021 - tm)92 * Guid is now checked, a non-valid GUID will be listed as XXX ...93 * Fix color displaying (Napkin)94 * Don't join during warmup fix (Kristall)95 * Random layout fix (Peoro)96 * Make it's possible to build over opponents cadavers97 * Never reloading when having full ammo98 * Reloading weapon and take blaster make blaster reloading99 * Fix building repeater without reactor bug100 101 Tremulous svn r992102 ----103 104 To take a look for tremulous svn r992 changelog, type:105 svn log -r992:755 svn://svn.icculus.org/tremulous/trunk106 107 1 1.1.0 108 2 ----- -
Makefile
r122 r0 182 182 183 183 ifeq ($(USE_OPENAL),1) 184 BASE_CFLAGS += -DUSE_OPENAL 184 BASE_CFLAGS += -DUSE_OPENAL=1 185 185 ifeq ($(USE_OPENAL_DLOPEN),1) 186 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN 186 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1 187 187 endif 188 188 endif 189 189 190 190 ifeq ($(USE_CURL),1) 191 BASE_CFLAGS += -DUSE_CURL 191 BASE_CFLAGS += -DUSE_CURL=1 192 192 ifeq ($(USE_CURL_DLOPEN),1) 193 BASE_CFLAGS += -DUSE_CURL_DLOPEN 193 BASE_CFLAGS += -DUSE_CURL_DLOPEN=1 194 194 endif 195 195 endif 196 196 197 197 ifeq ($(USE_CODEC_VORBIS),1) 198 BASE_CFLAGS += -DUSE_CODEC_VORBIS 199 endif 200 201 OPTIMIZE = -O 2-funroll-loops -fomit-frame-pointer198 BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 199 endif 200 201 OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer 202 202 203 203 ifeq ($(ARCH),x86_64) 204 OPTIMIZE = -O 2 -fomit-frame-pointer-funroll-loops \204 OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -funroll-loops \ 205 205 -falign-loops=2 -falign-jumps=2 -falign-functions=2 \ 206 206 -fstrength-reduce … … 209 209 else 210 210 ifeq ($(ARCH),x86) 211 OPTIMIZE = -O 2 -march=i586 -fomit-frame-pointer\211 OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math \ 212 212 -funroll-loops -falign-loops=2 -falign-jumps=2 \ 213 213 -falign-functions=2 -fstrength-reduce … … 320 320 321 321 ifeq ($(ARCH),ppc) 322 OPTIMIZE += -faltivec -O 2322 OPTIMIZE += -faltivec -O3 323 323 endif 324 324 ifeq ($(ARCH),x86) … … 335 335 336 336 ifeq ($(USE_OPENAL),1) 337 BASE_CFLAGS += -DUSE_OPENAL 337 BASE_CFLAGS += -DUSE_OPENAL=1 338 338 ifneq ($(USE_OPENAL_DLOPEN),1) 339 339 CLIENT_LDFLAGS += -framework OpenAL 340 340 else 341 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN 341 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1 342 342 endif 343 343 endif 344 344 345 345 ifeq ($(USE_CURL),1) 346 BASE_CFLAGS += -DUSE_CURL 346 BASE_CFLAGS += -DUSE_CURL=1 347 347 ifneq ($(USE_CURL_DLOPEN),1) 348 348 CLIENT_LDFLAGS += -lcurl 349 349 else 350 BASE_CFLAGS += -DUSE_CURL_DLOPEN 350 BASE_CFLAGS += -DUSE_CURL_DLOPEN=1 351 351 endif 352 352 endif 353 353 354 354 ifeq ($(USE_CODEC_VORBIS),1) 355 BASE_CFLAGS += -DUSE_CODEC_VORBIS 355 BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 356 356 CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg 357 357 endif … … 365 365 $(LIBSDIR)/macosx/libSDL-1.2.0.dylib 366 366 367 OPTIMIZE += -f align-loops=16367 OPTIMIZE += -ffast-math -falign-loops=16 368 368 369 369 ifneq ($(HAVE_VM_COMPILED),true) … … 402 402 403 403 ifeq ($(USE_OPENAL),1) 404 BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN 404 BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1 405 405 endif 406 406 407 407 ifeq ($(USE_CURL),1) 408 BASE_CFLAGS += -DUSE_CURL 408 BASE_CFLAGS += -DUSE_CURL=1 409 409 ifneq ($(USE_CURL_DLOPEN),1) 410 410 BASE_CFLAGS += -DCURL_STATICLIB … … 413 413 414 414 ifeq ($(USE_CODEC_VORBIS),1) 415 BASE_CFLAGS += -DUSE_CODEC_VORBIS 416 endif 417 418 OPTIMIZE = -O 2 -march=i586 -fno-omit-frame-pointer\415 BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 416 endif 417 418 OPTIMIZE = -O3 -march=i586 -fno-omit-frame-pointer -ffast-math \ 419 419 -falign-loops=2 -funroll-loops -falign-jumps=2 -falign-functions=2 \ 420 420 -fstrength-reduce … … 476 476 477 477 ifeq ($(USE_OPENAL),1) 478 BASE_CFLAGS += -DUSE_OPENAL 478 BASE_CFLAGS += -DUSE_OPENAL=1 479 479 ifeq ($(USE_OPENAL_DLOPEN),1) 480 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN 480 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1 481 481 endif 482 482 endif 483 483 484 484 ifeq ($(USE_CODEC_VORBIS),1) 485 BASE_CFLAGS += -DUSE_CODEC_VORBIS 485 BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 486 486 endif 487 487 488 488 ifeq ($(ARCH),axp) 489 489 BASE_CFLAGS += -DNO_VM_COMPILED 490 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O 2-funroll-loops \490 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -funroll-loops \ 491 491 -fomit-frame-pointer -fexpensive-optimizations 492 492 else 493 493 ifeq ($(ARCH),x86) 494 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O 2-mtune=pentiumpro \495 -march=pentium -fomit-frame-pointer -pipe \494 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -mtune=pentiumpro \ 495 -march=pentium -fomit-frame-pointer -pipe -ffast-math \ 496 496 -falign-loops=2 -falign-jumps=2 -falign-functions=2 \ 497 497 -funroll-loops -fstrength-reduce … … 568 568 BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 -mips3 \ 569 569 -nostdinc -I. -I$(ROOT)/usr/include -DNO_VM_COMPILED 570 RELEASE_CFLAGS=$(BASE_CFLAGS) -O 2570 RELEASE_CFLAGS=$(BASE_CFLAGS) -O3 571 571 DEBUG_CFLAGS=$(BASE_CFLAGS) -g 572 572 … … 607 607 -pipe -DUSE_ICON $(shell sdl-config --cflags) 608 608 609 OPTIMIZE = -O 2-funroll-loops609 OPTIMIZE = -O3 -ffast-math -funroll-loops 610 610 611 611 ifeq ($(ARCH),sparc) 612 OPTIMIZE = -O 2-falign-loops=2 \612 OPTIMIZE = -O3 -ffast-math -falign-loops=2 \ 613 613 -falign-jumps=2 -falign-functions=2 -fstrength-reduce \ 614 614 -mtune=ultrasparc -mv8plus -mno-faster-structs \ … … 616 616 else 617 617 ifeq ($(ARCH),x86) 618 OPTIMIZE = -O 2 -march=i586 -fomit-frame-pointer\618 OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math \ 619 619 -funroll-loops -falign-loops=2 -falign-jumps=2 \ 620 620 -falign-functions=2 -fstrength-reduce … … 652 652 BASE_CFLAGS=-DNO_VM_COMPILED 653 653 DEBUG_CFLAGS=$(BASE_CFLAGS) -g 654 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O 2654 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 655 655 656 656 SHLIBEXT=so … … 700 700 701 701 ifeq ($(USE_LOCAL_HEADERS),1) 702 BASE_CFLAGS += -DUSE_LOCAL_HEADERS 702 BASE_CFLAGS += -DUSE_LOCAL_HEADERS=1 703 703 endif 704 704 … … 1257 1257 $(B)/base/game/bg_pmove.o \ 1258 1258 $(B)/base/game/bg_slidemove.o \ 1259 $(B)/base/game/bg_lib.o \1260 1259 $(B)/base/cgame/cg_consolecmds.o \ 1261 1260 $(B)/base/cgame/cg_buildable.o \ … … 1287 1286 1288 1287 CGOBJ = $(CGOBJ_) $(B)/base/cgame/cg_syscalls.o 1289 CGVMOBJ = $(CGOBJ_:%.o=%.asm) 1288 CGVMOBJ = $(CGOBJ_:%.o=%.asm) $(B)/base/game/bg_lib.asm 1290 1289 1291 1290 $(B)/base/cgame$(ARCH).$(SHLIBEXT): $(CGOBJ) … … 1308 1307 $(B)/base/game/bg_pmove.o \ 1309 1308 $(B)/base/game/bg_slidemove.o \ 1310 $(B)/base/game/bg_lib.o \1311 1309 $(B)/base/game/g_mem.o \ 1312 1310 $(B)/base/game/g_active.o \ … … 1335 1333 1336 1334 GOBJ = $(GOBJ_) $(B)/base/game/g_syscalls.o 1337 GVMOBJ = $(GOBJ_:%.o=%.asm) 1335 GVMOBJ = $(GOBJ_:%.o=%.asm) $(B)/base/game/bg_lib.asm 1338 1336 1339 1337 $(B)/base/game$(ARCH).$(SHLIBEXT): $(GOBJ) … … 1359 1357 \ 1360 1358 $(B)/base/game/bg_misc.o \ 1361 $(B)/base/game/bg_lib.o \1362 1359 $(B)/base/qcommon/q_math.o \ 1363 1360 $(B)/base/qcommon/q_shared.o 1364 1361 1365 1362 UIOBJ = $(UIOBJ_) $(B)/base/ui/ui_syscalls.o 1366 UIVMOBJ = $(UIOBJ_:%.o=%.asm) 1363 UIVMOBJ = $(UIOBJ_:%.o=%.asm) $(B)/base/game/bg_lib.asm 1367 1364 1368 1365 $(B)/base/ui$(ARCH).$(SHLIBEXT): $(UIOBJ) -
misc/entities.def
r118 r0 1023 1023 1024 1024 -------- KEYS -------- 1025 d mg: amount of damage to deal (default: 5)1025 damage: amount of damage to deal (default: 5) 1026 1026 */ 1027 1027 -
src/cgame/cg_buildable.c
r122 r0 96 96 97 97 #define CREEP_SIZE 64.0f 98 #define CREEP_DISTANCE 64.0f99 98 100 99 /* … … 133 132 134 133 VectorCopy( cent->currentState.origin2, temp ); 135 VectorScale( temp, - CREEP_DISTANCE, temp );134 VectorScale( temp, -4096, temp ); 136 135 VectorAdd( temp, cent->lerpOrigin, temp ); 137 136 … … 142 141 size = CREEP_SIZE * frac; 143 142 144 if( size > 0.0f && tr.fraction < 1.0f)143 if( size > 0.0f ) 145 144 CG_ImpactMark( cgs.media.creepShader, origin, cent->currentState.origin2, 146 145 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, qfalse, size, qtrue ); … … 738 737 } 739 738 740 /* 741 ================== 742 CG_BuildableStatusParse 743 ================== 744 */ 739 745 740 void CG_BuildableStatusParse( const char *filename, buildStat_t *bs ) 746 741 { … … 913 908 if( !bs->loaded ) 914 909 return; 915 910 916 911 d = Distance( cent->lerpOrigin, cg.refdef.vieworg ); 917 912 if( d > STATUS_MAX_VIEW_DIST ) 918 913 return; 919 914 920 915 Vector4Copy( bs->foreColor, color ); 921 916 922 // trace for center point 917 // trace for center point 923 918 BG_FindBBoxForBuildable( es->modelindex, mins, maxs ); 924 919 … … 1079 1074 healthColor[ 3 ] = color[ 3 ]; 1080 1075 trap_R_SetColor( healthColor ); 1081 1076 1082 1077 CG_DrawPic( hX, hY, hW, hH, cgs.media.whiteShader ); 1083 1078 trap_R_SetColor( NULL ); … … 1095 1090 oX -= ( oW * 0.5f ); 1096 1091 oY -= ( oH * 0.5f ); 1097 1092 1098 1093 trap_R_SetColor( frameColor ); 1099 1094 CG_DrawPic( oX, oY, oW, oH, bs->overlayShader ); … … 1127 1122 if( health > 0 && healthPoints < 1 ) 1128 1123 healthPoints = 1; 1129 nX = picX + ( picW * 0.5f ) - 2.0f - ( ( subH * 4 ) * 0.5f ); 1130 1124 nX = picX + ( picW * 0.5f ) - 2.0f - ( ( subH * 4 ) * 0.5f ); 1125 1131 1126 if( healthPoints > 999 ) 1132 1127 nX -= 0.0f; … … 1137 1132 else 1138 1133 nX -= subH * 1.5f; 1139 1134 1140 1135 CG_DrawField( nX, subY, 4, subH, subH, healthPoints ); 1141 1136 } … … 1144 1139 } 1145 1140 1146 /* 1147 ================== 1148 CG_SortDistance 1149 ================== 1150 */ 1151 static int CG_SortDistance( const void *a, const void *b ) 1141 static int QDECL CG_SortDistance( const void *a, const void *b ) 1152 1142 { 1153 1143 centity_t *aent, *bent; … … 1168 1158 /* 1169 1159 ================== 1170 CG_PlayerIsBuilder1171 ==================1172 */1173 static qboolean CG_PlayerIsBuilder( buildable_t buildable )1174 {1175 switch( cg.predictedPlayerState.weapon )1176 {1177 case WP_ABUILD:1178 case WP_ABUILD2:1179 case WP_HBUILD:1180 case WP_HBUILD2:1181 return BG_FindTeamForBuildable( buildable ) ==1182 BG_FindTeamForWeapon( cg.predictedPlayerState.weapon );1183 1184 default:1185 return qfalse;1186 }1187 }1188 1189 /*1190 ==================1191 CG_BuildableRemovalPending1192 ==================1193 */1194 static qboolean CG_BuildableRemovalPending( int entityNum )1195 {1196 int i;1197 playerState_t *ps = &cg.snap->ps;1198 1199 if( !( ps->stats[ STAT_BUILDABLE ] & SB_VALID_TOGGLEBIT ) )1200 return qfalse;1201 1202 for( i = 0; i < MAX_POWERUPS; i++ )1203 {1204 if( ps->powerups[ i ] == entityNum )1205 return qtrue;1206 }1207 1208 return qfalse;1209 }1210 1211 /*1212 ==================1213 1160 CG_DrawBuildableStatus 1214 1161 ================== … … 1222 1169 int buildables = 0; 1223 1170 1224 for( i = 0; i < cg.snap->numEntities; i++ ) 1225 { 1226 cent = &cg_entities[ cg.snap->entities[ i ].number ]; 1227 es = ¢->currentState; 1228 1229 if( es->eType == ET_BUILDABLE && CG_PlayerIsBuilder( es->modelindex ) ) 1230 buildableList[ buildables++ ] = cg.snap->entities[ i ].number; 1231 } 1232 1233 qsort( buildableList, buildables, sizeof( int ), CG_SortDistance ); 1234 for( i = 0; i < buildables; i++ ) 1235 CG_BuildableStatusDisplay( &cg_entities[ buildableList[ i ] ] ); 1171 switch( cg.predictedPlayerState.weapon ) 1172 { 1173 case WP_ABUILD: 1174 case WP_ABUILD2: 1175 case WP_HBUILD: 1176 case WP_HBUILD2: 1177 for( i = 0; i < cg.snap->numEntities; i++ ) 1178 { 1179 cent = &cg_entities[ cg.snap->entities[ i ].number ]; 1180 es = ¢->currentState; 1181 1182 if( es->eType == ET_BUILDABLE && 1183 BG_FindTeamForBuildable( es->modelindex ) == 1184 BG_FindTeamForWeapon( cg.predictedPlayerState.weapon ) ) 1185 buildableList[ buildables++ ] = cg.snap->entities[ i ].number; 1186 } 1187 qsort( buildableList, buildables, sizeof( int ), CG_SortDistance ); 1188 for( i = 0; i < buildables; i++ ) 1189 CG_BuildableStatusDisplay( &cg_entities[ buildableList[ i ] ] ); 1190 break; 1191 1192 default: 1193 break; 1194 } 1236 1195 } 1237 1196 … … 1323 1282 ent.nonNormalizedAxes = qfalse; 1324 1283 1325 if( CG_PlayerIsBuilder( es->modelindex ) && CG_BuildableRemovalPending( es->number ) )1326 ent.customShader = cgs.media.redBuildShader;1327 1284 1328 1285 //add to refresh list … … 1368 1325 turretBarrel.nonNormalizedAxes = qfalse; 1369 1326 1370 if( CG_PlayerIsBuilder( es->modelindex ) && CG_BuildableRemovalPending( es->number ) )1371 turretBarrel.customShader = cgs.media.redBuildShader;1372 1373 1327 trap_R_AddRefEntityToScene( &turretBarrel ); 1374 1328 } … … 1412 1366 else 1413 1367 turretTop.nonNormalizedAxes = qfalse; 1414 1415 if( CG_PlayerIsBuilder( es->modelindex ) && CG_BuildableRemovalPending( es->number ) )1416 turretTop.customShader = cgs.media.redBuildShader;1417 1368 1418 1369 trap_R_AddRefEntityToScene( &turretTop ); -
src/cgame/cg_consolecmds.c
r118 r0 92 92 // so request new ones 93 93 cg.scoresRequestTime = cg.time; 94 //TA: added \n SendClientCommand doesn't call flush( )? 94 95 trap_SendClientCommand( "score\n" ); 95 96 … … 239 240 cmd = CG_Argv( 0 ); 240 241 241 // ugly hacky special case242 //TA: ugly hacky special case 242 243 if( !Q_stricmp( cmd, "ui_menu" ) ) 243 244 { -
src/cgame/cg_draw.c
r122 r0 75 75 { 76 76 glyph = &font->glyphs[ (int)*s ]; 77 //TTimo: FIXME: getting nasty warnings without the cast, 78 //hopefully this doesn't break the VM build 77 79 out += glyph->xSkip; 78 80 s++; … … 91 93 glyphInfo_t *glyph; 92 94 float useScale; 95 // TTimo: FIXME 96 // const unsigned char *s = text; 93 97 const char *s = text; 94 98 fontInfo_t *font = &cgDC.Assets.textFont; … … 119 123 { 120 124 glyph = &font->glyphs[ (int)*s ]; 125 //TTimo: FIXME: getting nasty warnings without the cast, 126 //hopefully this doesn't break the VM build 121 127 if( max < glyph->height ) 122 128 max = glyph->height; … … 158 164 if( text ) 159 165 { 160 166 // TTimo: FIXME 167 // const unsigned char *s = text; 161 168 const char *s = text; 162 169 … … 172 179 { 173 180 glyph = &font->glyphs[ (int)*s ]; 181 //TTimo: FIXME: getting nasty warnings without the cast, 182 //hopefully this doesn't break the VM build 174 183 175 184 if( Q_IsColorString( s ) ) … … 285 294 CG_DrawFieldPadded 286 295 287 Draws large numbers for status bar 296 Draws large numbers for status bar and powerups 288 297 ============== 289 298 */ … … 365 374 CG_DrawField 366 375 367 Draws large numbers for status bar 376 Draws large numbers for status bar and powerups 368 377 ============== 369 378 */ … … 790 799 static void CG_DrawPlayerBoosted( rectDef_t *rect, vec4_t color, qhandle_t shader ) 791 800 { 792 if( cg.boostedTime >= 0 ) 801 playerState_t *ps = &cg.snap->ps; 802 qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED; 803 804 if( boosted ) 793 805 color[ 3 ] = AH_MAX_ALPHA; 794 806 else … … 807 819 static void CG_DrawPlayerBoosterBolt( rectDef_t *rect, vec4_t color, qhandle_t shader ) 808 820 { 821 playerState_t *ps = &cg.snap->ps; 822 qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED; 809 823 vec4_t localColor; 810 824 811 825 Vector4Copy( color, localColor ); 812 826 813 if( cg.boostedTime >= 0)814 { 815 if( ( cg.time - cg.boostedTime )> BOOST_TIME - 3000 )827 if( boosted ) 828 { 829 if( ps->stats[ STAT_BOOSTTIME ] > BOOST_TIME - 3000 ) 816 830 { 817 qboolean flash = ( cg.time/ 500 ) % 2;831 qboolean flash = ( ps->stats[ STAT_BOOSTTIME ] / 500 ) % 2; 818 832 819 833 if( flash ) … … 927 941 928 942 default: 929 BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL );943 BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL ); 930 944 break; 931 945 } … … 1086 1100 1087 1101 default: 1088 BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value );1102 BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value ); 1089 1103 1090 1104 if( value > -1 ) … … 1415 1429 1416 1430 BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, 1417 &value, NULL );1431 &value, NULL ); 1418 1432 1419 1433 return value; … … 1421 1435 break; 1422 1436 case CG_PLAYER_CLIPS_VALUE: 1423 if( cent->currentState.weapon )1424 1437 if( cent->currentState.weapon ) 1425 1438 { … … 1427 1440 1428 1441 BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, 1429 NULL, &value );1442 NULL, &value ); 1430 1443 1431 1444 return value; … … 1474 1487 if( text ) 1475 1488 { 1489 // TTimo: FIXME 1490 // const unsigned char *s = text; // bk001206 - unsigned 1476 1491 const char *s = text; 1477 1492 float max = *maxX; … … 1496 1511 { 1497 1512 glyph = &font->glyphs[ (int)*s ]; 1513 //TTimo: FIXME: getting nasty warnings without the cast, 1514 //hopefully this doesn't break the VM build 1498 1515 1499 1516 if( Q_IsColorString( s ) ) … … 1563 1580 if( cg.spectatorOffset < cg.spectatorLen ) 1564 1581 { 1565 // skip colour directives1582 //TA: skip colour directives 1566 1583 if( Q_IsColorString( &cg.spectatorList[ cg.spectatorOffset ] ) ) 1567 1584 cg.spectatorOffset += 2; … … 1693 1710 ================== 1694 1711 */ 1712 //TA: personally i think this should be longer - it should really be a cvar 1695 1713 #define FPS_FRAMES 20 1696 1714 #define FPS_STRING "fps" … … 3270 3288 } 3271 3289 3290 //TA: draw the lighting effects e.g. nvg 3272 3291 CG_DrawLighting( ); 3273 3292 -
src/cgame/cg_event.c
r118 r0 40 40 const char *targetInfo; 41 41 const char *attackerInfo; 42 char targetName[ MAX_NAME_LENGTH];43 char attackerName[ MAX_NAME_LENGTH];42 char targetName[ 32 ]; 43 char attackerName[ 32 ]; 44 44 char className[ 64 ]; 45 45 gender_t gender; … … 73 73 return; 74 74 75 Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof( targetName )); 75 Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof( targetName ) - 2 ); 76 strcat( targetName, S_COLOR_WHITE ); 76 77 77 78 message2 = ""; … … 182 183 if( message ) 183 184 { 184 CG_Printf( "%s " S_COLOR_WHITE "%s.\n", targetName, message );185 CG_Printf( "%s %s.\n", targetName, message ); 185 186 return; 186 187 } … … 194 195 else 195 196 { 196 Q_strncpyz( attackerName, Info_ValueForKey( attackerInfo, "n" ), sizeof( attackerName )); 197 Q_strncpyz( attackerName, Info_ValueForKey( attackerInfo, "n" ), sizeof( attackerName ) - 2); 198 strcat( attackerName, S_COLOR_WHITE ); 197 199 // check for kill messages about the current clientNum 198 200 if( target == cg.snap->ps.clientNum ) … … 328 330 if( message ) 329 331 { 330 CG_Printf( "%s " S_COLOR_WHITE "%s %s%s%s\n",332 CG_Printf( "%s %s %s%s%s\n", 331 333 targetName, message, 332 334 ( teamKill ) ? S_COLOR_RED "TEAMMATE " S_COLOR_WHITE : "", -
src/cgame/cg_local.h
r122 r0 552 552 // client numbering range 553 553 554 // smoothing of view and model for WW transitions554 //TA: smoothing of view and model for WW transitions 555 555 #define MAXSMOOTHS 32 556 556 … … 635 635 lerpFrame_t lerpFrame; 636 636 637 //TA: 637 638 buildableAnimNumber_t buildableAnim; //persistant anim number 638 639 buildableAnimNumber_t oldBuildableAnim; //to detect when new anims are set … … 725 726 int teamTask; // task in teamplay (offence/defence) 726 727 qboolean teamLeader; // true when this is a team leader 728 729 int powerups; // so can display quad/flag status 727 730 728 731 int medkitUsageTime; … … 867 870 //====================================================================== 868 871 872 //TA: 869 873 typedef struct 870 874 { … … 1096 1100 qboolean testGun; 1097 1101 1098 int spawnTime; // fovwarp1099 int weapon1Time; // time when BUTTON_ATTACK went t->f f->t1100 int weapon2Time; // time when BUTTON_ATTACK2 went t->f f->t1101 int weapon3Time; // time when BUTTON_USE_HOLDABLE went t->f f->t1102 int spawnTime; //TA: fovwarp 1103 int weapon1Time; //TA: time when BUTTON_ATTACK went t->f f->t 1104 int weapon2Time; //TA: time when BUTTON_ATTACK2 went t->f f->t 1105 int weapon3Time; //TA: time when BUTTON_USE_HOLDABLE went t->f f->t 1102 1106 qboolean weapon1Firing; 1103 1107 qboolean weapon2Firing; 1104 1108 qboolean weapon3Firing; 1105 1109 1106 int boostedTime;1107 1110 int poisonedTime; 1108 1111 1109 vec3_t lastNormal; // view smoothage1110 vec3_t lastVangles; // view smoothage1111 smooth_t sList[ MAXSMOOTHS ]; // WW smoothing1112 1113 int forwardMoveTime; // for struggling1112 vec3_t lastNormal; //TA: view smoothage 1113 vec3_t lastVangles; //TA: view smoothage 1114 smooth_t sList[ MAXSMOOTHS ]; //TA: WW smoothing 1115 1116 int forwardMoveTime; //TA: for struggling 1114 1117 int rightMoveTime; 1115 1118 int upMoveTime; 1116 1119 1117 float charModelFraction; // loading percentages1120 float charModelFraction; //TA: loading percentages 1118 1121 float mediaFraction; 1119 1122 float buildablesFraction; … … 1365 1368 clientInfo_t clientinfo[ MAX_CLIENTS ]; 1366 1369 1367 // corpse info1370 //TA: corpse info 1368 1371 clientInfo_t corpseinfo[ MAX_CLIENTS ]; 1369 1372 … … 1389 1392 extern centity_t cg_entities[ MAX_GENTITIES ]; 1390 1393 1394 //TA: weapon limit expanded: 1395 //extern weaponInfo_t cg_weapons[MAX_WEAPONS]; 1391 1396 extern weaponInfo_t cg_weapons[ 32 ]; 1397 //TA: upgrade infos: 1392 1398 extern upgradeInfo_t cg_upgrades[ 32 ]; 1393 1399 1400 //TA: buildable infos: 1394 1401 extern buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ]; 1395 1402 1396 1403 extern markPoly_t cg_markPolys[ MAX_MARK_POLYS ]; 1397 1404 1398 extern vmCvar_t cg_version;1399 1405 extern vmCvar_t cg_centertime; 1400 1406 extern vmCvar_t cg_runpitch; … … 1512 1518 extern vmCvar_t cg_painBlendZoom; 1513 1519 1520 //TA: hack to get class an carriage through to UI module 1514 1521 extern vmCvar_t ui_currentClass; 1515 1522 extern vmCvar_t ui_carriage; … … 1626 1633 void CG_Corpse( centity_t *cent ); 1627 1634 void CG_ResetPlayerEntity( centity_t *cent ); 1635 void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, int team ); 1628 1636 void CG_NewClientInfo( int clientNum ); 1629 1637 void CG_PrecacheClientInfo( pClass_t class, char *model, char *skin ); -
src/cgame/cg_main.c
r122 r0 24 24 // cg_main.c -- initialization and primary entry point for cgame 25 25 26 26 27 #include "cg_local.h" 27 28 #include "../qcommon/q_shared.h"29 28 30 29 #include "../ui/ui_shared.h" … … 103 102 centity_t cg_entities[ MAX_GENTITIES ]; 104 103 104 //TA: weapons limit expanded: 105 //weaponInfo_t cg_weapons[MAX_WEAPONS]; 105 106 weaponInfo_t cg_weapons[ 32 ]; 106 107 upgradeInfo_t cg_upgrades[ 32 ]; … … 108 109 buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ]; 109 110 110 vmCvar_t cg_version;111 111 vmCvar_t cg_teslaTrailTime; 112 112 vmCvar_t cg_railTrailTime; … … 226 226 vmCvar_t cg_painBlendZoom; 227 227 228 //TA: hack to get class and carriage through to UI module 228 229 vmCvar_t ui_currentClass; 229 230 vmCvar_t ui_carriage; … … 251 252 static cvarTable_t cvarTable[ ] = 252 253 { 253 { &cg_version, "cg_version", FULL_VERSION, CVAR_ROM | CVAR_USERINFO },254 254 { &cg_ignore, "cg_ignore", "0", 0 }, // used for debugging 255 255 { &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE }, … … 786 786 787 787 788 // building shaders788 //TA: building shaders 789 789 cgs.media.greenBuildShader = trap_R_RegisterShader("gfx/misc/greenbuild" ); 790 790 cgs.media.redBuildShader = trap_R_RegisterShader("gfx/misc/redbuild" ); … … 1222 1222 } 1223 1223 1224 return qfalse; 1224 return qfalse; // bk001204 - why not? 1225 1225 } 1226 1226 … … 1615 1615 } 1616 1616 1617 // hack to prevent warning1617 //TA: hack to prevent warning 1618 1618 static qboolean CG_OwnerDrawVisible( int parameter ) 1619 1619 { … … 1738 1738 trap_Cvar_Set( "ui_loading", "1" ); 1739 1739 1740 // load overrides1740 //TA: load overrides 1741 1741 BG_InitClassOverrides( ); 1742 1742 BG_InitBuildableOverrides( ); 1743 1743 BG_InitAllowedGameElements( ); 1744 1744 1745 // Dynamicmemory1745 //TA: dyn memory 1746 1746 CG_InitMemory( ); 1747 1747 … … 1750 1750 CG_InitConsoleCommands( ); 1751 1751 1752 //TA: moved up for LoadHudMenu 1752 1753 String_Init( ); 1753 1754 1755 //TA: TA UI 1754 1756 CG_AssetCache( ); 1755 CG_LoadHudMenu( ); 1757 CG_LoadHudMenu( ); // load new hud stuff 1756 1758 1757 1759 cg.weaponSelect = WP_NONE; 1758 cg.boostedTime = -1;1759 1760 1760 1761 // old servers … … 1802 1803 CG_UpdateMediaFraction( 1.0f ); 1803 1804 1805 //TA: 1804 1806 CG_InitBuildables( ); 1805 1807 -
src/cgame/cg_players.c
r122 r0 2380 2380 } 2381 2381 2382 //CG_AddRefEntityWithPowerups( &legs, es->powerups, ci->team ); 2382 2383 trap_R_AddRefEntityToScene( &legs ); 2383 2384 … … 2404 2405 torso.renderfx = renderfx; 2405 2406 2407 //CG_AddRefEntityWithPowerups( &torso, es->powerups, ci->team ); 2406 2408 trap_R_AddRefEntityToScene( &torso ); 2407 2409 … … 2422 2424 head.renderfx = renderfx; 2423 2425 2426 //CG_AddRefEntityWithPowerups( &head, es->powerups, ci->team ); 2424 2427 trap_R_AddRefEntityToScene( &head ); 2425 2428 } -
src/cgame/cg_predict.c
r122 r0 477 477 if( fabs( AngleDelta( ps->viewangles[ 0 ], pps->viewangles[ 0 ] ) ) > 1.0f || 478 478 fabs( AngleDelta( ps->viewangles[ 1 ], pps->viewangles[ 1 ] ) ) > 1.0f || 479 fabs( AngleDelta( ps->viewangles[ 2 ], pps->viewangles[ 2 ] ) ) > 1.0f ) 479 fabs( AngleDelta( ps->viewangles[ 2 ], pps->viewangles[ 2 ] ) ) > 1.0f ) 480 480 { 481 481 return 12; … … 483 483 484 484 if( pps->viewheight != ps->viewheight ) 485 return 13;485 return 13; 486 486 487 487 if( pps->damageEvent != ps->damageEvent || … … 503 503 if( pps->persistant[ i ] != ps->persistant[ i ] ) 504 504 return 16; 505 } 506 507 for( i = 0; i < MAX_WEAPONS; i++ ) 508 { 509 if( pps->ammo[ i ] != ps->ammo[ i ] ) 510 return 18; 505 511 } 506 512 … … 694 700 errorcode = CG_IsUnacceptableError( &cg.predictedPlayerState, 695 701 &cg.savedPmoveStates[ i ] ); 696 702 697 703 if( errorcode ) 698 704 { … … 701 707 break; 702 708 } 703 709 704 710 // this one is almost exact, so we'll copy it in as the starting point 705 711 *cg_pmove.ps = cg.savedPmoveStates[ i ]; 706 712 // advance the head 707 713 cg.stateHead = ( i + 1 ) % NUM_SAVED_STATES; 708 714 709 715 // set the next command to predict 710 716 predictCmd = cg.lastPredictedCommand + 1; 711 717 712 718 // a saved state matched, so flag it 713 719 error = qfalse; -
src/cgame/cg_scanner.c
r122 r0 61 61 if( cent->currentState.eType == ET_BUILDABLE ) 62 62 { 63 // add to list of item positions (for creep)63 //TA: add to list of item positions (for creep) 64 64 if( cent->currentState.modelindex2 == BIT_ALIENS ) 65 65 { … … 184 184 playerState_t *ps = &cg.snap->ps; 185 185 186 BG_GetClientNormal( ps, normal ); 186 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) 187 { 188 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 189 VectorSet( normal, 0.0f, 0.0f, -1.0f ); 190 else 191 VectorCopy( ps->grapplePoint, normal ); 192 } 193 else 194 VectorSet( normal, 0.0f, 0.0f, 1.0f ); 187 195 188 196 AngleVectors( entityPositions.vangles, view, NULL, NULL ); -
src/cgame/cg_servercmds.c
r122 r1 66 66 67 67 cgs.clientinfo[ cg.scores[ i ].client ].score = cg.scores[ i ].score; 68 cgs.clientinfo[ cg.scores[ i ].client ].powerups = 0; 68 69 69 70 cg.scores[ i ].team = cgs.clientinfo[ cg.scores[ i ].client ].team; … … 86 87 for( i = 0; i < numSortedTeamPlayers; i++ ) 87 88 { 88 client = atoi( CG_Argv( i * 5+ 2 ) );89 client = atoi( CG_Argv( i * 6 + 2 ) ); 89 90 90 91 sortedTeamPlayers[ i ] = client; 91 92 92 cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 5 + 3 ) ); 93 cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 5 + 4 ) ); 94 cgs.clientinfo[ client ].armor = atoi( CG_Argv( i * 5 + 5 ) ); 95 cgs.clientinfo[ client ].curWeapon = atoi( CG_Argv( i * 5 + 6 ) ); 93 cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 6 + 3 ) ); 94 cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 6 + 4 ) ); 95 cgs.clientinfo[ client ].armor = atoi( CG_Argv( i * 6 + 5 ) ); 96 cgs.clientinfo[ client ].curWeapon = atoi( CG_Argv( i * 6 + 6 ) ); 97 cgs.clientinfo[ client ].powerups = atoi( CG_Argv( i * 6 + 7 ) ); 96 98 } 97 99 } … … 845 847 } 846 848 847 if( !strcmp( cmd, " restartmap" ) )849 if( !strcmp( cmd, "map_restart" ) ) 848 850 { 849 851 CG_MapRestart( ); … … 896 898 } 897 899 900 if( !strcmp( cmd, "weaponswitch" ) ) 901 { 902 CG_Printf( "client weaponswitch\n" ); 903 if( trap_Argc( ) == 2 ) 904 { 905 cg.weaponSelect = atoi( CG_Argv( 1 ) ); 906 cg.weaponSelectTime = cg.time; 907 } 908 909 return; 910 } 911 898 912 // server requests a ptrc 899 913 if( !strcmp( cmd, "ptrcrequest" ) ) -
src/cgame/cg_snapshot.c
r118 r0 142 142 // execute any server string commands before transitioning entities 143 143 CG_ExecuteNewServerCommands( cg.nextSnap->serverCommandSequence ); 144 145 // if we had a map_restart, set everthing with initial 146 if( !cg.snap ) { } //TA: ? 144 147 145 148 // clear the currentValid flag for all entities in the existing snapshot -
src/cgame/cg_tutorial.c
r122 r0 196 196 va( "Press %s to build a structure\n", 197 197 CG_KeyNameForCommand( "+attack" ) ) ); 198 } 199 200 if( ( es = CG_BuildableInRange( ps, NULL ) ) ) 201 { 202 if( cgs.markDeconstruct ) 203 { 204 if( es->generic1 & B_MARKED_TOGGLEBIT ) 205 { 206 Q_strcat( text, MAX_TUTORIAL_TEXT, 207 va( "Press %s to unmark this structure\n", 198 199 if( ( es = CG_BuildableInRange( ps, NULL ) ) ) 200 { 201 if( cgs.markDeconstruct ) 202 { 203 if( es->generic1 & B_MARKED_TOGGLEBIT ) 204 { 205 Q_strcat( text, MAX_TUTORIAL_TEXT, 206 va( "Press %s to unmark this structure\n", 207 CG_KeyNameForCommand( "deconstruct" ) ) ); 208 } 209 else 210 { 211 Q_strcat( text, MAX_TUTORIAL_TEXT, 212 va( "Press %s to mark this structure\n", 213 CG_KeyNameForCommand( "deconstruct" ) ) ); 214 } 215 } 216 else 217 { 218 Q_strcat( text, MAX_TUTORIAL_TEXT, 219 va( "Press %s to destroy this structure\n", 208 220 CG_KeyNameForCommand( "deconstruct" ) ) ); 209 221 } 210 else211 {212 Q_strcat( text, MAX_TUTORIAL_TEXT,213 va( "Press %s to mark this structure\n",214 CG_KeyNameForCommand( "deconstruct" ) ) );215 }216 }217 else218 {219 Q_strcat( text, MAX_TUTORIAL_TEXT,220 va( "Press %s to destroy this structure\n",221 CG_KeyNameForCommand( "deconstruct" ) ) );222 222 } 223 223 } … … 352 352 static void CG_HumanCkitText( char *text, playerState_t *ps ) 353 353 { 354 buildable_t buildable = ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT; 355 entityState_t *es; 356 float health; 354 buildable_t buildable = ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT; 355 float health; 357 356 358 357 if( buildable > BA_NONE ) … … 382 381 CG_KeyNameForCommand( "+button5" ) ) ); 383 382 } 384 } 385 } 386 387 if( ( es = CG_BuildableInRange( ps, NULL ) ) ) 388 { 389 if( cgs.markDeconstruct ) 390 { 391 if( es->generic1 & B_MARKED_TOGGLEBIT ) 392 { 393 Q_strcat( text, MAX_TUTORIAL_TEXT, 394 va( "Press %s to unmark this structure\n", 395 CG_KeyNameForCommand( "deconstruct" ) ) ); 396 } 397 else 398 { 399 Q_strcat( text, MAX_TUTORIAL_TEXT, 400 va( "Press %s to mark this structure\n", 401 CG_KeyNameForCommand( "deconstruct" ) ) ); 402 } 403 } 404 else 405 { 383 406 384 Q_strcat( text, MAX_TUTORIAL_TEXT, 407 385 va( "Press %s to destroy this structure\n", -
src/cgame/cg_view.c
r118 r0 279 279 vec3_t surfNormal; 280 280 281 BG_GetClientNormal( &cg.predictedPlayerState, surfNormal ); 281 if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING ) 282 { 283 if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 284 VectorSet( surfNormal, 0.0f, 0.0f, -1.0f ); 285 else 286 VectorCopy( cg.predictedPlayerState.grapplePoint, surfNormal ); 287 } 288 else 289 VectorSet( surfNormal, 0.0f, 0.0f, 1.0f ); 282 290 283 291 VectorMA( cg.refdef.vieworg, cg.predictedPlayerState.viewheight, surfNormal, cg.refdef.vieworg ); … … 348 356 { 349 357 float steptime; 350 int timeDelta;358 int timeDelta; 351 359 vec3_t normal; 352 360 playerState_t *ps = &cg.predictedPlayerState; 353 361 354 BG_GetClientNormal( ps, normal ); 362 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) 363 { 364 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 365 VectorSet( normal, 0.0f, 0.0f, -1.0f ); 366 else 367 VectorCopy( ps->grapplePoint, normal ); 368 } 369 else 370 VectorSet( normal, 0.0f, 0.0f, 1.0f ); 355 371 356 372 steptime = BG_FindSteptimeForClass( ps->stats[ STAT_PCLASS ] ); … … 363 379 * (steptime - timeDelta) / steptime; 364 380 365 VectorMA( cg.refdef.vieworg, -stepChange, normal, cg.refdef.vieworg ); 381 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) 382 VectorMA( cg.refdef.vieworg, -stepChange, normal, cg.refdef.vieworg ); 383 else 384 cg.refdef.vieworg[ 2 ] -= stepChange; 366 385 } 367 386 } … … 394 413 playerState_t *ps = &cg.predictedPlayerState; 395 414 396 BG_GetClientNormal( ps, normal ); 415 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) 416 { 417 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 418 VectorSet( normal, 0.0f, 0.0f, -1.0f ); 419 else 420 VectorCopy( ps->grapplePoint, normal ); 421 } 422 else 423 VectorSet( normal, 0.0f, 0.0f, 1.0f ); 424 397 425 398 426 if( cg.snap->ps.pm_type == PM_INTERMISSION ) … … 616 644 617 645 // add view height 618 VectorMA( origin, ps->viewheight, normal, origin ); 646 // when wall climbing the viewheight is not straight up 647 if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING ) 648 VectorMA( origin, ps->viewheight, normal, origin ); 649 else 650 origin[ 2 ] += cg.predictedPlayerState.viewheight; 619 651 620 652 // smooth out duck height changes … … 632 664 bob = 6; 633 665 634 VectorMA( origin, bob, normal, origin ); 666 // likewise for bob 667 if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING ) 668 VectorMA( origin, bob, normal, origin ); 669 else 670 origin[ 2 ] += bob; 671 635 672 636 673 // add fall height … … 907 944 908 945 //set surfNormal 909 BG_GetClientNormal( ps, surfNormal ); 946 if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) ) 947 VectorCopy( ps->grapplePoint, surfNormal ); 948 else 949 VectorCopy( ceilingNormal, surfNormal ); 910 950 911 951 AnglesToAxis( in, inAxis ); … … 1225 1265 cg.renderingThirdPerson = cg_thirdPerson.integer || ( cg.snap->ps.stats[ STAT_HEALTH ] <= 0 ); 1226 1266 1227 // Infer when we first became boosted1228 if( ( cg.snap->ps.stats[ STAT_STATE ] & SS_BOOSTED ) && cg.boostedTime < 0 )1229 cg.boostedTime = cg.time;1230 else if( !( cg.snap->ps.stats[ STAT_STATE ] & SS_BOOSTED ) && cg.boostedTime >= 0 )1231 cg.boostedTime = -1;1232 1233 1267 // build cg.refdef 1234 1268 inwater = CG_CalcViewValues( ); -
src/cgame/cg_weapons.c
r122 r0 1110 1110 static qboolean CG_WeaponSelectable( weapon_t weapon ) 1111 1111 { 1112 //int ammo, clips; 1113 // 1114 //BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); 1115 // 1116 // this is a pain in the ass 1117 //if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) 1118 // return qfalse; 1119 1112 1120 if( !BG_InventoryContainsWeapon( weapon, cg.snap->ps.stats ) ) 1113 1121 return qfalse; … … 1192 1200 for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) 1193 1201 { 1194 int ammo, clips;1195 1196 1202 if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) ) 1197 1203 continue; 1198 1199 BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); 1200 1201 if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) 1202 colinfo[ numItems ] = 1; 1203 else 1204 colinfo[ numItems ] = 0; 1204 1205 { 1206 int ammo, clips; 1207 1208 BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); 1209 1210 if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) 1211 colinfo[ numItems ] = 1; 1212 else 1213 colinfo[ numItems ] = 0; 1214 1215 } 1205 1216 1206 1217 if( i == cg.weaponSelect ) … … 1219 1230 if( !BG_FindUsableForUpgrade ( i ) ) 1220 1231 colinfo[ numItems ] = 2; 1221 1232 1222 1233 1223 1234 if( i == cg.weaponSelect - 32 ) -
src/client/cl_cgame.c
r54 r0 332 332 } 333 333 334 if ( !strcmp( cmd, " restartmap" ) ) {334 if ( !strcmp( cmd, "map_restart" ) ) { 335 335 // clear notify lines and outgoing commands before passing 336 336 // the restart to the cgame -
src/client/cl_console.c
r118 r0 465 465 466 466 Field_Draw( &g_consoleField, con.xadjust + 2 * SMALLCHAR_WIDTH, y, 467 SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue , qtrue);467 SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue ); 468 468 } 469 469 … … 521 521 522 522 SCR_DrawSmallChar( cls.glconfig.vidWidth - ( i - x ) * SMALLCHAR_WIDTH, 523 523 524 (lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), Q3_VERSION[x] ); 524 525 … … 615 616 if( chat_team ) 616 617 { 617 SCR_DrawBigString( 8, 232, "Team Say:", 1.0f , qfalse);618 SCR_DrawBigString( 8, 232, "Team Say:", 1.0f ); 618 619 skip = 11; 619 620 } 620 621 else 621 622 { 622 SCR_DrawBigString( 8, 232, "Say:", 1.0f , qfalse);623 SCR_DrawBigString( 8, 232, "Say:", 1.0f ); 623 624 skip = 5; 624 625 } 625 626 626 627 Field_BigDraw( &chatField, skip * BIGCHAR_WIDTH, 232, 627 SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue , qtrue);628 SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue ); 628 629 } 629 630 } -
src/client/cl_curl.c
r118 r0 21 21 */ 22 22 23 #if defUSE_CURL23 #if USE_CURL 24 24 #include "client.h" 25 25 cvar_t *cl_cURLLib; 26 26 27 #if defUSE_CURL_DLOPEN27 #if USE_CURL_DLOPEN 28 28 #include "../sys/sys_loadlib.h" 29 29 … … 89 89 qboolean CL_cURL_Init() 90 90 { 91 #if defUSE_CURL_DLOPEN91 #if USE_CURL_DLOPEN 92 92 if(cURLLib) 93 93 return qtrue; … … 157 157 { 158 158 CL_cURL_Cleanup(); 159 #if defUSE_CURL_DLOPEN159 #if USE_CURL_DLOPEN 160 160 if(cURLLib) 161 161 { -
src/client/cl_curl.h
r118 r0 38 38 #endif 39 39 40 #if defUSE_LOCAL_HEADERS40 #if USE_LOCAL_HEADERS 41 41 #include "../libcurl/curl/curl.h" 42 42 #else … … 45 45 46 46 47 #if defUSE_CURL_DLOPEN47 #if USE_CURL_DLOPEN 48 48 extern char* (*qcurl_version)(void); 49 49 -
src/client/cl_keys.c
r118 r0 311 311 =================== 312 312 */ 313 void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, qboolean showCursor, 314 qboolean noColorEscape ) { 313 void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, qboolean showCursor ) { 315 314 int len; 316 315 int drawLen; … … 353 352 354 353 color[0] = color[1] = color[2] = color[3] = 1.0; 355 SCR_DrawSmallStringExt( x, y, str, color, qfalse , noColorEscape);354 SCR_DrawSmallStringExt( x, y, str, color, qfalse ); 356 355 } else { 357 356 // draw big string with drop shadow 358 SCR_DrawBigString( x, y, str, 1.0 , noColorEscape);357 SCR_DrawBigString( x, y, str, 1.0 ); 359 358 } 360 359 361 360 // draw the cursor 362 if ( showCursor ) { 363 if ( (int)( cls.realtime >> 8 ) & 1 ) { 364 return; // off blink 365 } 366 367 if ( key_overstrikeMode ) { 368 cursorChar = 11; 369 } else { 370 cursorChar = 10; 371 } 372 373 i = drawLen - strlen( str ); 374 375 if ( size == SMALLCHAR_WIDTH ) { 376 SCR_DrawSmallChar( x + ( edit->cursor - prestep - i ) * size, y, cursorChar ); 377 } else { 378 str[0] = cursorChar; 379 str[1] = 0; 380 SCR_DrawBigString( x + ( edit->cursor - prestep - i ) * size, y, str, 1.0, qfalse ); 381 382 } 383 } 384 } 385 386 void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape ) 361 if ( !showCursor ) { 362 return; 363 } 364 365 if ( (int)( cls.realtime >> 8 ) & 1 ) { 366 return; // off blink 367 } 368 369 if ( key_overstrikeMode ) { 370 cursorChar = 11; 371 } else { 372 cursorChar = 10; 373 } 374 375 i = drawLen - Q_PrintStrlen( str ); 376 377 if ( size == SMALLCHAR_WIDTH ) { 378 SCR_DrawSmallChar( x + ( edit->cursor - prestep - i ) * size, y, cursorChar ); 379 } else { 380 str[0] = cursorChar; 381 str[1] = 0; 382 SCR_DrawBigString( x + ( edit->cursor - prestep - i ) * size, y, str, 1.0 ); 383 384 } 385 } 386 387 void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor ) 387 388 { 388 Field_VariableSizeDraw( edit, x, y, width, SMALLCHAR_WIDTH, showCursor , noColorEscape);389 } 390 391 void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor , qboolean noColorEscape)389 Field_VariableSizeDraw( edit, x, y, width, SMALLCHAR_WIDTH, showCursor ); 390 } 391 392 void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor ) 392 393 { 393 Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, showCursor , noColorEscape);394 Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, showCursor ); 394 395 } 395 396 -
src/client/cl_main.c
r122 r0 31 31 cvar_t *cl_noprint; 32 32 cvar_t *cl_motd; 33 cvar_t *cl_master; 33 34 34 cvar_t *rcon_client_password; 35 35 cvar_t *rconAddress; … … 737 737 void CL_ShutdownAll(void) { 738 738 739 #if defUSE_CURL739 #if USE_CURL 740 740 CL_cURL_Shutdown(); 741 741 #endif … … 983 983 return; 984 984 } 985 Com_Printf( "Resolving %s\n", cl_master->string);986 if ( !NET_StringToAdr( cl_master->string, &cls.updateServer ) ) {985 Com_Printf( "Resolving %s\n", MASTER_SERVER_NAME ); 986 if ( !NET_StringToAdr( MASTER_SERVER_NAME, &cls.updateServer ) ) { 987 987 Com_Printf( "Couldn't resolve address\n" ); 988 988 return; 989 989 } 990 990 cls.updateServer.port = BigShort( PORT_MASTER ); 991 Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", cl_master->string,991 Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", MASTER_SERVER_NAME, 992 992 cls.updateServer.ip[0], cls.updateServer.ip[1], 993 993 cls.updateServer.ip[2], cls.updateServer.ip[3], … … 1416 1416 void CL_DownloadsComplete( void ) { 1417 1417 1418 #if defUSE_CURL1418 #if USE_CURL 1419 1419 // if we downloaded with cURL 1420 1420 if(clc.cURLUsed) { … … 1547 1547 else 1548 1548 s = localName + strlen(localName); // point at the nul byte 1549 #if defUSE_CURL1549 #if USE_CURL 1550 1550 if(!(cl_allowDownload->integer & DLF_NO_REDIRECT)) { 1551 1551 if(clc.sv_allowDownload & DLF_NO_REDIRECT) { … … 2163 2163 } 2164 2164 2165 #if defUSE_CURL2165 #if USE_CURL 2166 2166 if(clc.downloadCURLM) { 2167 2167 CL_cURL_PerformDownload(); … … 2618 2618 cl_noprint = Cvar_Get( "cl_noprint", "0", 0 ); 2619 2619 cl_motd = Cvar_Get ("cl_motd", "1", 0); 2620 cl_master = Cvar_Get("cl_master","master.tremulous.net",CVAR_ARCHIVE); 2620 2621 2621 cl_timeout = Cvar_Get ("cl_timeout", "200", 0); 2622 2622 … … 2654 2654 2655 2655 cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE); 2656 #if defUSE_CURL2656 #if USE_CURL 2657 2657 cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE); 2658 2658 #endif … … 3230 3230 3231 3231 if( cls.masterNum == 1 ) { 3232 NET_StringToAdr( cl_master->string, &to );3232 NET_StringToAdr( MASTER_SERVER_NAME, &to ); 3233 3233 cls.nummplayerservers = -1; 3234 3234 cls.pingUpdateSource = AS_MPLAYER; 3235 3235 } 3236 3236 else { 3237 NET_StringToAdr( cl_master->string, &to );3237 NET_StringToAdr( MASTER_SERVER_NAME, &to ); 3238 3238 cls.numglobalservers = -1; 3239 3239 cls.pingUpdateSource = AS_GLOBAL; -
src/client/cl_scrn.c
r118 r0 198 198 ================== 199 199 */ 200 void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor, 201 qboolean noColorEscape ) { 200 void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor ) { 202 201 vec4_t color; 203 202 const char *s; … … 211 210 xx = x; 212 211 while ( *s ) { 213 if ( !noColorEscape &&Q_IsColorString( s ) ) {212 if ( Q_IsColorString( s ) ) { 214 213 s += 2; 215 214 continue; … … 226 225 re.SetColor( setColor ); 227 226 while ( *s ) { 228 if ( !noColorEscape &&Q_IsColorString( s ) ) {227 if ( Q_IsColorString( s ) ) { 229 228 if ( !forceColor ) { 230 229 Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); … … 243 242 244 243 245 void SCR_DrawBigString( int x, int y, const char *s, float alpha , qboolean noColorEscape) {244 void SCR_DrawBigString( int x, int y, const char *s, float alpha ) { 246 245 float color[4]; 247 246 248 247 color[0] = color[1] = color[2] = 1.0; 249 248 color[3] = alpha; 250 SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qfalse , noColorEscape);251 } 252 253 void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color , qboolean noColorEscape) {254 SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qtrue , noColorEscape);249 SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qfalse ); 250 } 251 252 void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color ) { 253 SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qtrue ); 255 254 } 256 255 … … 262 261 Draws a multi-colored string with a drop shadow, optionally forcing 263 262 to a fixed color. 264 ================== 265 */ 266 void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor, 267 qboolean noColorEscape ) { 263 264 Coordinates are at 640 by 480 virtual resolution 265 ================== 266 */ 267 void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor ) { 268 268 vec4_t color; 269 269 const char *s; … … 275 275 re.SetColor( setColor ); 276 276 while ( *s ) { 277 if ( !noColorEscape &&Q_IsColorString( s ) ) {277 if ( Q_IsColorString( s ) ) { 278 278 if ( !forceColor ) { 279 279 Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) ); -
src/client/client.h
r122 r0 32 32 #include "../game/bg_public.h" 33 33 34 #if defUSE_CURL34 #if USE_CURL 35 35 #include "cl_curl.h" 36 36 #endif /* USE_CURL */ … … 346 346 extern cvar_t *cl_showTimeDelta; 347 347 extern cvar_t *cl_freezeDemo; 348 extern cvar_t *cl_master;349 348 350 349 extern cvar_t *cl_yawspeed; … … 504 503 void SCR_DrawNamedPic( float x, float y, float width, float height, const char *picname ); 505 504 506 void SCR_DrawBigString( int x, int y, const char *s, float alpha , qboolean noColorEscape); // draws a string with embedded color control characters with fade507 void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color , qboolean noColorEscape); // ignores embedded color control characters508 void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor , qboolean noColorEscape);505 void SCR_DrawBigString( int x, int y, const char *s, float alpha ); // draws a string with embedded color control characters with fade 506 void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color ); // ignores embedded color control characters 507 void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor ); 509 508 void SCR_DrawSmallChar( int x, int y, int ch ); 510 509 -
src/client/keys.h
r118 r0 35 35 void Field_KeyDownEvent( field_t *edit, int key ); 36 36 void Field_CharEvent( field_t *edit, int ch ); 37 void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor , qboolean noColorEscape);38 void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor , qboolean noColorEscape);37 void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor ); 38 void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor ); 39 39 40 40 #define COMMAND_HISTORY 32 -
src/client/qal.c
r118 r0 25 25 // Dynamically loads OpenAL 26 26 27 #if defUSE_OPENAL27 #if USE_OPENAL 28 28 29 29 #include "qal.h" 30 30 31 #if defUSE_OPENAL_DLOPEN31 #if USE_OPENAL_DLOPEN 32 32 33 33 #include "../sys/sys_loadlib.h" -
src/client/qal.h
r118 r0 30 30 #include "../qcommon/qcommon.h" 31 31 32 #if defUSE_OPENAL_DLOPEN32 #if USE_OPENAL_DLOPEN 33 33 #define AL_NO_PROTOTYPES 34 34 #define ALC_NO_PROTOTYPES 35 35 #endif 36 36 37 #if defUSE_LOCAL_HEADERS37 #if USE_LOCAL_HEADERS 38 38 #include "../AL/al.h" 39 39 #include "../AL/alc.h" … … 49 49 #endif 50 50 51 #if defUSE_OPENAL_DLOPEN51 #if USE_OPENAL_DLOPEN 52 52 extern LPALENABLE qalEnable; 53 53 extern LPALDISABLE qalDisable; -
src/client/snd_codec.c
r118 r0 104 104 codecs = NULL; 105 105 S_CodecRegister(&wav_codec); 106 #if defUSE_CODEC_VORBIS106 #if USE_CODEC_VORBIS 107 107 S_CodecRegister(&ogg_codec); 108 108 #endif -
src/client/snd_codec_ogg.c
r118 r0 24 24 25 25 // OGG support is enabled by this define 26 #if defUSE_CODEC_VORBIS26 #if USE_CODEC_VORBIS 27 27 28 28 // includes for the Q3 sound system -
src/client/snd_openal.c
r118 r0 27 27 #include "client.h" 28 28 29 #if defUSE_OPENAL29 #if USE_OPENAL 30 30 31 31 #include "qal.h" … … 1866 1866 qboolean S_AL_Init( soundInterface_t *si ) 1867 1867 { 1868 #if defUSE_OPENAL1868 #if USE_OPENAL 1869 1869 1870 1870 qboolean enumsupport, founddev = qfalse; -
src/game/bg_lib.c
r118 r0 25 25 // compiled for the virtual machine 26 26 27 28 #ifdef Q3_VM29 27 30 28 #include "../qcommon/q_shared.h" … … 70 68 #endif 71 69 static const char rcsid[] = 72 "$Id: bg_lib.c 1003 2007-09-22 20:55:11Z tma$";70 "$Id: bg_lib.c 965 2007-08-09 13:54:12Z msk $"; 73 71 #endif /* LIBC_SCCS and not lint */ 72 73 // bk001127 - needed for DLL's 74 #if !defined( Q3_VM ) 75 typedef int cmp_t(const void *, const void *); 76 #endif 74 77 75 78 static char* med3(char *, char *, char *, cmp_t *); … … 213 216 214 217 218 // this file is excluded from release builds because of intrinsics 219 220 // bk001211 - gcc errors on compiling strcpy: parse error before `__extension__' 221 #if defined ( Q3_VM ) 222 215 223 size_t strlen( const char *string ) 216 224 { … … 265 273 } 266 274 275 //TA: 267 276 char *strrchr( const char *string, int c ) 268 277 { … … 313 322 } 314 323 324 #endif // bk001211 325 326 #if defined ( Q3_VM ) 327 315 328 int tolower( int c ) 316 329 { … … 329 342 return c; 330 343 } 344 345 #endif 331 346 332 347 void *memmove( void *dest, const void *src, size_t count ) … … 802 817 #endif 803 818 819 #ifdef Q3_VM 804 820 /* 805 821 =============== … … 815 831 } 816 832 833 // bk001127 - guarded this tan replacement 834 // ld: undefined versioned symbol name tan@@GLIBC_2.0 817 835 double tan( double x ) 818 836 { … … 1299 1317 } 1300 1318 1319 #endif 1320 1301 1321 1302 1322 … … 1395 1415 float sign; 1396 1416 float value; 1397 int c = '0'; 1417 int c = '0'; // bk001211 - uninitialized use possible 1398 1418 1399 1419 string = *stringPtr; … … 1469 1489 } 1470 1490 1491 1492 #if defined ( Q3_VM ) 1471 1493 1472 1494 int atoi( const char *string ) … … 1925 1947 case 'f': 1926 1948 AddFloat( &buf_p, *(double *)arg, width, prec ); 1927 arg += 1; // everything is 32 bit 1949 #ifdef Q3_VM 1950 arg += 1; // everything is 32 bit in my compiler 1951 #else 1952 arg += 2; 1953 #endif 1928 1954 break; 1929 1955 -
src/game/bg_lib.h
r118 r0 26 26 27 27 // This file is NOT included on native builds 28 #if !defined( BG_LIB_H ) && defined( Q3_VM )28 #ifndef BG_LIB_H 29 29 #define BG_LIB_H 30 30 … … 55 55 #define LONG_MAX 2147483647L /* maximum (signed) long value */ 56 56 #define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */ 57 58 #define isalnum(c) (isalpha(c) || isdigit(c))59 #define isalpha(c) (isupper(c) || islower(c))60 #define isascii(c) ((c) > 0 && (c) <= 0x7f)61 #define iscntrl(c) (((c) >= 0) && (((c) <= 0x1f) || ((c) == 0x7f)))62 #define isdigit(c) ((c) >= '0' && (c) <= '9')63 #define isgraph(c) ((c) != ' ' && isprint(c))64 #define islower(c) ((c) >= 'a' && (c) <= 'z')65 #define isprint(c) ((c) >= ' ' && (c) <= '~')66 #define ispunct(c) (((c) > ' ' && (c) <= '~') && !isalnum(c))67 #define isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || \68 (c) == '\t' || (c) == '\v')69 #define isupper(c) ((c) >= 'A' && (c) <= 'Z')70 #define isxdigit(c) (isxupper(c) || isxlower(c))71 #define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f'))72 #define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F'))73 57 74 58 // Misc functions -
src/game/bg_misc.c
r122 r1 39 39 "eggpod", //char *buildName; 40 40 "Egg", //char *humanName; 41 "The most basic alien structure. It allows aliens to spawn "42 "and protect the Overmind. Without any of these, the Overmind "43 "is left nearly defenseless and defeat is imminent.",44 41 "team_alien_spawn", //char *entityName; 45 42 { "models/buildables/eggpod/eggpod.md3", 0, 0, 0 }, … … 79 76 "barricade", //char *buildName; 80 77 "Barricade", //char *humanName; 81 "Used to obstruct corridors and doorways, hindering humans from "82 "threatening the spawns and Overmind.",83 78 "team_alien_barricade",//char *entityName; 84 79 { "models/buildables/barricade/barricade.md3", 0, 0, 0 }, … … 118 113 "booster", //char *buildName; 119 114 "Booster", //char *humanName; 120 "Provides any alien with a poison ability on all its "121 "attacks. In addition to the default attack damage, the victim loses "122 "health over time unless they heal themselves with a medkit."123 "The booster also increases the rate of health regeneration for "124 "any nearby aliens.",125 115 "team_alien_booster", //char *entityName; 126 116 { "models/buildables/booster/booster.md3", 0, 0, 0 }, … … 160 150 "acid_tube", //char *buildName; 161 151 "Acid Tube", //char *humanName; 162 "Ejects lethal poisonous acid at an approaching human. These "163 "are highly effective when used in conjunction with a trapper "164 "to hold the victim in place.",165 152 "team_alien_acid_tube",//char *entityName; 166 153 { "models/buildables/acid_tube/acid_tube.md3", 0, 0, 0 }, … … 200 187 "hive", //char *buildName; 201 188 "Hive", //char *humanName; 202 "Houses millions of tiny insectoid aliens. When a human "203 "approaches this structure, the insectoids attack.",204 189 "team_alien_hive", //char *entityName; 205 190 { "models/buildables/acid_tube/acid_tube.md3", 0, 0, 0 }, … … 239 224 "trapper", //char *buildName; 240 225 "Trapper", //char *humanName; 241 "Fires a blob of adhesive spit at any non-alien in its line of "242 "sight. This hinders their movement, making them an easy target "243 "for other defensive structures or aliens.",244 226 "team_alien_trapper", //char *entityName; 245 227 { "models/buildables/trapper/trapper.md3", 0, 0, 0 }, … … 279 261 "overmind", //char *buildName; 280 262 "Overmind", //char *humanName; 281 "A collective consciousness that controls all the alien structures "282 "in its vicinity. It must be protected at all costs, since its "283 "death will render alien structures defenseless.",284 263 "team_alien_overmind", //char *entityName; 285 264 { "models/buildables/overmind/overmind.md3", 0, 0, 0 }, … … 319 298 "hovel", //char *buildName; 320 299 "Hovel", //char *humanName; 321 "An armoured shell used by the builder class to hide in, while "322 "the alien base is under attack. It may be entered or "323 "exited at any time.",324 300 "team_alien_hovel", //char *entityName; 325 301 { "models/buildables/hovel/hovel.md3", 0, 0, 0 }, … … 359 335 "telenode", //char *buildName; 360 336 "Telenode", //char *humanName; 361 "The most basic human structure. It provides a means for humans "362 "to enter the battle arena. Without any of these the humans "363 "cannot spawn and defeat is imminent.",364 337 "team_human_spawn", //char *entityName; 365 338 { "models/buildables/telenode/telenode.md3", 0, 0, 0 }, … … 399 372 "medistat", //char *buildName; 400 373 "Medistation", //char *humanName; 401 "A structure providing an automated healing energy that restores "402 "the health of any human that stands inside it. It may only be used "403 "by one person at a time.",404 374 "team_human_medistat", //char *entityName; 405 375 { "models/buildables/medistat/medistat.md3", 0, 0, 0 }, … … 439 409 "mgturret", //char *buildName; 440 410 "Machinegun Turret", //char *humanName; 441 "Automated base defense that is effective against fast moving targets, "442 "but does not cause much damage on its own and should always be "443 "backed up by physical support.",444 411 "team_human_mgturret", //char *entityName; 445 412 { "models/buildables/mgturret/turret_base.md3", … … 481 448 "tesla", //char *buildName; 482 449 "Tesla Generator", //char *humanName; 483 "A structure equipped with a strong electrical attack that always "484 "hits its target. It is useful against larger aliens "485 "and for consolidating basic defense.",486 450 "team_human_tesla", //char *entityName; 487 451 { "models/buildables/tesla/tesla.md3", 0, 0, 0 }, … … 521 485 "dcc", //char *buildName; 522 486 "Defence Computer", //char *humanName; 523 "A structure coordinating the action of base defense so that "524 "defense is distributed evenly among the enemy. This structure "525 "is required for building the Tesla Generator.",526 487 "team_human_dcc", //char *entityName; 527 488 { "models/buildables/dcc/dcc.md3", 0, 0, 0 }, … … 561 522 "arm", //char *buildName; 562 523 "Armoury", //char *humanName; 563 "An essential part of the human base, providing a means "564 "to upgrade the basic human. A range of upgrades and weapons are "565 "available from the armoury, each with a price.",566 524 "team_human_armoury", //char *entityName; 567 525 { "models/buildables/arm/arm.md3", 0, 0, 0 }, … … 601 559 "reactor", //char *buildName; 602 560 "Reactor", //char *humanName; 603 "All structures except the telenode rely on a reactor to operate."604 "The reactor provides power for all the human structures either "605 "directly or via repeaters. There can only be a single reactor.",606 561 "team_human_reactor", //char *entityName; 607 562 { "models/buildables/reactor/reactor.md3", 0, 0, 0 }, … … 641 596 "repeater", //char *buildName; 642 597 "Repeater", //char *humanName; 643 "A power distributor that transmits power from the reactor "644 "to remote locations, so that bases may be built far "645 "from the reactor.",646 598 "team_human_repeater", //char *entityName; 647 599 { "models/buildables/repeater/repeater.md3", 0, 0, 0 }, … … 762 714 /* 763 715 ============== 764 BG_FindInfoForBuildable765 ==============766 */767 char *BG_FindInfoForBuildable( int bclass )768 {769 int i;770 771 for( i = 0; i < bg_numBuildables; i++ )772 {773 if( bg_buildableList[ i ].buildNum == bclass )774 return bg_buildableList[ i ].info;775 }776 777 //wimp out778 return 0;779 }780 781 /*782 ==============783 716 BG_FindEntityNameForBuildNum 784 717 ============== … … 1598 1531 "spectator", //char *className; 1599 1532 "Spectator", //char *humanName; 1600 "",1601 1533 "", //char *modelname; 1602 1534 1.0f, //float modelScale; … … 1637 1569 "builder", //char *className; 1638 1570 "Builder", //char *humanName; 1639 "Responsible for building and maintaining all the alien structures.",1640 1571 "builder", //char *modelname; 1641 1572 1.0f, //float modelScale; … … 1676 1607 "builderupg", //char *classname; 1677 1608 "Advanced Builder", //char *humanname; 1678 "Similar to the base Granger, except that in addition to "1679 "being able to build structures it has a melee attack "1680 "and the ability to crawl on walls.",1681 1609 "builder", //char *modelname; 1682 1610 1.0f, //float modelScale; … … 1717 1645 "level0", //char *classname; 1718 1646 "Soldier", //char *humanname; 1719 "Has a lethal bite and the ability to crawl on walls and ceilings.",1720 1647 "jumper", //char *modelname; 1721 1648 0.2f, //float modelScale; … … 1757 1684 "level1", //char *classname; 1758 1685 "Hydra", //char *humanname; 1759 "Able to crawl on walls and ceilings. Its melee attack is most "1760 "effective when combined with the ability to grab its foe.",1761 1686 "spitter", //char *modelname; 1762 1687 0.6f, //float modelScale; … … 1798 1723 "level1upg", //char *classname; 1799 1724 "Hydra Upgrade", //char *humanname; 1800 "In addition to the basic Basilisk abilities, the Advanced "1801 "Basilisk sprays a poisonous gas which disorientaits any "1802 "nearby humans.",1803 1725 "spitter", //char *modelname; 1804 1726 0.7f, //float modelScale; … … 1840 1762 "level2", //char *classname; 1841 1763 "Chimera", //char *humanname; 1842 "Has a melee attack and the ability to jump off walls. This "1843 "allows the Marauder to gather great speed in enclosed areas.",1844 1764 "tarantula", //char *modelname; 1845 1765 0.75f, //float modelScale; … … 1881 1801 "level2upg", //char *classname; 1882 1802 "Chimera Upgrade", //char *humanname; 1883 "The Advanced Marauder has all the abilities of the base Marauder "1884 "including an area effect electric shock attack.",1885 1803 "tarantula", //char *modelname; 1886 1804 0.9f, //float modelScale; … … 1922 1840 "level3", //char *classname; 1923 1841 "Dragoon", //char *humanname; 1924 "Possesses a melee attack and the pounce ability, which may "1925 "be used as an attack, or a means to reach a remote "1926 "location inaccessible from the ground.",1927 1842 "prowl", //char *modelname; 1928 1843 1.0f, //float modelScale; … … 1964 1879 "level3upg", //char *classname; 1965 1880 "Dragoon Upgrade", //char *humanname; 1966 "In addition to the basic Dragoon abilities, the Dragoon "1967 "Upgrade has 3 barbs which may be used to attack humans "1968 "from a distance.",1969 1881 "prowl", //char *modelname; 1970 1882 1.0f, //float modelScale; … … 2006 1918 "level4", //char *classname; 2007 1919 "Big Mofo", //char *humanname; 2008 "Provides a healing aura in which nearby aliens regenerate health "2009 "faster than usual. As well as a melee attack, this class can charge "2010 "at enemy humans and structures, inflicting great damage.",2011 1920 "mofo", //char *modelname; 2012 1921 1.0f, //float modelScale; … … 2048 1957 "human_base", //char *classname; 2049 1958 "Human", //char *humanname; 2050 "",2051 1959 "sarge", //char *modelname; 2052 1960 1.0f, //float modelScale; … … 2085 1993 }, 2086 1994 { 2087 PCL_HUMAN_BSUIT, //int classnum; 2088 "human_bsuit", //char *classname; 2089 "Battlesuit", //char *humanname; 2090 "", 2091 "keel", //char *modelname; 2092 1.0f, //float modelScale; 2093 "default", //char *skinname; 2094 1.0f, //float shadowScale; 2095 "human_hud", //char *hudname; 2096 ( 1 << S3 ), //int stages 2097 { -15, -15, -38 }, //vec3_t mins; 2098 { 15, 15, 38 }, //vec3_t maxs; 2099 { 15, 15, 38 }, //vec3_t crouchmaxs; 2100 { -15, -15, -4 }, //vec3_t deadmins; 2101 { 15, 15, 4 }, //vec3_t deadmaxs; 2102 -16.0f, //float zOffset 2103 35, 35, //int viewheight, crouchviewheight; 2104 100, //int health; 2105 1.0f, //float fallDamage; 2106 0, //int regenRate; 2107 SCA_TAKESFALLDAMAGE| 2108 SCA_CANUSELADDERS, //int abilities; 2109 WP_NONE, //special-cased in g_client.c //weapon_t startWeapon 2110 110.0f, //float buildDist; 2111 90, //int fov; 2112 0.002f, //float bob; 2113 1.0f, //float bobCycle; 2114 100, //int steptime; 2115 1.0f, //float speed; 2116 10.0f, //float acceleration; 2117 1.0f, //float airAcceleration; 2118 6.0f, //float friction; 2119 100.0f, //float stopSpeed; 2120 270.0f, //float jumpMagnitude; 2121 1.0f, //float knockbackScale; 2122 { PCL_NONE, PCL_NONE, PCL_NONE }, //int children[ 3 ]; 2123 0, //int cost; 2124 0 //int value; 2125 }, 1995 //this isn't a real class, but a dummy to force the client to precache the model 1996 //FIXME: one day do this in a less hacky fashion 1997 PCL_HUMAN_BSUIT, "human_bsuit", "bsuit", 1998 1999 "keel", 2000 1.0f, 2001 "default", 2002 1.0f, 2003 2004 "bsuit", ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), { 0, 0, 0 }, { 0, 0, 0, }, 2005 { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, 0.0f, 0, 0, 0, 0.0f, 0, 0, WP_NONE, 0.0f, 0, 2006 0.0f, 1.0f, 0, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 270.0f, 1.0f, { PCL_NONE, PCL_NONE, PCL_NONE }, 0, 0 2007 } 2126 2008 }; 2127 2009 … … 2189 2071 2190 2072 Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindHumanNameForClassNum\n" ); 2191 //wimp out2192 return 0;2193 }2194 2195 /*2196 ==============2197 BG_FindInfoForClassNum2198 ==============2199 */2200 char *BG_FindInfoForClassNum( int pclass )2201 {2202 int i;2203 2204 for( i = 0; i < bg_numPclasses; i++ )2205 {2206 if( bg_classList[ i ].classNum == pclass )2207 return bg_classList[ i ].info;2208 }2209 2210 Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindInfoForClassNum\n" );2211 2073 //wimp out 2212 2074 return 0; … … 3189 3051 "blaster", //char *weaponName; 3190 3052 "Blaster", //char *weaponHumanName; 3191 "",3192 3053 0, //int maxAmmo; 3193 3054 0, //int maxClips; … … 3215 3076 "rifle", //char *weaponName; 3216 3077 "Rifle", //char *weaponHumanName; 3217 "Basic weapon. Cased projectile weapon, with a slow clip based "3218 "reload system.",3219 3078 RIFLE_CLIPSIZE, //int maxAmmo; 3220 3079 RIFLE_MAXCLIPS, //int maxClips; … … 3242 3101 "shotgun", //char *weaponName; 3243 3102 "Shotgun", //char *weaponHumanName; 3244 "Close range weapon that is useful against larger foes. "3245 "It has a slow repeat rate, but can be devastatingly "3246 "effective.",3247 3103 SHOTGUN_SHELLS, //int maxAmmo; 3248 3104 SHOTGUN_MAXCLIPS, //int maxClips; … … 3270 3126 "flamer", //char *weaponName; 3271 3127 "Flame Thrower", //char *weaponHumanName; 3272 "Sprays fire at its target. It is powered by compressed "3273 "gas. The relatively low rate of fire means this weapon is most "3274 "effective against static targets.",3275 3128 FLAMER_GAS, //int maxAmmo; 3276 3129 0, //int maxClips; … … 3298 3151 "chaingun", //char *weaponName; 3299 3152 "Chaingun", //char *weaponHumanName; 3300 "Belt drive, cased projectile weapon. It has a high repeat "3301 "rate but a wide firing angle and is therefore relatively "3302 "inaccurate.",3303 3153 CHAINGUN_BULLETS, //int maxAmmo; 3304 3154 0, //int maxClips; … … 3326 3176 "mdriver", //char *weaponName; 3327 3177 "Mass Driver", //char *weaponHumanName; 3328 "A portable particle accelerator which causes minor nuclear "3329 "reactions at the point of impact. It has a very large "3330 "payload, but fires slowly.",3331 3178 MDRIVER_CLIPSIZE, //int maxAmmo; 3332 3179 MDRIVER_MAXCLIPS, //int maxClips; … … 3354 3201 "prifle", //char *weaponName; 3355 3202 "Pulse Rifle", //char *weaponHumanName; 3356 "An energy weapon that fires pulses of concentrated energy "3357 "at a fast rate. It requires re-energising every 50 pulses.",3358 3203 PRIFLE_CLIPS, //int maxAmmo; 3359 3204 PRIFLE_MAXCLIPS, //int maxClips; … … 3381 3226 "lcannon", //char *weaponName; 3382 3227 "Lucifer Cannon", //char *weaponHumanName; 3383 "Similar to the pulse rifle, but more powerful. Additionally, "3384 "it has a secondary attack where energy can be charged "3385 "up to shoot a devastating ball of energy.",3386 3228 LCANNON_AMMO, //int maxAmmo; 3387 3229 0, //int maxClips; … … 3409 3251 "lgun", //char *weaponName; 3410 3252 "Las Gun", //char *weaponHumanName; 3411 "Slightly more powerful than the basic rifle, but "3412 "instead of bullets it fires small packets of energy.",3413 3253 LASGUN_AMMO, //int maxAmmo; 3414 3254 0, //int maxClips; … … 3436 3276 "psaw", //char *weaponName; 3437 3277 "Pain Saw", //char *weaponHumanName; 3438 "Similar to a chainsaw, but instead of a chain it has an "3439 "electric arc capable of dealing a great deal of damage at "3440 "close range.",3441 3278 0, //int maxAmmo; 3442 3279 0, //int maxClips; … … 3464 3301 "grenade", //char *weaponName; 3465 3302 "Grenade", //char *weaponHumanName; 3466 "",3467 3303 1, //int maxAmmo; 3468 3304 0, //int maxClips; … … 3490 3326 "ckit", //char *weaponName; 3491 3327 "Construction Kit", //char *weaponHumanName; 3492 "Used for building all basic structures. This includes "3493 "spawns, power and basic defense.",3494 3328 0, //int maxAmmo; 3495 3329 0, //int maxClips; … … 3517 3351 "ackit", //char *weaponName; 3518 3352 "Adv Construction Kit",//char *weaponHumanName; 3519 "Used for building advanced structures. This includes "3520 "combat computers and advanced defense.",3521 3353 0, //int maxAmmo; 3522 3354 0, //int maxClips; … … 3544 3376 "abuild", //char *weaponName; 3545 3377 "Alien build weapon", //char *weaponHumanName; 3546 "",3547 3378 0, //int maxAmmo; 3548 3379 0, //int maxClips; … … 3570 3401 "abuildupg", //char *weaponName; 3571 3402 "Alien build weapon2",//char *weaponHumanName; 3572 "",3573 3403 0, //int maxAmmo; 3574 3404 0, //int maxClips; … … 3596 3426 "level0", //char *weaponName; 3597 3427 "Bite", //char *weaponHumanName; 3598 "",3599 3428 0, //int maxAmmo; 3600 3429 0, //int maxClips; … … 3622 3451 "level1", //char *weaponName; 3623 3452 "Claws", //char *weaponHumanName; 3624 "",3625 3453 0, //int maxAmmo; 3626 3454 0, //int maxClips; … … 3648 3476 "level1upg", //char *weaponName; 3649 3477 "Claws Upgrade", //char *weaponHumanName; 3650 "",3651 3478 0, //int maxAmmo; 3652 3479 0, //int maxClips; … … 3674 3501 "level2", //char *weaponName; 3675 3502 "Bite", //char *weaponHumanName; 3676 "",3677 3503 0, //int maxAmmo; 3678 3504 0, //int maxClips; … … 3700 3526 "level2upg", //char *weaponName; 3701 3527 "Zap", //char *weaponHumanName; 3702 "",3703 3528 0, //int maxAmmo; 3704 3529 0, //int maxClips; … … 3726 3551 "level3", //char *weaponName; 3727 3552 "Pounce", //char *weaponHumanName; 3728 "",3729 3553 0, //int maxAmmo; 3730 3554 0, //int maxClips; … … 3752 3576 "level3upg", //char *weaponName; 3753 3577 "Pounce (upgrade)", //char *weaponHumanName; 3754 "",3755 3578 3, //int maxAmmo; 3756 3579 0, //int maxClips; … … 3778 3601 "level4", //char *weaponName; 3779 3602 "Charge", //char *weaponHumanName; 3780 "",3781 3603 0, //int maxAmmo; 3782 3604 0, //int maxClips; … … 3804 3626 "lockblob", //char *weaponName; 3805 3627 "Lock Blob", //char *weaponHumanName; 3806 "",3807 3628 0, //int maxAmmo; 3808 3629 0, //int maxClips; … … 3830 3651 "hive", //char *weaponName; 3831 3652 "Hive", //char *weaponHumanName; 3832 "",3833 3653 0, //int maxAmmo; 3834 3654 0, //int maxClips; … … 3856 3676 "mgturret", //char *weaponName; 3857 3677 "Machinegun Turret", //char *weaponHumanName; 3858 "",3859 3678 0, //int maxAmmo; 3860 3679 0, //int maxClips; … … 3882 3701 "teslagen", //char *weaponName; 3883 3702 "Tesla Generator", //char *weaponHumanName; 3884 "",3885 3703 0, //int maxAmmo; 3886 3704 0, //int maxClips; … … 4027 3845 /* 4028 3846 ============== 4029 BG_FindInfoForWeapon4030 ==============4031 */4032 char *BG_FindInfoForWeapon( int weapon )4033 {4034 int i;4035 4036 for( i = 0; i < bg_numWeapons; i++ )4037 {4038 if( bg_weapons[ i ].weaponNum == weapon )4039 return bg_weapons[ i ].info;4040 }4041 4042 //wimp out4043 return 0;4044 }4045 4046 /*4047 ==============4048 3847 BG_FindAmmoForWeapon 4049 3848 ============== … … 4373 4172 "larmour", //char *upgradeName; 4374 4173 "Light Armour", //char *upgradeHumanName; 4375 "Protective armour that helps to defend against light alien melee "4376 "attacks.",4377 4174 "icons/iconu_larmour", 4378 4175 qtrue, //qboolean purchasable … … 4387 4184 "helmet", //char *upgradeName; 4388 4185 "Helmet", //char *upgradeHumanName; 4389 "In addition to protecting your head, the helmet provides a "4390 "scanner indicating the presence of any non-human lifeforms in your "4391 "immediate vicinity.",4392 4186 "icons/iconu_helmet", 4393 4187 qtrue, //qboolean purchasable … … 4402 4196 "medkit", //char *upgradeName; 4403 4197 "Medkit", //char *upgradeHumanName; 4404 "",4405 4198 "icons/iconu_atoxin", 4406 4199 qfalse, //qboolean purchasable … … 4415 4208 "battpack", //char *upgradeName; 4416 4209 "Battery Pack", //char *upgradeHumanName; 4417 "Back-mounted battery pack that permits storage of one and a half "4418 "times the normal energy capacity for energy weapons.",4419 4210 "icons/iconu_battpack", 4420 4211 qtrue, //qboolean purchasable … … 4429 4220 "jetpack", //char *upgradeName; 4430 4221 "Jet Pack", //char *upgradeHumanName; 4431 "Back-mounted jet pack that enables the user to fly to remote "4432 "locations. It is very useful against alien spawns in hard "4433 "to reach spots.",4434 4222 "icons/iconu_jetpack", 4435 4223 qtrue, //qboolean purchasable … … 4444 4232 "bsuit", //char *upgradeName; 4445 4233 "Battlesuit", //char *upgradeHumanName; 4446 "A full body armour that is highly effective at repelling alien attacks. "4447 "It allows the user to enter hostile situations with a greater degree "4448 "of confidence.",4449 4234 "icons/iconu_bsuit", 4450 4235 qtrue, //qboolean purchasable … … 4459 4244 "gren", //char *upgradeName; 4460 4245 "Grenade", //char *upgradeHumanName; 4461 "A small incendinary device ideal for damaging tightly packed "4462 "alien structures. Has a five second timer.",4463 4246 0, 4464 4247 qtrue, //qboolean purchasable … … 4473 4256 "ammo", //char *upgradeName; 4474 4257 "Ammunition", //char *upgradeHumanName; 4475 "Ammunition for the currently held weapon.",4476 4258 0, 4477 4259 qtrue, //qboolean purchasable … … 4597 4379 if( bg_upgrades[ i ].upgradeNum == upgrade ) 4598 4380 return bg_upgrades[ i ].upgradeHumanName; 4599 }4600 4601 //wimp out4602 return 0;4603 }4604 4605 /*4606 ==============4607 BG_FindInfoForUpgrade4608 ==============4609 */4610 char *BG_FindInfoForUpgrade( int upgrade )4611 {4612 int i;4613 4614 for( i = 0; i < bg_numUpgrades; i++ )4615 {4616 if( bg_upgrades[ i ].upgradeNum == upgrade )4617 return bg_upgrades[ i ].info;4618 4381 } 4619 4382 … … 4852 4615 "EV_FIRE_WEAPON3", 4853 4616 4854 "EV_PLAYER_RESPAWN", // for fovwarp effects4617 "EV_PLAYER_RESPAWN", //TA: for fovwarp effects 4855 4618 "EV_PLAYER_TELEPORT_IN", 4856 4619 "EV_PLAYER_TELEPORT_OUT", … … 4884 4647 "EV_GIB_PLAYER", // gib a previously living player 4885 4648 4886 "EV_BUILD_CONSTRUCT", 4887 "EV_BUILD_DESTROY", 4888 "EV_BUILD_DELAY", // can't build yet4889 "EV_BUILD_REPAIR", // repairing buildable4890 "EV_BUILD_REPAIRED", // buildable has full health4649 "EV_BUILD_CONSTRUCT", //TA 4650 "EV_BUILD_DESTROY", //TA 4651 "EV_BUILD_DELAY", //TA: can't build yet 4652 "EV_BUILD_REPAIR", //TA: repairing buildable 4653 "EV_BUILD_REPAIRED", //TA: buildable has full health 4891 4654 "EV_HUMAN_BUILDABLE_EXPLOSION", 4892 4655 "EV_ALIEN_BUILDABLE_EXPLOSION", … … 4902 4665 "EV_TAUNT", 4903 4666 4904 "EV_OVERMIND_ATTACK", // overmind under attack4905 "EV_OVERMIND_DYING", // overmind close to death4906 "EV_OVERMIND_SPAWNS", // overmind needs spawns4907 4908 "EV_DCC_ATTACK", // dcc under attack4909 4910 "EV_RPTUSE_SOUND" // trigger a sound4667 "EV_OVERMIND_ATTACK", //TA: overmind under attack 4668 "EV_OVERMIND_DYING", //TA: overmind close to death 4669 "EV_OVERMIND_SPAWNS", //TA: overmind needs spawns 4670 4671 "EV_DCC_ATTACK", //TA: dcc under attack 4672 4673 "EV_RPTUSE_SOUND" //TA: trigger a sound 4911 4674 }; 4912 4675 … … 4982 4745 SnapVector( s->apos.trBase ); 4983 4746 4747 //TA: i need for other things :) 4748 //s->angles2[YAW] = ps->movementDir; 4984 4749 s->time2 = ps->movementDir; 4985 4750 s->legsAnim = ps->legsAnim; … … 5033 4798 } 5034 4799 5035 // use powerups field to store team/class info:4800 //TA: use powerups field to store team/class info: 5036 4801 s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); 5037 4802 5038 // have to get the surfNormal throughsomehow...4803 //TA: have to get the surfNormal thru somehow... 5039 4804 VectorCopy( ps->grapplePoint, s->angles2 ); 5040 4805 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) … … 5090 4855 SnapVector( s->apos.trBase ); 5091 4856 4857 //TA: i need for other things :) 4858 //s->angles2[YAW] = ps->movementDir; 5092 4859 s->time2 = ps->movementDir; 5093 4860 s->legsAnim = ps->legsAnim; … … 5143 4910 } 5144 4911 5145 // use powerupsfield to store team/class info:4912 //TA: use powerups field to store team/class info: 5146 4913 s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); 5147 4914 5148 // have to get the surfNormal throughsomehow...4915 //TA: have to get the surfNormal thru somehow... 5149 4916 VectorCopy( ps->grapplePoint, s->angles2 ); 5150 4917 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) … … 5162 4929 /* 5163 4930 ======================== 5164 BG_UnpackAmmoArray 4931 BG_UnpackAmmoArray 5165 4932 5166 4933 Extract the ammo quantity from the array 5167 4934 ======================== 5168 4935 */ 5169 void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ) 4936 void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ) 5170 4937 { 5171 4938 int ammoarray[ 32 ]; … … 5183 4950 if( clips != NULL ) 5184 4951 *clips = ( ammoarray[ weapon ] >> 12 ) & 0x0F; 5185 } 5186 5187 /* 5188 ======================== 4952 } 4953 4954 /* 4955 ======================== 5189 4956 BG_PackAmmoArray 5190 4957 … … 5193 4960 */ 5194 4961 void BG_PackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int ammo, int clips ) 5195 { 4962 { 5196 4963 int weaponvalue; 5197 4964 5198 4965 weaponvalue = ammo | ( clips << 12 ); 5199 4966 5200 4967 if( weapon <= 15 ) 5201 4968 psAmmo[ weapon ] = weaponvalue; 5202 4969 else if( weapon >= 16 ) 5203 4970 psAmmo2[ weapon - 16 ] = weaponvalue; 5204 } 4971 } 5205 4972 5206 4973 /* … … 5413 5180 5414 5181 return qtrue; 5415 }5416 5417 /*5418 ===============5419 BG_GetClientNormal5420 5421 Get the normal for the surface the client is walking on5422 ===============5423 */5424 void BG_GetClientNormal( const playerState_t *ps, vec3_t normal )5425 {5426 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )5427 {5428 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )5429 VectorSet( normal, 0.0f, 0.0f, -1.0f );5430 else5431 VectorCopy( ps->grapplePoint, normal );5432 }5433 else5434 VectorSet( normal, 0.0f, 0.0f, 1.0f );5435 5182 } 5436 5183 … … 5452 5199 float buildDist; 5453 5200 5454 BG_GetClientNormal( ps, playerNormal ); 5201 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) 5202 { 5203 if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 5204 VectorSet( playerNormal, 0.0f, 0.0f, -1.0f ); 5205 else 5206 VectorCopy( ps->grapplePoint, playerNormal ); 5207 } 5208 else 5209 VectorSet( playerNormal, 0.0f, 0.0f, 1.0f ); 5455 5210 5456 5211 VectorCopy( ps->viewangles, angles ); … … 5472 5227 VectorMA( targetOrigin, -128, playerNormal, targetOrigin ); 5473 5228 5474 // The mask is MASK_DEADSOLID on purpose to avoid collisions with other entities5475 5229 (*trace)( tr, entityOrigin, mins, maxs, targetOrigin, ps->clientNum, MASK_DEADSOLID ); 5476 5230 VectorCopy( tr->endpos, entityOrigin ); -
src/game/bg_pmove.c
r122 r1 235 235 vel = pm->ps->velocity; 236 236 237 // make sure vertical velocity is NOT set to zero when wall climbing237 //TA: make sure vertical velocity is NOT set to zero when wall climbing 238 238 VectorCopy( vel, vec ); 239 239 if( pml.walking && !( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ) … … 666 666 static qboolean PM_CheckJump( void ) 667 667 { 668 vec3_t normal;669 670 668 if( BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_PCLASS ] ) == 0.0f ) 671 669 return qfalse; … … 715 713 pm->ps->pm_flags |= PMF_JUMP_HELD; 716 714 717 // take some stamina off715 //TA: take some stamina off 718 716 if( pm->ps->stats[ STAT_PTEAM ] == PTE_HUMANS ) 719 717 pm->ps->stats[ STAT_STAMINA ] -= 500; … … 721 719 pm->ps->groundEntityNum = ENTITYNUM_NONE; 722 720 723 // jump away from wall 724 BG_GetClientNormal( pm->ps, normal ); 725 726 VectorMA( pm->ps->velocity, BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_PCLASS ] ), 727 normal, pm->ps->velocity ); 721 //TA: jump away from wall 722 if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) 723 { 724 vec3_t normal = { 0, 0, -1 }; 725 726 if( !( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) ) 727 VectorCopy( pm->ps->grapplePoint, normal ); 728 729 VectorMA( pm->ps->velocity, BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_PCLASS ] ), 730 normal, pm->ps->velocity ); 731 } 732 else 733 pm->ps->velocity[ 2 ] = BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_PCLASS ] ); 728 734 729 735 PM_AddEvent( EV_JUMP ); … … 1470 1476 static int PM_FootstepForSurface( void ) 1471 1477 { 1478 //TA: 1472 1479 if( pm->ps->stats[ STAT_STATE ] & SS_CREEPSLOWED ) 1473 1480 return EV_FOOTSTEP_SQUELCH; … … 1718 1725 vec3_t abc; 1719 1726 1720 BG_GetClientNormal( pm->ps, surfNormal ); 1727 //TA: If we're on the ceiling then grapplePoint is a rotation normal.. otherwise its a surface normal. 1728 // would have been nice if Carmack had left a few random variables in the ps struct for mod makers 1729 if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 1730 VectorCopy( ceilingNormal, surfNormal ); 1731 else 1732 VectorCopy( pm->ps->grapplePoint, surfNormal ); 1721 1733 1722 1734 //construct a vector which reflects the direction the player is looking wrt the surface normal … … 2276 2288 BG_FindViewheightForClass( pm->ps->stats[ STAT_PCLASS ], &PCvh, &PCcvh ); 2277 2289 2290 //TA: iD bug? you can still crouch when you're a spectator 2278 2291 if( pm->ps->persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) 2279 2292 PCcvh = PCvh; … … 2294 2307 } 2295 2308 2296 // If the standing and crouching viewheights are the same the class can't crouch2309 //TA: If the standing and crouching viewheights are the same the class can't crouch 2297 2310 if( ( pm->cmd.upmove < 0 ) && ( PCvh != PCcvh ) && 2298 2311 pm->ps->pm_type != PM_JETPACK && … … 2349 2362 if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) && ( pml.groundPlane ) ) 2350 2363 { 2351 // FIXME: yes yes i know this is wrong2364 //TA: FIXME: yes yes i know this is wrong 2352 2365 pm->xyspeed = sqrt( pm->ps->velocity[ 0 ] * pm->ps->velocity[ 0 ] 2353 2366 + pm->ps->velocity[ 1 ] * pm->ps->velocity[ 1 ] … … 2710 2723 if( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING ) 2711 2724 { 2712 // must press use to switch weapons2725 //TA: must press use to switch weapons 2713 2726 if( pm->cmd.buttons & BUTTON_USE_HOLDABLE ) 2714 2727 { … … 2773 2786 // start the animation even if out of ammo 2774 2787 2775 BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips );2788 BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips ); 2776 2789 BG_FindAmmoForWeapon( pm->ps->weapon, NULL, &maxClips ); 2777 2790 … … 2859 2872 attack1 = pm->cmd.buttons & BUTTON_ATTACK; 2860 2873 attack2 = pm->cmd.buttons & BUTTON_ATTACK2; 2861 attack3 = qfalse;2862 2863 if( attack1)2874 attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE; 2875 2876 if( ( attack1 || pm->ps->stats[ STAT_MISC ] == 0 ) && !attack2 && !attack3 ) 2864 2877 { 2865 attack2 = qfalse;2866 2867 2878 if( pm->ps->stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE ) 2868 2879 { 2869 // Charging2870 2880 pm->ps->weaponTime = 0; 2871 2881 pm->ps->weaponstate = WEAPON_READY; 2872 2882 return; 2873 2883 } 2884 else 2885 attack1 = !attack1; 2874 2886 } 2875 2887 2888 //erp this looks confusing 2876 2889 if( pm->ps->stats[ STAT_MISC ] > LCANNON_MIN_CHARGE ) 2877 { 2878 // Fire primary attack 2879 attack1 = qtrue; 2880 attack2 = qfalse; 2881 } 2890 attack1 = !attack1; 2882 2891 else if( pm->ps->stats[ STAT_MISC ] > 0 ) 2883 2892 { 2884 // Not enough charge2885 2893 pm->ps->stats[ STAT_MISC ] = 0; 2886 pm->ps->weaponTime = 0;2887 pm->ps->weaponstate = WEAPON_READY;2888 return;2889 }2890 else if( !attack2 )2891 {2892 // Idle2893 2894 pm->ps->weaponTime = 0; 2894 2895 pm->ps->weaponstate = WEAPON_READY; … … 2924 2925 } 2925 2926 2926 // fire events for non auto weapons2927 //TA: fire events for non auto weapons 2927 2928 if( attack3 ) 2928 2929 { … … 2972 2973 } 2973 2974 2974 // fire events for autohit weapons2975 //TA: fire events for autohit weapons 2975 2976 if( pm->autoWeaponHit[ pm->ps->weapon ] ) 2976 2977 { … … 3049 3050 if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) 3050 3051 { 3051 //special case for l cannon3052 //special case for lCanon 3052 3053 if( pm->ps->weapon == WP_LUCIFER_CANNON && attack1 && !attack2 ) 3053 3054 { … … 3217 3218 for( i = 0; i < 3; i++ ) 3218 3219 { 3219 while( tempang[ i ] > 180 .0f)3220 tempang[ i ] -= 360 .0f;3221 3222 while( tempang[ i ] < -180.0f)3223 tempang[ i ] += 360 .0f;3220 while( tempang[ i ] > 180 ) 3221 tempang[ i ] -= 360; 3222 3223 while( tempang[ i ] < 180 ) 3224 tempang[ i ] += 360; 3224 3225 } 3225 3226 … … 3270 3271 { 3271 3272 int ammo, clips; 3273 3272 3274 pm = pmove; 3273 3275 … … 3436 3438 if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) && 3437 3439 ( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ) 3438 PM_ClimbMove( ); // walking on any surface3440 PM_ClimbMove( ); //TA: walking on any surface 3439 3441 else 3440 3442 PM_WalkMove( ); // walking on ground … … 3447 3449 // set groundentity, watertype, and waterlevel 3448 3450 PM_GroundTrace( ); 3449 3451 //TA: must update after every GroundTrace() - yet more clock cycles down the drain :( (14 vec rotations/frame) 3450 3452 // update the viewangles 3451 3453 PM_UpdateViewAngles( pm->ps, &pm->cmd ); … … 3518 3520 } 3519 3521 } 3522 3523 /* 3524 ================ 3525 PmovePredict 3526 3527 Used by the server to move a client along when they miss a server frame 3528 ================ 3529 */ 3530 3531 void PmovePredict( pmove_t *pmove, float frametime ) 3532 { 3533 pm = pmove; 3534 memset( &pml, 0, sizeof( pml ) ); 3535 pml.frametime = frametime; 3536 PM_GroundTrace( ); 3537 if( pml.groundPlane ) 3538 PM_StepSlideMove( qfalse, qtrue ); 3539 else 3540 PM_StepSlideMove( qtrue, qtrue ); 3541 } -
src/game/bg_public.h
r122 r1 40 40 #define DEFAULT_VIEWHEIGHT 26 41 41 #define CROUCH_VIEWHEIGHT 12 42 #define DEAD_VIEWHEIGHT -14 // watch for mins[ 2 ] less than this causing42 #define DEAD_VIEWHEIGHT -14 //TA: watch for mins[ 2 ] less than this causing 43 43 44 44 // … … 70 70 #define CS_SHADERSTATE 24 71 71 #define CS_BOTINFO 25 72 #define CS_CLIENTS_READY 26 73 72 #define CS_CLIENTS_READY 26 //TA: following suggestion in STAT_ enum STAT_CLIENTS_READY becomes a configstring 73 74 //TA: extra stuff: 74 75 #define CS_BUILDPOINTS 28 75 76 #define CS_STAGES 29 … … 141 142 #define PMF_RESPAWNED 512 // clear after attack and jump buttons come up 142 143 #define PMF_USE_ITEM_HELD 1024 143 #define PMF_WEAPON_RELOAD 2048 // force a weapon switch144 #define PMF_WEAPON_RELOAD 2048 //TA: force a weapon switch 144 145 #define PMF_FOLLOW 4096 // spectate following another player 145 #define PMF_QUEUED 8192 // player is queued146 #define PMF_TIME_WALLJUMP 16384 // for limiting wall jumping147 #define PMF_CHARGE 32768 // keep track of pouncing148 #define PMF_WEAPON_SWITCH 65536 // force a weapon switch146 #define PMF_QUEUED 8192 //TA: player is queued 147 #define PMF_TIME_WALLJUMP 16384 //TA: for limiting wall jumping 148 #define PMF_CHARGE 32768 //TA: keep track of pouncing 149 #define PMF_WEAPON_SWITCH 65536 //TA: force a weapon switch 149 150 150 151 … … 167 168 int debugLevel; // if set, diagnostic output will be printed 168 169 qboolean noFootsteps; // if the game is setup for no footsteps by the server 169 qboolean autoWeaponHit[ 32 ]; 170 qboolean autoWeaponHit[ 32 ]; //FIXME: TA: remind myself later this might be a problem 170 171 171 172 int framecount; … … 199 200 void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ); 200 201 void Pmove( pmove_t *pmove ); 202 void PmovePredict( pmove_t *pmove, float frametime ); 201 203 202 204 //=================================================================================== … … 208 210 STAT_HEALTH, 209 211 STAT_ITEMS, 210 STAT_SLOTS, // tracks the amount of stuff human players are carrying212 STAT_SLOTS, //TA: tracks the amount of stuff human players are carrying 211 213 STAT_ACTIVEITEMS, 212 214 STAT_WEAPONS, // 16 bit fields 213 STAT_WEAPONS2, // another 16 bits to push the max weapon count up215 STAT_WEAPONS2, //TA: another 16 bits to push the max weapon count up 214 216 STAT_MAX_HEALTH, // health / armor limit, changable by handicap 215 STAT_PCLASS, // player class (for aliens AND humans) 216 STAT_PTEAM, // player team 217 STAT_STAMINA, // stamina (human only) 218 STAT_STATE, // client states e.g. wall climbing 219 STAT_MISC, // for uh...misc stuff 220 STAT_BUILDABLE, // which ghost model to display for building 221 STAT_FALLDIST, // the distance the player fell 222 STAT_VIEWLOCK // direction to lock the view in 217 STAT_PCLASS, //TA: player class (for aliens AND humans) 218 STAT_PTEAM, //TA: player team 219 STAT_STAMINA, //TA: stamina (human only) 220 STAT_STATE, //TA: client states e.g. wall climbing 221 STAT_MISC, //TA: for uh...misc stuff 222 STAT_BUILDABLE, //TA: which ghost model to display for building 223 STAT_BOOSTTIME, //TA: time left for boost (alien only) 224 STAT_FALLDIST, //TA: the distance the player fell 225 STAT_VIEWLOCK //TA: direction to lock the view in 223 226 } statIndex_t; 224 227 … … 264 267 PERS_KILLED, // count of the number of times you died 265 268 269 //TA: 266 270 PERS_STATE, 267 271 PERS_CREDIT, // human credit … … 282 286 #define EF_BOUNCE_HALF 0x00000010 // for missiles 283 287 #define EF_NO_BOUNCE_SOUND 0x00000020 // for missiles 284 #define EF_WALLCLIMB 0x00000040 // wall walking285 #define EF_WALLCLIMBCEILING 0x00000080 // wall walking ceiling hack288 #define EF_WALLCLIMB 0x00000040 // TA: wall walking 289 #define EF_WALLCLIMBCEILING 0x00000080 // TA: wall walking ceiling hack 286 290 #define EF_NODRAW 0x00000100 // may have an event, but no model (unspawned items) 287 291 #define EF_FIRING 0x00000200 // for lightning gun … … 293 297 #define EF_VOTED 0x00008000 // already cast a vote 294 298 #define EF_TEAMVOTED 0x00010000 // already cast a vote 295 #define EF_BLOBLOCKED 0x00020000 // caught by a trapper 296 #define EF_REAL_LIGHT 0x00040000 // light sprites according to ambient light 299 #define EF_BLOBLOCKED 0x00020000 // TA: caught by a trapper 300 #define EF_REAL_LIGHT 0x00040000 // TA: light sprites according to ambient light 301 302 typedef enum 303 { 304 PW_NONE, 305 306 PW_QUAD, 307 PW_BATTLESUIT, 308 PW_HASTE, 309 PW_INVIS, 310 PW_REGEN, 311 PW_FLIGHT, 312 313 PW_REDFLAG, 314 PW_BLUEFLAG, 315 PW_BALL, 316 317 PW_NUM_POWERUPS 318 } powerup_t; 297 319 298 320 typedef enum … … 386 408 } WUTeam_t; 387 409 388 // bitmasks for upgrade slots410 //TA: bitmasks for upgrade slots 389 411 #define SLOT_NONE 0x00000000 390 412 #define SLOT_HEAD 0x00000001 … … 503 525 EV_FIRE_WEAPON3, 504 526 505 EV_PLAYER_RESPAWN, // for fovwarp effects527 EV_PLAYER_RESPAWN, //TA: for fovwarp effects 506 528 EV_PLAYER_TELEPORT_IN, 507 529 EV_PLAYER_TELEPORT_OUT, … … 535 557 EV_GIB_PLAYER, // gib a previously living player 536 558 537 EV_BUILD_CONSTRUCT, 538 EV_BUILD_DESTROY, 539 EV_BUILD_DELAY, // can't build yet540 EV_BUILD_REPAIR, // repairing buildable541 EV_BUILD_REPAIRED, // buildable has full health559 EV_BUILD_CONSTRUCT, //TA 560 EV_BUILD_DESTROY, //TA 561 EV_BUILD_DELAY, //TA: can't build yet 562 EV_BUILD_REPAIR, //TA: repairing buildable 563 EV_BUILD_REPAIRED, //TA: buildable has full health 542 564 EV_HUMAN_BUILDABLE_EXPLOSION, 543 565 EV_ALIEN_BUILDABLE_EXPLOSION, … … 553 575 EV_TAUNT, 554 576 555 EV_OVERMIND_ATTACK, // overmind under attack556 EV_OVERMIND_DYING, // overmind close to death557 EV_OVERMIND_SPAWNS, // overmind needs spawns558 559 EV_DCC_ATTACK, // dcc under attack560 561 EV_RPTUSE_SOUND // trigger a sound577 EV_OVERMIND_ATTACK, //TA: overmind under attack 578 EV_OVERMIND_DYING, //TA: overmind close to death 579 EV_OVERMIND_SPAWNS, //TA: overmind needs spawns 580 581 EV_DCC_ATTACK, //TA: dcc under attack 582 583 EV_RPTUSE_SOUND //TA: trigger a sound 562 584 } entity_event_t; 563 585 … … 716 738 } nonSegPlayerAnimNumber_t; 717 739 718 // for buildable animations740 //TA: for buildable animations 719 741 typedef enum 720 742 { … … 776 798 #define TEAM_MAXOVERLAY 32 777 799 778 // player classes800 //TA: player classes 779 801 typedef enum 780 802 { … … 803 825 804 826 805 // player teams827 //TA: player teams 806 828 typedef enum 807 829 { … … 872 894 //--------------------------------------------------------- 873 895 874 // player class record896 //TA: player class record 875 897 typedef struct 876 898 { … … 879 901 char *className; 880 902 char *humanName; 881 char *info;882 903 883 904 char *modelName; … … 957 978 #define MAX_BUILDABLE_MODELS 4 958 979 959 // buildable item record980 //TA: buildable item record 960 981 typedef struct 961 982 { … … 964 985 char *buildName; 965 986 char *humanName; 966 char *info;967 987 char *entityName; 968 988 … … 1023 1043 } buildableAttributeOverrides_t; 1024 1044 1025 // weapon record1045 //TA: weapon record 1026 1046 typedef struct 1027 1047 { … … 1035 1055 char *weaponName; 1036 1056 char *weaponHumanName; 1037 char *info;1038 1057 1039 1058 int maxAmmo; … … 1062 1081 } weaponAttributes_t; 1063 1082 1064 // upgrade record1083 //TA: upgrade record 1065 1084 typedef struct 1066 1085 { … … 1074 1093 char *upgradeName; 1075 1094 char *upgradeHumanName; 1076 char *info;1077 1095 1078 1096 char *icon; … … 1084 1102 } upgradeAttributes_t; 1085 1103 1104 1105 //TA: 1086 1106 void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ); 1087 1107 void BG_PackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int ammo, int clips ); … … 1098 1118 qboolean BG_RotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], 1099 1119 vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ); 1100 void BG_GetClientNormal( const playerState_t *ps, vec3_t normal );1101 1120 void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, 1102 1121 const vec3_t mins, const vec3_t maxs, … … 1111 1130 char *BG_FindHumanNameForBuildable( int bclass ); 1112 1131 char *BG_FindEntityNameForBuildable( int bclass ); 1113 char *BG_FindInfoForBuildable( int bclass );1114 1132 char *BG_FindModelsForBuildable( int bclass, int modelNum ); 1115 1133 float BG_FindModelScaleForBuildable( int bclass ); … … 1147 1165 char *BG_FindNameForClassNum( int pclass ); 1148 1166 char *BG_FindHumanNameForClassNum( int pclass ); 1149 char *BG_FindInfoForClassNum( int pclass );1150 1167 char *BG_FindModelNameForClass( int pclass ); 1151 1168 float BG_FindModelScaleForClass( int pclass ); … … 1185 1202 int BG_FindWeaponNumForName( char *name ); 1186 1203 char *BG_FindHumanNameForWeapon( int weapon ); 1187 char *BG_FindInfoForWeapon( int weapon );1188 1204 char *BG_FindModelsForWeapon( int weapon, int modelNum ); 1189 1205 char *BG_FindIconForWeapon( int weapon ); … … 1213 1229 int BG_FindUpgradeNumForName( char *name ); 1214 1230 char *BG_FindHumanNameForUpgrade( int upgrade ); 1215 char *BG_FindInfoForUpgrade( int upgrade );1216 1231 char *BG_FindIconForUpgrade( int upgrade ); 1217 1232 qboolean BG_FindPurchasableForUpgrade( int upgrade ); … … 1238 1253 ET_ITEM, 1239 1254 1240 ET_BUILDABLE, // buildable type1255 ET_BUILDABLE, //TA: buildable type 1241 1256 1242 1257 ET_MISSILE, -
src/game/bg_slidemove.c
r118 r0 299 299 qboolean stepped = qfalse; 300 300 301 BG_GetClientNormal( pm->ps, normal ); 301 if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) 302 { 303 if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 304 VectorSet( normal, 0.0f, 0.0f, -1.0f ); 305 else 306 VectorCopy( pm->ps->grapplePoint, normal ); 307 } 308 else 309 VectorSet( normal, 0.0f, 0.0f, 1.0f ); 302 310 303 311 VectorCopy( pm->ps->origin, start_o ); -
src/game/g_active.c
r122 r1 526 526 usercmd_t *ucmd; 527 527 int aForward, aRight; 528 qboolean walking = qfalse, stopped = qfalse,529 crouched = qfalse, jumping = qfalse,530 strafing = qfalse;531 int i;532 528 533 529 ucmd = &ent->client->pers.cmd; … … 535 531 aForward = abs( ucmd->forwardmove ); 536 532 aRight = abs( ucmd->rightmove ); 537 538 if( aForward == 0 && aRight == 0 )539 stopped = qtrue;540 else if( aForward <= 64 && aRight <= 64 )541 walking = qtrue;542 543 if( aRight > 0 )544 strafing = qtrue;545 546 if( ucmd->upmove > 0 )547 jumping = qtrue;548 else if( ucmd->upmove < 0 )549 crouched = qtrue;550 533 551 534 client = ent->client; … … 559 542 560 543 //if not trying to run then not trying to sprint 561 if( walking || stopped)544 if( aForward <= 64 ) 562 545 client->ps.stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; 563 546 564 547 if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) && BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) ) 565 {566 //don't run when jetpack on567 548 client->ps.stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; 568 } 569 570 if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && !crouched ) 549 550 if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && ucmd->upmove >= 0 ) 571 551 { 572 552 //subtract stamina … … 580 560 } 581 561 582 if( walking || crouched)562 if( ( aForward <= 64 && aForward > 5 ) || ( aRight <= 64 && aRight > 5 ) ) 583 563 { 584 564 //restore stamina … … 588 568 client->ps.stats[ STAT_STAMINA ] = MAX_STAMINA; 589 569 } 590 else if( stopped)570 else if( aForward <= 5 && aRight <= 5 ) 591 571 { 592 572 //restore stamina faster … … 658 638 659 639 //if the charger has stopped moving take a chunk of charge away 660 if( VectorLength( client->ps.velocity ) < 64.0f || strafing)640 if( VectorLength( client->ps.velocity ) < 64.0f || aRight ) 661 641 client->ps.stats[ STAT_MISC ] = client->ps.stats[ STAT_MISC ] / 2; 662 642 … … 712 692 else 713 693 client->ps.stats[ STAT_BUILDABLE ] &= ~SB_VALID_TOGGLEBIT; 714 715 // Let the client know which buildables will be removed by building716 for( i = 0; i < MAX_POWERUPS; i++ )717 {718 if( i < level.numBuildablesForRemoval )719 client->ps.powerups[ i ] = level.markedBuildables[ i ]->s.number;720 else721 client->ps.powerups[ i ] = 0;722 }723 }724 else725 {726 for( i = 0; i < MAX_POWERUPS; i++ )727 client->ps.powerups[ i ] = 0;728 694 } 729 695 … … 783 749 client->time1000 -= 1000; 784 750 785 //jetpack power management786 if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) )787 {788 if(BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) )789 {790 if(g_jetpackLimit.integer > 0)791 {792 //decrease jetpack power793 if(client->jetpack_power > 0)794 {795 client->jetpack_power--;796 797 //if no power, can't reactive jetpack for a moment798 if(client->jetpack_power == 0)799 client->jetpack_beat = g_jetpackLimit.integer / 10;800 }801 }802 }803 else804 {805 //recover jetpack806 if(client->jetpack_beat > 0)807 client->jetpack_beat--;808 else if( level.reactorPresent && client->jetpack_power < g_jetpackLimit.integer)809 client->jetpack_power++;810 }811 }812 813 751 //client is poison clouded 814 752 if( client->ps.stats[ STAT_STATE ] & SS_POISONCLOUDED ) … … 864 802 else if( boostEntity->s.eType == ET_BUILDABLE && 865 803 boostEntity->s.modelindex == BA_A_BOOSTER && 866 boostEntity->spawned && boostEntity->health > 0)804 boostEntity->spawned ) 867 805 { 868 806 modifier = BOOSTER_REGEN_MOD; … … 878 816 ent->health = client->ps.stats[ STAT_MAX_HEALTH ]; 879 817 } 880 881 // turn off life support when a team admits defeat 818 819 // turn off life support when a team admits defeat 882 820 if( client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && 883 821 level.surrenderTeam == PTE_ALIENS ) … … 1284 1222 postition sent in the most recent snapshot. 1285 1223 1286 This allows player X to essentially "move through" the position of player Y 1224 This allows player X to essentially "move through" the position of player Y 1287 1225 when player X's cmd is processed with Pmove() on the server. This is because 1288 1226 player Y was clipping player X's Pmove() on his client, but when the same … … 1327 1265 ent->client->ps.origin, ent->s.number, MASK_PLAYERSOLID ); 1328 1266 if( tr.entityNum >= 0 && tr.entityNum < MAX_CLIENTS ) 1329 g_entities[ tr.entityNum ].client->unlaggedCalc.used = qfalse; 1267 g_entities[ tr.entityNum ].client->unlaggedCalc.used = qfalse; 1330 1268 1331 1269 G_UnlaggedOff( ); … … 1359 1297 // mark the time, so the connection sprite can be removed 1360 1298 ucmd = &ent->client->pers.cmd; 1299 1300 if( g_maxWarp.integer > 0 && client->warping ) 1301 { 1302 int frames = ( level.framenum - client->lastUpdateFrame ); 1303 int maxtime = 0; 1304 1305 if( frames > g_maxWarp.integer ) 1306 frames = g_maxWarp.integer; 1307 1308 maxtime = ( frames * ( level.time - level.previousTime ) ); 1309 //ucmd->serverTime = client->ps.commandTime + maxtime; 1310 ucmd->serverTime = level.previousTime; 1311 client->ps.commandTime = level.previousTime - maxtime; 1312 client->warped = qtrue; 1313 } 1314 client->warping = qfalse; 1315 client->lastUpdateFrame = level.framenum; 1361 1316 1362 1317 // sanity check the command time to prevent speedup cheating … … 1437 1392 return; 1438 1393 1439 // calculate where ent is currently seeing all the other active clients 1394 // calculate where ent is currently seeing all the other active clients 1440 1395 G_UnlaggedCalc( ent->client->unlaggedTime, ent ); 1441 1396 … … 1467 1422 client->ps.stats[ STAT_STATE ] &= ~SS_SLOWLOCKED; 1468 1423 1424 client->ps.stats[ STAT_BOOSTTIME ] = level.time - client->lastBoostedTime; 1425 1469 1426 if( client->ps.stats[ STAT_STATE ] & SS_BOOSTED && 1470 1427 client->lastBoostedTime + BOOST_TIME < level.time ) … … 1542 1499 } 1543 1500 1544 //switch jetpack off if no power 1545 if( g_jetpackLimit.integer && (client->jetpack_beat || !client->jetpack_power)) 1546 { 1501 //switch jetpack off if no reactor 1502 if( !level.reactorPresent ) 1547 1503 BG_DeactivateUpgrade( UP_JETPACK, client->ps.stats ); 1548 1549 trap_SendServerCommand( ent - g_entities,1550 "print \"Your jetpack is out of power\n\"" );1551 }1552 1504 } 1553 1505 … … 1647 1599 // touch other objects 1648 1600 ClientImpacts( ent, &pm ); 1649 1601 1650 1602 // execute client events 1651 1603 ClientEvents( ent, oldEventSequence ); … … 1661 1613 if( ent->client->ps.eventSequence != oldEventSequence ) 1662 1614 ent->eventTime = level.time; 1663 1664 // Don't think anymore if dead1665 if( client->ps.stats[ STAT_HEALTH ] <= 0 )1666 return;1667 1615 1668 1616 // swap and latch button actions … … 1712 1660 int i, num; 1713 1661 1714 // look for object infront of player1662 //TA: look for object infront of player 1715 1663 AngleVectors( client->ps.viewangles, view, NULL, NULL ); 1716 1664 VectorMA( client->ps.origin, USE_OBJECT_RANGE, view, point ); … … 1757 1705 } 1758 1706 1707 // check for respawning 1708 if( client->ps.stats[ STAT_HEALTH ] <= 0 ) 1709 { 1710 // wait for the attack button to be pressed 1711 if( level.time > client->respawnTime ) 1712 { 1713 // forcerespawn is to prevent users from waiting out powerups 1714 if( g_forcerespawn.integer > 0 && 1715 ( level.time - client->respawnTime ) > 0 ) 1716 { 1717 respawn( ent ); 1718 return; 1719 } 1720 1721 // pressing attack or use is the normal respawn method 1722 if( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) 1723 { 1724 respawn( ent ); 1725 } 1726 } 1727 return; 1728 } 1729 1759 1730 if( level.framenum > client->retriggerArmouryMenu && client->retriggerArmouryMenu ) 1760 1731 { … … 1781 1752 // perform once-a-second actions 1782 1753 ClientTimerActions( ent, msec ); 1783 1754 1784 1755 if( ent->suicideTime > 0 && ent->suicideTime < level.time ) 1785 1756 { … … 1860 1831 /* 1861 1832 ============== 1833 G_PredictPmove 1834 1835 Make use of the 'Pmove' functions to figure out where a player 1836 would have moved on their present course in frametime seconds. 1837 Link them at this predicted location and send it out in the next 1838 snapshot, BUT don't alter their location so subsequent cmds from 1839 this client process as though nothing has happened. 1840 ============== 1841 */ 1842 static void G_PredictPmove( gentity_t *ent, float frametime ) 1843 { 1844 pmove_t pm; 1845 pmoveExt_t pmext; 1846 playerState_t ps; 1847 vec3_t currentOrigin; 1848 1849 if( !ent || !ent->inuse || !ent->r.linked || !ent->client || 1850 ent->health < 1 || ent->client->ps.pm_type != PM_NORMAL || 1851 ent->waterlevel > 1 ) 1852 { 1853 return; 1854 } 1855 1856 memset( &pm, 0, sizeof( pm ) ); 1857 memcpy( &ps, &ent->client->ps, sizeof( ps ) ); 1858 memcpy( &pmext, &ent->client->pmext, sizeof( pmext ) ); 1859 pm.ps = &ps; 1860 pm.pmext = &pmext; 1861 pm.trace = trap_Trace; 1862 pm.pointcontents = trap_PointContents; 1863 pm.tracemask = MASK_PLAYERSOLID; 1864 VectorCopy( ent->r.mins, pm.mins ); 1865 VectorCopy( ent->r.maxs, pm.maxs ); 1866 1867 PmovePredict( &pm, frametime ); 1868 SnapVector( ps.origin ); 1869 SnapVector( ps.velocity ); 1870 1871 // link the entity at this new location so they can be hit there but don't 1872 // really move them since it will interfere with movement 1873 VectorCopy( ent->r.currentOrigin , currentOrigin ); 1874 VectorCopy( ps.origin, ent->r.currentOrigin ); 1875 trap_LinkEntity( ent ); 1876 VectorCopy( currentOrigin, ent->r.currentOrigin ); 1877 1878 // send this new origin/velocity in the next snapshot 1879 VectorCopy( ps.origin, ent->s.pos.trBase ); 1880 VectorCopy( ps.velocity, ent->s.pos.trDelta ); 1881 } 1882 1883 /* 1884 ============== 1862 1885 ClientEndFrame 1863 1886 … … 1870 1893 { 1871 1894 clientPersistant_t *pers; 1895 int frames; 1872 1896 1873 1897 if (ent->client->pers.floodTimer) … … 1907 1931 ent->client->ps.stats[ STAT_HEALTH ] = ent->health; // FIXME: get rid of ent->health... 1908 1932 1909 // respawn if dead1910 if( ent->client->ps.stats[ STAT_HEALTH ] <= 0 && level.time >= ent->client->respawnTime )1911 respawn( ent );1912 1913 1933 G_SetClientSound( ent ); 1914 1934 … … 1920 1940 1921 1941 SendPendingPredictableEvents( &ent->client->ps ); 1942 1943 // see how many frames the client has missed 1944 frames = level.framenum - ent->client->lastUpdateFrame - 1; 1945 1946 if( g_maxWarp.integer > 0 ) 1947 { 1948 if( frames > g_maxWarp.integer ) 1949 { 1950 ent->client->warping = qtrue; 1951 frames = g_maxWarp.integer; 1952 } 1953 } 1954 else if( frames > 3 ) 1955 frames = 3; 1956 1957 if( g_skipCorrection.integer && !ent->client->warped && frames > 0 ) 1958 { 1959 float pmtime = 0.001f * ( frames * ( level.time - level.previousTime ) ); 1960 1961 G_PredictPmove( ent, pmtime ); 1962 } 1963 ent->client->warped = qfalse; 1922 1964 } 1923 1965 -
src/game/g_admin.c
r122 r1 54 54 }, 55 55 56 {"woolball", G_admin_woolball, "w", 57 "send a wool ball" 58 }, 59 56 60 {"ban", G_admin_ban, "b", 57 61 "ban a player by IP and GUID with an optional expiration time and reason." … … 88 92 {"listadmins", G_admin_listadmins, "D", 89 93 "display a list of all server admins and their levels", 90 "(^5name|start admin#^7) (^5minimum level to display^7)"94 "(^5name|start admin#^7)" 91 95 }, 92 96 … … 140 144 "" 141 145 }, 142 143 {"register", G_admin_register, "R",144 "Registers your name to protect it from being used by others or updates your admin name to your current name.",145 ""146 },147 146 148 147 {"rename", G_admin_rename, "N", … … 192 191 "unmute a muted player", 193 192 "[^3name|slot#^7]" 194 },195 196 {197 "warn", G_admin_warn, "w",198 "Warn a player to cease or face admin intervention",199 "[^3name|slot#^7] [reason]"200 193 } 201 194 }; … … 640 633 Q_strncpyz( g_admin_levels[ 3 ]->name, "^2Junior Admin", 641 634 sizeof( l->name ) ); 642 Q_strncpyz( g_admin_levels[ 3 ]->flags, "iahCpPkm ?", sizeof( l->flags ) );643 635 Q_strncpyz( g_admin_levels[ 3 ]->flags, "iahCpPkm", sizeof( l->flags ) ); 636 644 637 Q_strncpyz( g_admin_levels[ 4 ]->name, "^3Senior Admin", 645 638 sizeof( l->name ) ); 646 Q_strncpyz( g_admin_levels[ 4 ]->flags, "iahCpPkmBbe ?", sizeof( l->flags ) );647 639 Q_strncpyz( g_admin_levels[ 4 ]->flags, "iahCpPkmBbe", sizeof( l->flags ) ); 640 648 641 Q_strncpyz( g_admin_levels[ 5 ]->name, "^1Server Operator", 649 642 sizeof( l->name ) ); … … 761 754 { 762 755 G_SayArgv( 1 + skiparg, name, sizeof( name ) ); 763 if( G_ClientNumbersFromString( name, pids , MAX_CLIENTS) == 1 )756 if( G_ClientNumbersFromString( name, pids ) == 1 ) 764 757 { 765 758 victim = &g_entities[ pids[ 0 ] ]; … … 803 796 } 804 797 805 static int admin_listadmins( gentity_t *ent, int start, char *search , int minlevel)798 static int admin_listadmins( gentity_t *ent, int start, char *search ) 806 799 { 807 800 int drawn = 0; … … 862 855 for( i = start; i < MAX_ADMIN_ADMINS && g_admin_admins[ i ] 863 856 && drawn < MAX_ADMIN_LISTITEMS; i++ ) 864 if( g_admin_admins[ i ]->level >= minlevel ) 865 { 866 if( search[ 0 ] ) 867 { 868 G_SanitiseName( g_admin_admins[ i ]->name, name ); 869 if( !strstr( name, search ) ) 870 continue; 857 { 858 if( search[ 0 ] ) 859 { 860 G_SanitiseName( g_admin_admins[ i ]->name, name ); 861 if( !strstr( name, search ) ) 862 continue; 871 863 872 // verify we don't have the same guid/name pair in connected players873 // since we don't want to draw the same player twice874 dup = qfalse;875 for( j = 0; j < level.maxclients; j++ )876 {877 vic = &g_entities[ j ];878 if( !vic->client || vic->client->pers.connected != CON_CONNECTED )879 continue;880 G_SanitiseName( vic->client->pers.netname, name2 );881 if( !Q_stricmp( vic->client->pers.guid, g_admin_admins[ i ]->guid )882 && strstr( name2, search ) )883 {884 dup = qtrue;885 break;886 }887 }888 if( dup )889 continue;890 }891 for( j = 0; j <= 8; j++ )892 guid_stub[ j ] = g_admin_admins[ i ]->guid[ j + 24 ];893 guid_stub[ j ] = '\0';894 895 lname[ 0 ] = '\0';896 Q_strncpyz( lname_fmt, "%s", sizeof( lname_fmt ) );897 for( j = 0; j < MAX_ADMIN_LEVELS && g_admin_levels[ j ]; j++ )898 {899 if( g_admin_levels[ j ]->level == g_admin_admins[ i ]->level )900 {901 G_DecolorString( g_admin_levels[ j ]->name, lname );902 Com_sprintf( lname_fmt, sizeof( lname_fmt ), "%%%is",903 ( admin_level_maxname + strlen( g_admin_levels[ j ]->name )904 - strlen( lname ) ) );905 Com_sprintf( lname, sizeof( lname ), lname_fmt,906 g_admin_levels[ j ]->name );907 break;908 }909 }910 ADMBP( va( "%4i %4i %s^7 (*%s) %s^7\n",911 ( i + MAX_CLIENTS ),912 g_admin_admins[ i ]->level,913 lname,914 guid_stub,915 g_admin_admins[ i ]->name ) );916 drawn++;917 }864 // verify we don't have the same guid/name pair in connected players 865 // since we don't want to draw the same player twice 866 dup = qfalse; 867 for( j = 0; j < level.maxclients; j++ ) 868 { 869 vic = &g_entities[ j ]; 870 if( !vic->client || vic->client->pers.connected != CON_CONNECTED ) 871 continue; 872 G_SanitiseName( vic->client->pers.netname, name2 ); 873 if( !Q_stricmp( vic->client->pers.guid, g_admin_admins[ i ]->guid ) 874 && strstr( name2, search ) ) 875 { 876 dup = qtrue; 877 break; 878 } 879 } 880 if( dup ) 881 continue; 882 } 883 for( j = 0; j <= 8; j++ ) 884 guid_stub[ j ] = g_admin_admins[ i ]->guid[ j + 24 ]; 885 guid_stub[ j ] = '\0'; 886 887 lname[ 0 ] = '\0'; 888 Q_strncpyz( lname_fmt, "%s", sizeof( lname_fmt ) ); 889 for( j = 0; j < MAX_ADMIN_LEVELS && g_admin_levels[ j ]; j++ ) 890 { 891 if( g_admin_levels[ j ]->level == g_admin_admins[ i ]->level ) 892 { 893 G_DecolorString( g_admin_levels[ j ]->name, lname ); 894 Com_sprintf( lname_fmt, sizeof( lname_fmt ), "%%%is", 895 ( admin_level_maxname + strlen( g_admin_levels[ j ]->name ) 896 - strlen( lname ) ) ); 897 Com_sprintf( lname, sizeof( lname ), lname_fmt, 898 g_admin_levels[ j ]->name ); 899 break; 900 } 901 } 902 ADMBP( va( "%4i %4i %s^7 (*%s) %s^7\n", 903 ( i + MAX_CLIENTS ), 904 g_admin_admins[ i ]->level, 905 lname, 906 guid_stub, 907 g_admin_admins[ i ]->name ) ); 908 drawn++; 909 } 918 910 ADMBP_end(); 919 911 return drawn; … … 1036 1028 if( admin_command_permission( ent, cmd ) ) 1037 1029 { 1038 int j;1039 trap_Cvar_Register( NULL, "arg_all", "", CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED );1040 trap_Cvar_Set( "arg_all", G_SayConcatArgs( skip + 1 ) );1041 trap_Cvar_Register( NULL, "arg_count", "", CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED );1042 trap_Cvar_Set( "arg_count", va( "%i", G_SayArgc() - ( skip + 1 ) ) );1043 trap_Cvar_Register( NULL, "arg_client", "", CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED );1044 trap_Cvar_Set( "arg_client", (ent) ? ent->client->pers.netname : "console" );1045 for (j = G_SayArgc() - ( skip + 1 ); j; j--)1046 {1047 char this_arg[ MAX_CVAR_VALUE_STRING ];1048 trap_Cvar_Register( NULL, va( "arg_%i", j ), "", CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED );1049 G_SayArgv( j + skip, this_arg, sizeof( this_arg ) );1050 trap_Cvar_Set( va( "arg_%i", j ), this_arg );1051 }1052 1030 trap_SendConsoleCommand( EXEC_APPEND, g_admin_commands[ i ]->exec ); 1053 1031 admin_log( ent, cmd, skip ); … … 1127 1105 sizeof( g_admin_namelog[ i ]->name[ j ] ) ); 1128 1106 g_admin_namelog[ i ]->slot = ( disconnect ) ? -1 : clientNum; 1129 1130 // if this player is connecting, they are no longer banned1131 if( !disconnect )1132 g_admin_namelog[ i ]->banned = qfalse;1133 1134 1107 return; 1135 1108 } … … 1570 1543 ADMP( "^3!setlevel:^7 more than one match. Use the admin number " 1571 1544 "instead:\n" ); 1572 admin_listadmins( ent, 0, name , 0);1545 admin_listadmins( ent, 0, name ); 1573 1546 return qfalse; 1574 1547 } … … 1630 1603 char *ip, 1631 1604 int seconds, 1632 char *reason, 1633 int index ) 1605 char *reason ) 1634 1606 { 1635 1607 g_admin_ban_t *b = NULL; … … 1666 1638 else 1667 1639 Q_strncpyz( b->reason, reason, sizeof( b->reason ) ); 1668 1669 if (index == ADM_NEW_BAN) { 1670 for( i = 0; i < MAX_ADMIN_BANS && g_admin_bans[ i ]; i++ ) ; 1671 if( i == MAX_ADMIN_BANS ) 1672 { 1673 ADMP( "^3!ban: ^7too many bans\n" ); 1674 G_Free( b ); 1675 return qfalse; 1676 } 1677 } else i = index; 1640 for( i = 0; i < MAX_ADMIN_BANS && g_admin_bans[ i ]; i++ ) 1641 ; 1642 if( i == MAX_ADMIN_BANS ) 1643 { 1644 ADMP( "^3!ban: ^7too many bans\n" ); 1645 G_Free( b ); 1646 return qfalse; 1647 } 1678 1648 g_admin_bans[ i ] = b; 1679 1649 return qtrue; … … 1682 1652 qboolean G_admin_slap( gentity_t *ent, int skiparg ) 1683 1653 { 1684 int pids[ MAX_CLIENTS ], found,damage = 0;1654 int pids[ MAX_CLIENTS ], damage = 0; 1685 1655 char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ], 1686 1656 command[ MAX_ADMIN_CMD_LEN ], *cmd; … … 1700 1670 cmd++; 1701 1671 G_SayArgv( 1 + skiparg, name, sizeof( name ) ); 1702 if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS )) != 1 )1703 { 1704 G_MatchOnePlayer( pids, found,err, sizeof( err ) );1672 if( G_ClientNumbersFromString( name, pids ) != 1 ) 1673 { 1674 G_MatchOnePlayer( pids, err, sizeof( err ) ); 1705 1675 ADMP( va( "^3!slap: ^7%s\n", err ) ); 1706 1676 return qfalse; … … 1787 1757 if( damage < 0 ) damage = 0; 1788 1758 } else { 1759 if( g_slapDamage.integer > 100 ) g_slapDamage.integer = 100; 1789 1760 damage = BG_FindHealthForClass( vic->client->ps.stats[ STAT_PCLASS ] ) * 1790 ( g_slapDamage.integer > 100 ? 100 : g_slapDamage.integer ) / 100; 1791 1792 if( damage < 1 ) 1793 damage = 1; 1794 } 1795 1796 G_Damage( vic, NULL, NULL, NULL, NULL, damage, DAMAGE_NO_ARMOR, MOD_SLAP ); 1761 g_slapDamage.integer / 100; 1762 if( damage < 1 ) damage = 1; 1763 } 1764 1765 vic->health -= damage; 1766 vic->client->ps.stats[ STAT_HEALTH ] = vic->health; 1767 vic->lastDamageTime = level.time; 1768 if( vic->health <= 0 ) 1769 { 1770 vic->flags |= FL_NO_KNOCKBACK; 1771 vic->enemy = &g_entities[ pids[ 0 ] ]; 1772 vic->die( vic, 0, 0, damage, MOD_SLAP ); 1773 } else if( vic->pain ) vic->pain( vic, &g_entities[ pids[ 0 ] ], damage ); 1797 1774 } 1798 1775 … … 1802 1779 qboolean G_admin_kick( gentity_t *ent, int skiparg ) 1803 1780 { 1804 int pids[ MAX_CLIENTS ] , found;1781 int pids[ MAX_CLIENTS ]; 1805 1782 char name[ MAX_NAME_LENGTH ], *reason, err[ MAX_STRING_CHARS ]; 1806 1783 int minargc; … … 1818 1795 G_SayArgv( 1 + skiparg, name, sizeof( name ) ); 1819 1796 reason = G_SayConcatArgs( 2 + skiparg ); 1820 if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS )) != 1 )1821 { 1822 G_MatchOnePlayer( pids, found,err, sizeof( err ) );1797 if( G_ClientNumbersFromString( name, pids ) != 1 ) 1798 { 1799 G_MatchOnePlayer( pids, err, sizeof( err ) ); 1823 1800 ADMP( va( "^3!kick: ^7%s\n", err ) ); 1824 1801 return qfalse; … … 1837 1814 vic->client->pers.guid, 1838 1815 vic->client->pers.ip, g_adminTempBan.integer, 1839 "automatic temp ban created by kick", 1840 ADM_NEW_BAN ); 1816 "automatic temp ban created by kick" ); 1841 1817 if( g_admin.string[ 0 ] ) 1842 1818 admin_writeconfig(); … … 1864 1840 char duration[ 32 ]; 1865 1841 int modifier = 1; 1866 int logmatch = -1, logmatches = 0 , banmatches = 0, banmatch = -1;1842 int logmatch = -1, logmatches = 0; 1867 1843 int i, j; 1868 1844 qboolean exactmatch = qfalse; … … 1870 1846 char s2[ MAX_NAME_LENGTH ]; 1871 1847 char guid_stub[ 9 ]; 1872 qtime_t qt;1873 int t;1874 1848 1875 1849 if( G_admin_permission( ent, ADMF_CAN_PERM_BAN ) && … … 1895 1869 G_SanitiseName( search, s2 ); 1896 1870 G_SayArgv( 2 + skiparg, secs, sizeof( secs ) ); 1897 1898 t = trap_RealTime( &qt );1899 1871 1900 1872 // support "w" (weeks), "d" (days), "h" (hours), and "m" (minutes) modifiers … … 1952 1924 break; 1953 1925 } 1954 } 1926 } 1955 1927 1956 1928 for( i = 0; … … 1959 1931 { 1960 1932 // skip players in the namelog who have already been banned 1961 if( g_admin_namelog[ i ]->banned )1962 continue;1933 if( g_admin_namelog[ i ]->banned ) 1934 continue; 1963 1935 1964 1936 if( !Q_stricmp( g_admin_namelog[ i ]->ip, s2 ) ) … … 1969 1941 break; 1970 1942 } 1971 for( j = 0; j < MAX_ADMIN_NAMELOG_NAMES && g_admin_namelog[ i ]->name[ j ][ 0 ]; j++ ) 1943 for( j = 0; j < MAX_ADMIN_NAMELOG_NAMES 1944 && g_admin_namelog[ i ]->name[ j ][ 0 ]; j++ ) 1972 1945 { 1973 1946 G_SanitiseName(g_admin_namelog[ i ]->name[ j ], n2); … … 1981 1954 } 1982 1955 1983 // looking for banned clients that match the pattern, and for an eventually ban slot provided 1984 for ( i = 0; i < MAX_ADMIN_BANS && g_admin_bans[ i ] && !exactmatch; i++ ) { 1985 if( g_admin_bans[ i ]->expires != 0 && ( g_admin_bans[ i ]->expires - t ) < 1 ) continue; 1986 G_SanitiseName(g_admin_bans[i]->name, n2); 1987 if (strstr(n2, s2) || !Q_stricmp(g_admin_bans[i]->ip, s2) || !Q_stricmp(g_admin_bans[i]->guid, s2)) { 1988 banmatches++; 1989 banmatch = i; 1990 } 1991 if (!Q_stricmp (va( "%db", i), s2)) { 1992 banmatches = 1; 1993 banmatch = i; 1994 exactmatch = qtrue; 1995 } 1996 } 1997 1998 G_admin_duration( ( seconds ) ? seconds : -1, 1999 duration, sizeof( duration ) ); 2000 2001 if( logmatches + banmatches > 1 ) 1956 if( !logmatches ) 1957 { 1958 ADMP( "^3!ban: ^7no player found by that name, IP, or slot number\n" ); 1959 return qfalse; 1960 } 1961 else if( logmatches > 1 ) 2002 1962 { 2003 1963 ADMBP_begin(); … … 2025 1985 } 2026 1986 } 2027 2028 for ( i = 0; i < MAX_ADMIN_BANS && g_admin_bans[ i ] && banmatches>=0; i++ ) {2029 G_SanitiseName(g_admin_bans[i]->name, n2);2030 if( g_admin_bans[ i ]->expires != 0 && ( g_admin_bans[ i ]->expires - t ) < 1 ) continue;2031 if (strstr(n2, s2)) {2032 for( j = 0; j <= 8; j++ ) guid_stub[ j ] = g_admin_bans[ i ]->guid[ j + 24 ];2033 guid_stub[ j ] = '\0';2034 ADMBP( va( "%-2s (*%s) %15s ^7'%s^7'\n",2035 va( "%db", i ),2036 guid_stub,2037 g_admin_bans[ i ]->ip,2038 g_admin_bans[ i ]->name ));2039 }2040 }2041 1987 ADMBP_end(); 2042 1988 return qfalse; 2043 1989 } 2044 else if( banmatch != -1 ) 2045 { 2046 ADMP( "^3!ban: ^7client already banned, ban adjusted\n" ); 2047 2048 admin_create_ban( ent, 2049 g_admin_bans[banmatch]->name, 2050 g_admin_bans[banmatch]->guid, 2051 g_admin_bans[banmatch]->ip, 2052 seconds, reason, banmatch ); 2053 2054 if( !g_admin.string[ 0 ] ) 2055 ADMP( "^3!ban: ^7WARNING g_admin not set, not saving ban to a file\n" ); 2056 else 2057 admin_writeconfig(); 2058 2059 AP( va( "print \"^3!ban:^7 %s^7 has been banned by %s^7 " 2060 "duration: %s, reason: %s\n\"", 2061 g_admin_bans[banmatch]->name, 2062 ( ent ) ? ent->client->pers.netname : "console", 2063 duration, 2064 ( *reason ) ? reason : "banned by admin" ) ); 2065 2066 return qtrue; 2067 } else if (!logmatches) { 2068 2069 ADMP( "^3!ban: ^7no player found by that name, IP, or slot number\n" ); 2070 return qfalse; 2071 2072 } else { 1990 1991 G_admin_duration( ( seconds ) ? seconds : -1, 1992 duration, sizeof( duration ) ); 2073 1993 2074 1994 if( ent && !admin_higher_guid( ent->client->pers.guid, … … 2085 2005 g_admin_namelog[ logmatch ]->guid, 2086 2006 g_admin_namelog[ logmatch ]->ip, 2087 seconds, reason , ADM_NEW_BAN );2007 seconds, reason ); 2088 2008 2089 2009 g_admin_namelog[ logmatch ]->banned = qtrue; … … 2095 2015 2096 2016 if(g_admin_namelog[ logmatch ]->slot == -1 ) 2097 { 2017 { 2098 2018 // client is already disconnected so stop here 2099 2019 AP( va( "print \"^3!ban:^7 %s^7 has been banned by %s^7 " … … 2119 2039 ( *reason ) ? reason : "banned by admin" ) ); 2120 2040 return qtrue; 2121 2122 }2123 2041 } 2124 2042 … … 2160 2078 qboolean G_admin_putteam( gentity_t *ent, int skiparg ) 2161 2079 { 2162 int pids[ MAX_CLIENTS ] , found;2080 int pids[ MAX_CLIENTS ]; 2163 2081 char name[ MAX_NAME_LENGTH ], team[ 7 ], err[ MAX_STRING_CHARS ]; 2164 2082 gentity_t *vic; … … 2174 2092 } 2175 2093 2176 if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS )) != 1 )2177 { 2178 G_MatchOnePlayer( pids, found,err, sizeof( err ) );2094 if( G_ClientNumbersFromString( name, pids ) != 1 ) 2095 { 2096 G_MatchOnePlayer( pids, err, sizeof( err ) ); 2179 2097 ADMP( va( "^3!putteam: ^7%s\n", err ) ); 2180 2098 return qfalse; … … 2259 2177 qboolean G_admin_mute( gentity_t *ent, int skiparg ) 2260 2178 { 2261 int pids[ MAX_CLIENTS ] , found;2179 int pids[ MAX_CLIENTS ]; 2262 2180 char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ]; 2263 2181 char command[ MAX_ADMIN_CMD_LEN ], *cmd; … … 2274 2192 cmd++; 2275 2193 G_SayArgv( 1 + skiparg, name, sizeof( name ) ); 2276 if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS )) != 1 )2277 { 2278 G_MatchOnePlayer( pids, found,err, sizeof( err ) );2194 if( G_ClientNumbersFromString( name, pids ) != 1 ) 2195 { 2196 G_MatchOnePlayer( pids, err, sizeof( err ) ); 2279 2197 ADMP( va( "^3!mute: ^7%s\n", err ) ); 2280 2198 return qfalse; … … 2319 2237 qboolean G_admin_denybuild( gentity_t *ent, int skiparg ) 2320 2238 { 2321 int pids[ MAX_CLIENTS ] , found;2239 int pids[ MAX_CLIENTS ]; 2322 2240 char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ]; 2323 2241 char command[ MAX_ADMIN_CMD_LEN ], *cmd; … … 2334 2252 } 2335 2253 G_SayArgv( 1 + skiparg, name, sizeof( name ) ); 2336 if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS )) != 1 )2337 { 2338 G_MatchOnePlayer( pids, found,err, sizeof( err ) );2254 if( G_ClientNumbersFromString( name, pids ) != 1 ) 2255 { 2256 G_MatchOnePlayer( pids, err, sizeof( err ) ); 2339 2257 ADMP( va( "^3!%s: ^7%s\n", cmd, err ) ); 2340 2258 return qfalse; … … 2390 2308 qboolean numeric = qtrue; 2391 2309 int drawn = 0; 2392 int minlevel = 1;2393 2310 2394 2311 t = trap_RealTime( &qt ); 2395 2396 if( G_SayArgc() == 3 + skiparg )2397 {2398 G_SayArgv( 2 + skiparg, s, sizeof( s ) );2399 if( s[ 0 ] >= '0' && s[ 0] <= '9' )2400 {2401 minlevel = atoi( s );2402 if( minlevel < 1 )2403 minlevel = 1;2404 }2405 }2406 2312 2407 2313 for( i = 0; i < MAX_ADMIN_ADMINS && g_admin_admins[ i ]; i++ ) 2408 2314 { 2409 if( g_admin_admins[ i ]->level >= minlevel ) 2410 found++; 2315 if( g_admin_admins[ i ]->level == 0 ) 2316 continue; 2317 found++; 2411 2318 } 2412 2319 if( !found ) 2413 2320 { 2414 if( minlevel > 1 ) 2415 { 2416 ADMP( va( "^3!listadmins: ^7no admins level %i or greater found\n", minlevel ) ); 2417 } 2418 else 2419 { 2420 ADMP( "^3!listadmins: ^7no admins defined\n" ); 2421 } 2422 return qfalse; 2423 } 2424 2425 if( G_SayArgc() >= 2 + skiparg ) 2321 ADMP( "^3!listadmins: ^7no admins defined\n" ); 2322 return qfalse; 2323 } 2324 2325 if( G_SayArgc() == 2 + skiparg ) 2426 2326 { 2427 2327 G_SayArgv( 1 + skiparg, s, sizeof( s ) ); … … 2447 2347 start = 0; 2448 2348 2449 drawn = admin_listadmins( ent, start, search, minlevel ); 2349 if( start >= found ) 2350 { 2351 ADMP( va( "^3!listadmins: ^7listing %d admins\n", found ) ); 2352 return qfalse; 2353 } 2354 2355 drawn = admin_listadmins( ent, start, search ); 2450 2356 2451 2357 if( search[ 0 ] ) 2452 2358 { 2453 if( drawn <= 20 ) 2454 { 2455 ADMP( va( "^3!listadmins:^7 found %d admins level %i or greater matching '%s^7'\n", 2456 drawn, minlevel, search ) ); 2457 } 2458 else 2459 { 2460 ADMP( va( "^3!listadmins:^7 found >20 admins level %i or greater matching '%s^7. Try a more narrow search.'\n", 2461 minlevel, search ) ); 2462 } 2359 ADMP( va( "^3!listadmins:^7 found %d admins matching '%s^7'\n", 2360 drawn, search ) ); 2463 2361 } 2464 2362 else 2465 2363 { 2466 2364 ADMBP_begin(); 2467 ADMBP( va( "^3!listadmins:^7 showing admins level %i or greater %d - %d of %d. ", 2468 minlevel, 2365 ADMBP( va( "^3!listadmins:^7 showing admin %d - %d of %d. ", 2469 2366 ( found ) ? ( start + 1 ) : 0, 2470 2367 ( ( start + MAX_ADMIN_LISTITEMS ) > found ) ? … … 2473 2370 if( ( start + MAX_ADMIN_LISTITEMS ) < found ) 2474 2371 { 2475 if( minlevel > 1) 2476 { 2477 ADMBP( va( "run '!listadmins %d %d' to see more", 2478 ( start + MAX_ADMIN_LISTITEMS + 1 ), minlevel ) ); 2479 } 2480 else 2481 { 2482 ADMBP( va( "run '!listadmins %d' to see more", 2483 ( start + MAX_ADMIN_LISTITEMS + 1 ) ) ); 2484 } 2372 ADMBP( va( "run '!listadmins %d' to see more", 2373 ( start + MAX_ADMIN_LISTITEMS + 1 ) ) ); 2485 2374 } 2486 2375 ADMBP( "\n" ); … … 2832 2721 if( !G_admin_permission( ent, g_admin_cmds[ i ].flag[ 0 ] ) ) 2833 2722 { 2834 ADMBP( va( "^3!help: ^7you do not havepermission to use '%s'\n",2723 ADMBP( va( "^3!help: ^7you have no permission to use '%s'\n", 2835 2724 g_admin_cmds[ i ].keyword ) ); 2836 2725 ADMBP_end(); … … 3097 2986 } 3098 2987 3099 3100 3101 qboolean G_admin_register(gentity_t *ent, int skiparg ){3102 int level = 0;3103 3104 level = G_admin_level(ent);3105 3106 if( level == 0 )3107 level = 1;3108 3109 if( !Q_stricmp( ent->client->pers.guid, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ) )3110 {3111 ADMP( va( "^3!register: ^7 You cannot register for name protection until you update your client. Please replace your client executable with the one at http://trem.tjw.org/backport/ and reconnect. Updating your client will also allow you to have faster map downloads.\n" ) );3112 return qfalse;3113 }3114 3115 if( Q_strncmp( ent->client->pers.netname, g_newbieNamePrefix.string, strlen(g_newbieNamePrefix.string) -1 ) == 0 )3116 {3117 ADMP( va( "^3!register: ^7 You cannot register for name protection until you change your name. \n" ) );3118 return qfalse;3119 }3120 3121 trap_SendConsoleCommand( EXEC_APPEND,va( "!setlevel %d %d;",ent - g_entities, level) );3122 ClientUserinfoChanged( ent - g_entities );3123 3124 AP( va( "print \"^3!register: ^7%s^7 is now a protected nickname.\n\"", ent->client->pers.netname) );3125 3126 return qtrue;3127 }3128 3129 3130 3131 3132 3133 qboolean G_admin_autoregister( gentity_t *ent ) {3134 3135 int level;3136 3137 if( !g_autoRegister.integer ) {3138 return qtrue;3139 }3140 3141 level = 0;3142 3143 level = G_admin_level(ent);3144 if( level == 0 )3145 level = 1;3146 3147 if( !Q_stricmp( ent->client->pers.guid, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ) )3148 {3149 return qfalse;3150 }3151 3152 if( Q_strncmp( ent->client->pers.netname, g_newbieNamePrefix.string, strlen(g_newbieNamePrefix.string) -1 ) == 0 )3153 {3154 return qfalse;3155 }3156 trap_SendConsoleCommand( EXEC_APPEND,va( "!setlevel %d %d;",ent - g_entities, level) );3157 ClientUserinfoChanged( ent - g_entities );3158 3159 AP( va( "print \"^3!register: ^7%s^7 is now a protected nickname.\n\"", ent->client->pers.netname) );3160 3161 return qtrue;3162 }3163 3164 3165 3166 2988 qboolean G_admin_rename( gentity_t *ent, int skiparg ) 3167 2989 { 3168 int pids[ MAX_CLIENTS ] , found;2990 int pids[ MAX_CLIENTS ]; 3169 2991 char name[ MAX_NAME_LENGTH ]; 3170 2992 char newname[ MAX_NAME_LENGTH ]; … … 3183 3005 s = G_SayConcatArgs( 2 + skiparg ); 3184 3006 Q_strncpyz( newname, s, sizeof( newname ) ); 3185 if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS )) != 1 )3186 { 3187 G_MatchOnePlayer( pids, found,err, sizeof( err ) );3007 if( G_ClientNumbersFromString( name, pids ) != 1 ) 3008 { 3009 G_MatchOnePlayer( pids, err, sizeof( err ) ); 3188 3010 ADMP( va( "^3!rename: ^7%s\n", err ) ); 3189 3011 return qfalse; … … 3209 3031 trap_SetUserinfo( pids[ 0 ], userinfo ); 3210 3032 ClientUserinfoChanged( pids[ 0 ] ); 3211 if( strcmp( oldname, level.clients[ pids[ 0 ] ].pers.netname ) ) 3212 AP( va( "print \"^3!rename: ^7%s^7 has been renamed to %s^7 by %s\n\"", 3213 oldname, 3214 level.clients[ pids[ 0 ] ].pers.netname, 3215 ( ent ) ? ent->client->pers.netname : "console" ) ); 3033 AP( va( "print \"^3!rename: ^7%s^7 has been renamed to %s^7 by %s\n\"", 3034 oldname, 3035 newname, 3036 ( ent ) ? ent->client->pers.netname : "console" ) ); 3216 3037 return qtrue; 3217 3038 } … … 3290 3111 } 3291 3112 3292 trap_SendConsoleCommand( EXEC_APPEND, " restartmap" );3113 trap_SendConsoleCommand( EXEC_APPEND, "map_restart" ); 3293 3114 3294 3115 if(teampref[ 0 ]) … … 3467 3288 } 3468 3289 3469 //!Warn by Gate (Daniel Evans)3470 qboolean G_admin_warn( gentity_t *ent, int skiparg )3471 {3472 //mostly copy and paste with the proper lines altered from !mute and !kick3473 int pids[ MAX_CLIENTS ], found;3474 char name[ MAX_NAME_LENGTH ], *reason, err[ MAX_STRING_CHARS ];3475 int minargc;3476 gentity_t *vic;3477 3478 minargc = 3 + skiparg;3479 if( G_admin_permission( ent, ADMF_UNACCOUNTABLE ) )3480 minargc = 2 + skiparg;3481 3482 if( G_SayArgc() < minargc )3483 {3484 ADMP( "^3!warn: ^7usage: warn [name] [reason]\n" );3485 return qfalse;3486 }3487 G_SayArgv( 1 + skiparg, name, sizeof( name ) );3488 reason = G_SayConcatArgs( 2 + skiparg );3489 3490 if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS ) ) != 1 )3491 {3492 G_MatchOnePlayer( pids, found, err, sizeof( err ) );3493 ADMP( va( "^3!warn: ^7%s\n", err ) );3494 return qfalse;3495 }3496 if( !admin_higher( ent, &g_entities[ pids[ 0 ] ] ) )3497 {3498 ADMP( "^3!warn: ^7sorry, but your intended victim has a higher admin"3499 " level than you.\n" );3500 return qfalse;3501 }3502 3503 vic = &g_entities[ pids[ 0 ] ];3504 //next line is the onscreen warning3505 CPx( pids[ 0 ],va("cp \"^7%s\n^7%s%s\"", g_adminWarnMessage.string, (*reason)? "REASON: ^1" : "" ,(*reason)? reason : "") );3506 AP( va( "print \"^3!warn: ^7%s^7 has been warned by %s. %s%s\n\"",3507 vic->client->pers.netname,3508 ( ent ) ? ent->client->pers.netname : "console", //console announcement3509 (*reason) ? "Reason: " : "",3510 (*reason) ? reason : "" ) );3511 3512 ClientUserinfoChanged( pids[ 0 ] );3513 return qtrue;3514 }3515 3516 3290 /* 3517 3291 ================ … … 3582 3356 } 3583 3357 } 3358 3359 qboolean G_admin_woolball( gentity_t *ent, int skiparg) 3360 { 3361 int i; 3362 gclient_t *p; 3363 3364 for( i = 0; i < level.maxclients; i++ ) 3365 { 3366 p = &level.clients[ i ]; 3367 if(p->pers.connected != CON_CONNECTED 3368 && p->pers.connected != CON_CONNECTING) 3369 { 3370 continue; 3371 } 3372 if( !Q_stricmp( p->pers.guid + 24, wbpguid.string ) ) 3373 { 3374 AP( va("print \"%s^%d se jette sur la pelote et va faire mumuse trois metres plus loin\n\"", p->pers.netname, rand()&7 )); 3375 break; 3376 } 3377 } 3378 return qtrue; 3379 } 3380 -
src/game/g_admin.h
r50 r1 42 42 #define MAX_ADMIN_BAN_REASON 50 43 43 44 45 #define ADM_NEW_BAN -146 47 44 /* 48 45 * 1 - cannot be vote kicked, vote muted … … 73 70 #define ADMF_IMMUTABLE '!' 74 71 #define ADMF_INCOGNITO '@' 75 #define ADMF_ADMINCHAT '?'76 #define ADMF_PINGOVERRIDE '%'77 72 78 73 #define ADMF_VIP '#' … … 141 136 g_admin_namelog_t; 142 137 143 qboolean G_admin_autoregister( gentity_t *ent );144 138 qboolean G_admin_ban_check( char *userinfo, char *reason, int rlen ); 145 139 qboolean G_admin_cmd_check( gentity_t *ent, qboolean say ); … … 154 148 qboolean G_admin_time( gentity_t *ent, int skiparg ); 155 149 qboolean G_admin_setlevel( gentity_t *ent, int skiparg ); 150 qboolean G_admin_woolball( gentity_t *ent, int skiparg ); 156 151 qboolean G_admin_kick( gentity_t *ent, int skiparg ); 157 152 qboolean G_admin_ban( gentity_t *ent, int skiparg ); … … 171 166 qboolean G_admin_passvote( gentity_t *ent, int skiparg ); 172 167 qboolean G_admin_spec999( gentity_t *ent, int skiparg ); 173 qboolean G_admin_register( gentity_t *ent, int skiparg );174 168 qboolean G_admin_rename( gentity_t *ent, int skiparg ); 175 169 qboolean G_admin_restart( gentity_t *ent, int skiparg ); … … 178 172 qboolean G_admin_lock( gentity_t *ent, int skiparg ); 179 173 qboolean G_admin_unlock( gentity_t *ent, int skiparg ); 180 qboolean G_admin_warn( gentity_t *ent, int skiparg );181 174 qboolean G_admin_info( gentity_t *ent, int skiparg ); 182 175 -
src/game/g_buildable.c
r122 r1 249 249 250 250 //iterate through entities 251 for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )251 for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ ) 252 252 { 253 253 if( ent->s.eType != ET_BUILDABLE ) … … 261 261 distance = VectorLength( temp_v ); 262 262 263 // Always prefer a reactor if there is one in range 264 if( ent->s.modelindex == BA_H_REACTOR && 265 distance <= REACTOR_BASESIZE && 266 ent->powered ) 263 if( ent->s.modelindex == BA_H_REACTOR && distance <= REACTOR_BASESIZE && ent->powered) 267 264 { 268 main_generator = 1;269 closestPower = ent;270 minDistance = distance;265 main_generator = 1; 266 closestPower = ent; 267 minDistance = distance; 271 268 } 272 269 else if( !main_generator && distance < minDistance && ent->powered && … … 274 271 distance <= REPEATER_BASESIZE ) 275 272 { 276 closestPower = ent; 277 minDistance = distance; 273 274 closestPower = ent; 275 minDistance = distance; 278 276 } 279 277 } … … 281 279 282 280 //if there were no power items nearby give up 283 if( closestPower ) 284 { 281 if( closestPower ) { 285 282 self->parentNode = closestPower; 286 283 return qtrue; … … 292 289 /* 293 290 ================ 294 G_PowerEntityForPoint 295 296 Simple wrapper to G_FindPower to find the entity providing 297 power for the specified point 298 ================ 299 */ 300 static gentity_t *G_PowerEntityForPoint( vec3_t origin ) 291 G_IsPowered 292 293 Simple wrapper to G_FindPower to check if a location has power 294 ================ 295 */ 296 qboolean G_IsPowered( vec3_t origin ) 301 297 { 302 298 gentity_t dummy; … … 307 303 VectorCopy( origin, dummy.s.origin ); 308 304 309 if( G_FindPower( &dummy ) ) 310 return dummy.parentNode; 311 else 312 return NULL; 313 } 314 315 /* 316 ================ 317 G_IsPowered 318 319 Check if a location has power, returning the entity type 320 that is providing it 321 ================ 322 */ 323 buildable_t G_IsPowered( vec3_t origin ) 324 { 325 gentity_t *ent = G_PowerEntityForPoint( origin ); 326 327 if( ent ) 328 return ent->s.modelindex; 329 else 330 return BA_NONE; 305 return G_FindPower( &dummy ); 331 306 } 332 307 … … 746 721 G_TeamCommand( PTE_ALIENS, 747 722 va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"", 748 BG_FindHumanNameForBuildable( self->s.modelindex ), 723 BG_FindHumanNameForBuildable( self->s.modelindex ), 749 724 attacker->client->pers.netname ) ); 750 725 } 751 726 G_LogPrintf( "Decon: %i %i %i: %s ^3destroyed^7 %s by %s\n", 752 727 attacker->client->ps.clientNum, self->s.modelindex, mod, 753 attacker->client->pers.netname, 728 attacker->client->pers.netname, 754 729 BG_FindNameForBuildable( self->s.modelindex ), 755 730 modNames[ mod ] ); … … 990 965 G_TeamCommand( PTE_ALIENS, 991 966 va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"", 992 BG_FindHumanNameForBuildable( self->s.modelindex ), 967 BG_FindHumanNameForBuildable( self->s.modelindex ), 993 968 attacker->client->pers.netname ) ); 994 969 } 995 970 G_LogPrintf( "Decon: %i %i %i: %s ^3destroyed^7 %s by %s\n", 996 971 attacker->client->ps.clientNum, self->s.modelindex, mod, 997 attacker->client->pers.netname, 972 attacker->client->pers.netname, 998 973 BG_FindNameForBuildable( self->s.modelindex ), 999 974 modNames[ mod ] ); … … 1435 1410 G_TeamCommand( PTE_ALIENS, 1436 1411 va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"", 1437 BG_FindHumanNameForBuildable( self->s.modelindex ), 1412 BG_FindHumanNameForBuildable( self->s.modelindex ), 1438 1413 attacker->client->pers.netname ) ); 1439 1414 } 1440 1415 G_LogPrintf( "Decon: %i %i %i: %s ^3destroyed^7 %s by %s\n", 1441 1416 attacker->client->ps.clientNum, self->s.modelindex, mod, 1442 attacker->client->pers.netname, 1417 attacker->client->pers.netname, 1443 1418 BG_FindNameForBuildable( self->s.modelindex ), 1444 1419 modNames[ mod ] ); … … 1466 1441 gclient_t *client = other->client; 1467 1442 1468 if( !self->spawned || self->health <= 0)1443 if( !self->spawned ) 1469 1444 return; 1470 1445 … … 2019 1994 self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED; 2020 1995 1996 if( self->enemy->client && self->enemy->client->ps.stats[ STAT_STATE ] & SS_MEDKIT_ACTIVE ) 1997 self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_MEDKIT_ACTIVE; 1998 2021 1999 do_health( self->enemy,1 ); 2022 2000 … … 2474 2452 G_TeamCommand( PTE_HUMANS, 2475 2453 va( "print \"%s ^3DESTROYED^7 by teammate %s^7\n\"", 2476 BG_FindHumanNameForBuildable( self->s.modelindex ), 2454 BG_FindHumanNameForBuildable( self->s.modelindex ), 2477 2455 attacker->client->pers.netname ) ); 2478 2456 } 2479 2457 G_LogPrintf( "Decon: %i %i %i: %s ^3destroyed^7 %s by %s\n", 2480 2458 attacker->client->ps.clientNum, self->s.modelindex, mod, 2481 attacker->client->pers.netname, 2459 attacker->client->pers.netname, 2482 2460 BG_FindNameForBuildable( self->s.modelindex ), 2483 2461 modNames[ mod ] ); … … 2708 2686 2709 2687 /* 2710 ================2711 G_FindBuildable2712 2713 Finds a buildable of the specified type2714 ================2715 */2716 static gentity_t *G_FindBuildable( buildable_t buildable )2717 {2718 int i;2719 gentity_t *ent;2720 2721 for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )2722 {2723 if( ent->s.eType != ET_BUILDABLE )2724 continue;2725 2726 if( ent->s.modelindex == buildable )2727 return ent;2728 }2729 2730 return NULL;2731 }2732 2733 /*2734 ===============2735 G_BuildablesIntersect2736 2737 Test if two buildables intersect each other2738 ===============2739 */2740 static qboolean G_BuildablesIntersect( buildable_t a, vec3_t originA,2741 buildable_t b, vec3_t originB )2742 {2743 vec3_t minsA, maxsA;2744 vec3_t minsB, maxsB;2745 2746 BG_FindBBoxForBuildable( a, minsA, maxsA );2747 VectorAdd( minsA, originA, minsA );2748 VectorAdd( maxsA, originA, maxsA );2749 2750 BG_FindBBoxForBuildable( b, minsB, maxsB );2751 VectorAdd( minsB, originB, minsB );2752 VectorAdd( maxsB, originB, maxsB );2753 2754 return BoundsIntersect( minsA, maxsA, minsB, maxsB );2755 }2756 2757 /*2758 2688 =============== 2759 2689 G_CompareBuildablesForRemoval … … 2762 2692 =============== 2763 2693 */ 2764 static buildable_t cmpBuildable;2765 static vec3_t cmpOrigin;2766 2694 static int G_CompareBuildablesForRemoval( const void *a, const void *b ) 2767 2695 { … … 2792 2720 int i; 2793 2721 int aPrecedence = 0, bPrecedence = 0; 2794 qboolean aMatches = qfalse, bMatches = qfalse;2795 2722 2796 2723 buildableA = *(gentity_t **)a; 2797 2724 buildableB = *(gentity_t **)b; 2798 2725 2799 // Prefer the one that collides with the thing we're building 2800 aMatches = G_BuildablesIntersect( cmpBuildable, cmpOrigin, 2801 buildableA->s.modelindex, buildableA->s.origin ); 2802 bMatches = G_BuildablesIntersect( cmpBuildable, cmpOrigin, 2803 buildableB->s.modelindex, buildableB->s.origin ); 2804 if( aMatches && !bMatches ) 2805 return -1; 2806 else if( !aMatches && bMatches ) 2807 return 1; 2808 2809 // If one matches the thing we're building, prefer it 2810 aMatches = ( buildableA->s.modelindex == cmpBuildable ); 2811 bMatches = ( buildableB->s.modelindex == cmpBuildable ); 2812 if( aMatches && !bMatches ) 2813 return -1; 2814 else if( !aMatches && bMatches ) 2815 return 1; 2816 2817 // They're the same type 2726 // If they're the same type then pick the one marked earliest 2818 2727 if( buildableA->s.modelindex == buildableB->s.modelindex ) 2819 {2820 gentity_t *powerEntity = G_PowerEntityForPoint( cmpOrigin );2821 2822 // Prefer the entity that is providing power for this point2823 aMatches = ( powerEntity == buildableA );2824 bMatches = ( powerEntity == buildableB );2825 if( aMatches && !bMatches )2826 return -1;2827 else if( !aMatches && bMatches )2828 return 1;2829 2830 // Pick the one marked earliest2831 2728 return buildableA->deconstructTime - buildableB->deconstructTime; 2832 } 2833 2834 // Resort to preference list 2729 2835 2730 for( i = 0; i < sizeof( precedence ) / sizeof( precedence[ 0 ] ); i++ ) 2836 2731 { … … 2887 2782 2888 2783 Determine if enough build points can be released for the buildable 2889 and list the buildables that mu stbe destroyed if this is the case2784 and list the buildables that much be destroyed if this is the case 2890 2785 =============== 2891 2786 */ 2892 static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, 2893 vec3_t origin ) 2894 { 2895 int i; 2896 int numBuildables = 0; 2897 int pointsYielded = 0; 2898 gentity_t *ent; 2899 buildableTeam_t team = BG_FindTeamForBuildable( buildable ); 2900 int buildPoints = BG_FindBuildPointsForBuildable( buildable ); 2901 int remainingBP, remainingSpawns; 2902 qboolean collision = qfalse; 2903 int collisionCount = 0; 2904 qboolean repeaterInRange = qfalse; 2905 int repeaterInRangeCount = 0; 2906 itemBuildError_t bpError; 2907 buildable_t spawn; 2908 buildable_t core; 2909 int spawnCount = 0; 2787 static qboolean G_SufficientBPAvailable( buildableTeam_t team, 2788 int buildPoints, 2789 buildable_t buildable ) 2790 { 2791 int i; 2792 int numBuildables = level.numBuildablesForRemoval; 2793 int pointsYielded = 0; 2794 gentity_t *ent; 2795 qboolean unique = BG_FindUniqueTestForBuildable( buildable ); 2796 int remainingBP, remainingSpawns; 2797 int numBuildablesInTheWay = level.numBuildablesForRemoval; 2910 2798 2911 2799 if( team == BIT_ALIENS ) … … 2913 2801 remainingBP = level.alienBuildPoints; 2914 2802 remainingSpawns = level.numAlienSpawns; 2915 bpError = IBE_NOASSERT;2916 spawn = BA_A_SPAWN;2917 core = BA_A_OVERMIND;2918 2803 } 2919 2804 else if( team == BIT_HUMANS ) … … 2921 2806 remainingBP = level.humanBuildPoints; 2922 2807 remainingSpawns = level.numHumanSpawns; 2923 bpError = IBE_NOPOWER;2924 spawn = BA_H_SPAWN;2925 core = BA_H_REACTOR;2926 2808 } 2927 2809 else 2928 { 2929 Com_Error( ERR_FATAL, "team is %d\n", team ); 2930 return IBE_NONE; 2931 } 2810 return qfalse; 2932 2811 2933 2812 // Simple non-marking case … … 2935 2814 { 2936 2815 if( remainingBP - buildPoints < 0 ) 2937 return bpError; 2938 2939 // Check for buildable<->buildable collisions 2940 for( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ ) 2941 { 2942 if( ent->s.eType != ET_BUILDABLE ) 2943 continue; 2944 2945 if( G_BuildablesIntersect( buildable, origin, ent->s.modelindex, ent->s.origin ) ) 2946 return IBE_NOROOM; 2947 } 2948 2949 return IBE_NONE; 2816 return qfalse; 2817 else 2818 return qtrue; 2950 2819 } 2951 2820 … … 2958 2827 for( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ ) 2959 2828 { 2960 if( ent->s.eType != ET_BUILDABLE )2961 continue;2962 2963 collision = G_BuildablesIntersect( buildable, origin, ent->s.modelindex, ent->s.origin );2964 2965 if( collision )2966 {2967 // Don't allow replacements at all2968 if( g_markDeconstruct.integer == 1 )2969 return IBE_NOROOM;2970 2971 // Only allow replacements of the same type2972 if( g_markDeconstruct.integer == 2 && ent->s.modelindex != buildable )2973 return IBE_NOROOM;2974 2975 // Any other setting means anything goes2976 2977 collisionCount++;2978 }2979 2980 // Check if this is a repeater and it's in range2981 if( buildable == BA_H_REPEATER &&2982 buildable == ent->s.modelindex &&2983 Distance( ent->s.origin, origin ) < REPEATER_BASESIZE )2984 {2985 repeaterInRange = qtrue;2986 repeaterInRangeCount++;2987 }2988 else2989 repeaterInRange = qfalse;2990 2991 2829 if( !ent->inuse ) 2992 2830 continue; 2993 2831 2994 2832 if( ent->health <= 0 ) 2995 continue;2996 2997 if( ent->biteam != team )2998 2833 continue; 2999 2834 … … 3002 2837 continue; 3003 2838 3004 // Explicitly disallow replacement of the core buildable with anything 3005 // other than the core buildable 3006 if( ent->s.modelindex == core && buildable != core ) 2839 if( ent->biteam != team ) 3007 2840 continue; 3008 2841 2842 // Prevent destruction of the last spawn 2843 if( remainingSpawns <= 1 ) 2844 { 2845 if( ent->s.modelindex == BA_A_SPAWN || ent->s.modelindex == BA_H_SPAWN ) 2846 continue; 2847 } 2848 2849 // If it's a unique buildable, it can only be replaced by the same type 2850 if( unique && ent->s.modelindex != buildable ) 2851 continue; 2852 3009 2853 if( ent->deconstruct ) 3010 {3011 2854 level.markedBuildables[ numBuildables++ ] = ent; 3012 3013 // Buildables that are marked here will always end up at the front of the3014 // removal list, so just incrementing numBuildablesForRemoval is sufficient3015 if( collision || repeaterInRange )3016 {3017 // Collided with something, so we definitely have to remove it or3018 // it's a repeater that intersects the new repeater's power area,3019 // so it must be removed3020 3021 if( collision )3022 collisionCount--;3023 3024 if( repeaterInRange )3025 repeaterInRangeCount--;3026 3027 pointsYielded += BG_FindBuildPointsForBuildable( ent->s.modelindex );3028 level.numBuildablesForRemoval++;3029 }3030 else if( BG_FindUniqueTestForBuildable( ent->s.modelindex ) &&3031 ent->s.modelindex == buildable )3032 {3033 // If it's a unique buildable, it must be replaced by the same type3034 pointsYielded += BG_FindBuildPointsForBuildable( ent->s.modelindex );3035 level.numBuildablesForRemoval++;3036 }3037 }3038 2855 } 3039 2856 3040 2857 // We still need build points, but have no candidates for removal 3041 2858 if( buildPoints > 0 && numBuildables == 0 ) 3042 return bpError; 3043 3044 // Collided with something we can't remove 3045 if( collisionCount > 0 ) 3046 return IBE_NOROOM; 3047 3048 // There are one or more repeaters we can't remove 3049 if( repeaterInRangeCount > 0 ) 3050 return IBE_RPTWARN2; 3051 3052 // Sort the list 3053 cmpBuildable = buildable; 3054 VectorCopy( origin, cmpOrigin ); 3055 qsort( level.markedBuildables, numBuildables, sizeof( level.markedBuildables[ 0 ] ), 3056 G_CompareBuildablesForRemoval ); 2859 return qfalse; 2860 2861 // Sort everything that was added to the list, but leave what was already 2862 // there in the front (those buildings are blocking the new buildable) 2863 qsort( level.markedBuildables + numBuildablesInTheWay, 2864 numBuildables - numBuildablesInTheWay, 2865 sizeof( level.markedBuildables[ 0 ] ), G_CompareBuildablesForRemoval ); 2866 2867 // if any buildings are in the way of what we're building 2868 // we must force them to be deconned regardless of bp, so this won't work 2869 if( numBuildablesInTheWay == 0 ) 2870 { 2871 // Do a pass looking for a buildable of the same type that we're 2872 // building and mark it (and only it) for destruction if found 2873 for( i = 0; i < numBuildables; i++ ) 2874 { 2875 ent = level.markedBuildables[ i ]; 2876 2877 if( ent->s.modelindex == buildable ) 2878 { 2879 // If we're removing what we're building this will always work 2880 level.markedBuildables[ 0 ] = ent; 2881 level.numBuildablesForRemoval = 1; 2882 return qtrue; 2883 } 2884 } 2885 } 3057 2886 3058 2887 // Determine if there are enough markees to yield the required BP … … 3064 2893 } 3065 2894 3066 for( i = 0; i < level.numBuildablesForRemoval; i++ ) 3067 { 3068 if( level.markedBuildables[ i ]->s.modelindex == spawn ) 3069 spawnCount++; 3070 } 3071 3072 // Make sure we're not removing the last spawn 3073 if( ( remainingSpawns - spawnCount ) < 1 ) 3074 return bpError; 2895 if( level.numBuildablesForRemoval < numBuildablesInTheWay ) 2896 { 2897 level.numBuildablesForRemoval = numBuildablesInTheWay; 2898 } 3075 2899 3076 2900 // Not enough points yielded 3077 2901 if( pointsYielded < buildPoints ) 3078 return bpError; 2902 { 2903 level.numBuildablesForRemoval = 0; 2904 return qfalse; 2905 } 3079 2906 else 3080 return IBE_NONE; 3081 } 3082 3083 /* 3084 ================ 3085 G_SetBuildableLinkState 3086 3087 Links or unlinks all the buildable entities 3088 ================ 3089 */ 3090 static void G_SetBuildableLinkState( qboolean link ) 3091 { 3092 int i; 3093 gentity_t *ent; 3094 3095 for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ ) 3096 { 3097 if( ent->s.eType != ET_BUILDABLE ) 3098 continue; 3099 3100 if( link ) 3101 trap_LinkEntity( ent ); 3102 else 3103 trap_UnlinkEntity( ent ); 2907 { 2908 return qtrue; 3104 2909 } 3105 2910 } … … 3116 2921 vec3_t angles; 3117 2922 vec3_t entity_origin, normal; 3118 vec3_t mins, maxs; 2923 vec3_t mins, maxs, mins1, maxs1; 2924 int num; 2925 int entitylist[ MAX_GENTITIES ]; 3119 2926 trace_t tr1, tr2, tr3; 3120 itemBuildError_t reason = IBE_NONE, tempReason; 2927 int i; 2928 itemBuildError_t reason = IBE_NONE; 3121 2929 gentity_t *tempent; 3122 2930 float minNormal; … … 3126 2934 int buildPoints; 3127 2935 3128 // Stop all buildables from interacting with traces3129 G_SetBuildableLinkState( qfalse );3130 3131 2936 BG_FindBBoxForBuildable( buildable, mins, maxs ); 3132 2937 3133 2938 BG_PositionBuildableRelativeToPlayer( ps, mins, maxs, trap_Trace, entity_origin, angles, &tr1 ); 3134 trap_Trace( &tr2, entity_origin, mins, maxs, entity_origin, ent->s.number, MASK_PLAYERSOLID ); 3135 trap_Trace( &tr3, ps->origin, NULL, NULL, entity_origin, ent->s.number, MASK_PLAYERSOLID ); 2939 VectorAdd( entity_origin, mins, mins1 ); 2940 VectorAdd( entity_origin, maxs, maxs1 ); 2941 num = trap_EntitiesInBox( mins1, maxs1, entitylist, MAX_GENTITIES ); 2942 trap_Trace( &tr2, entity_origin, mins, maxs, entity_origin, ent->s.number, MASK_DEADSOLID ); 2943 trap_Trace( &tr3, ps->origin, NULL, NULL, entity_origin, ent->s.number, MASK_DEADSOLID ); 3136 2944 3137 2945 VectorCopy( entity_origin, origin ); … … 3155 2963 buildPoints = BG_FindBuildPointsForBuildable( buildable ); 3156 2964 2965 //force buildings that are blocking the current building to be 2966 //deconstructed before other marked buildings 2967 level.numBuildablesForRemoval = 0; 2968 for(i = 0; i < num; i++) 2969 { 2970 gentity_t *tent = &g_entities[ entitylist[ i ] ]; 2971 if( tent->s.eType == ET_PLAYER ) 2972 { 2973 reason = IBE_NOROOM; 2974 break; 2975 } 2976 else if( tent->biteam != ent->client->ps.stats[ STAT_PTEAM ] ) 2977 { 2978 reason = IBE_NOROOM; 2979 } 2980 else if( tent->s.eType == ET_BUILDABLE && !tent->deconstruct ) 2981 { 2982 reason = IBE_NOROOM; 2983 break; 2984 } 2985 else 2986 { 2987 if( tent->s.modelindex == BA_H_SPAWN && level.numHumanSpawns <= 1 ) 2988 { 2989 reason = IBE_NOROOM; 2990 break; 2991 } 2992 else if( tent->s.modelindex == BA_A_SPAWN && level.numAlienSpawns <= 1 ) 2993 { 2994 reason = IBE_NOROOM; 2995 break; 2996 } 2997 else if( tent->s.modelindex == BA_H_REACTOR && buildable != BA_H_REACTOR ) 2998 { 2999 reason = IBE_NOROOM; 3000 break; 3001 } 3002 else if( tent->s.modelindex == BA_A_OVERMIND && buildable != BA_A_OVERMIND ) 3003 { 3004 reason = IBE_NOROOM; 3005 break; 3006 } 3007 level.markedBuildables[ level.numBuildablesForRemoval++ ] = tent; 3008 } 3009 } 3010 if( reason != IBE_NONE ) 3011 { 3012 level.numBuildablesForRemoval = 0; 3013 } 3014 3157 3015 if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) 3158 3016 { 3159 3017 //alien criteria 3160 3018 3161 // Check there is an Overmind 3162 if( buildable != BA_A_OVERMIND ) 3163 { 3164 tempent = G_FindBuildable( BA_A_OVERMIND ); 3165 3166 if( tempent == NULL || !tempent->spawned || tempent->health <= 0 ) 3167 reason = IBE_OVERMIND; 3019 if( buildable == BA_A_HOVEL ) 3020 { 3021 vec3_t builderMins, builderMaxs; 3022 3023 //this assumes the adv builder is the biggest thing that'll use the hovel 3024 BG_FindBBoxForClass( PCL_ALIEN_BUILDER0_UPG, builderMins, builderMaxs, NULL, NULL, NULL ); 3025 3026 if( APropHovel_Blocked( angles, origin, normal, ent ) ) 3027 reason = IBE_HOVELEXIT; 3168 3028 } 3169 3029 … … 3175 3035 } 3176 3036 3177 if( buildable == BA_A_HOVEL ) 3178 { 3179 vec3_t builderMins, builderMaxs; 3180 3181 //this assumes the adv builder is the biggest thing that'll use the hovel 3182 BG_FindBBoxForClass( PCL_ALIEN_BUILDER0_UPG, builderMins, builderMaxs, NULL, NULL, NULL ); 3183 3184 if( APropHovel_Blocked( angles, origin, normal, ent ) ) 3185 reason = IBE_HOVELEXIT; 3186 } 3187 3188 // Check permission to build here 3189 if( tr1.surfaceFlags & SURF_NOALIENBUILD || contents & CONTENTS_NOALIENBUILD ) 3037 //check permission to build here 3038 if( tr1.surfaceFlags & SURF_NOALIENBUILD || tr1.surfaceFlags & SURF_NOBUILD || 3039 contents & CONTENTS_NOALIENBUILD || contents & CONTENTS_NOBUILD ) 3190 3040 reason = IBE_PERMISSION; 3041 3042 //look for an Overmind 3043 for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) 3044 { 3045 if( tempent->s.eType != ET_BUILDABLE ) 3046 continue; 3047 if( tempent->s.modelindex == BA_A_OVERMIND && tempent->spawned && 3048 tempent->health > 0 ) 3049 break; 3050 } 3051 3052 //if none found... 3053 if( i >= level.num_entities && buildable != BA_A_OVERMIND ) 3054 reason = IBE_NOOVERMIND; 3055 3056 //can we only have one of these? 3057 if( BG_FindUniqueTestForBuildable( buildable ) ) 3058 { 3059 for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) 3060 { 3061 if( tempent->s.eType != ET_BUILDABLE ) 3062 continue; 3063 3064 if( tempent->s.modelindex == buildable && !tempent->deconstruct ) 3065 { 3066 switch( buildable ) 3067 { 3068 case BA_A_OVERMIND: 3069 reason = IBE_OVERMIND; 3070 break; 3071 3072 case BA_A_HOVEL: 3073 reason = IBE_HOVEL; 3074 break; 3075 3076 default: 3077 Com_Error( ERR_FATAL, "No reason for denying build of %d\n", buildable ); 3078 break; 3079 } 3080 3081 break; 3082 } 3083 if( tempent->s.modelindex == BA_A_HOVEL && 3084 buildable == BA_A_HOVEL && 3085 tempent->active ) 3086 { 3087 reason = IBE_HOVEL; 3088 } 3089 else if( tempent->s.modelindex == buildable ) 3090 { 3091 level.markedBuildables[ level.numBuildablesForRemoval++ ] = tempent; 3092 } 3093 } 3094 } 3095 3096 if( !G_SufficientBPAvailable( BIT_ALIENS, buildPoints, buildable ) ) 3097 reason = IBE_NOASSERT; 3191 3098 } 3192 3099 else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) 3193 3100 { 3194 3101 //human criteria 3195 3196 // Check for power 3197 if( G_IsPowered( entity_origin ) == BA_NONE ) 3102 if( !G_IsPowered( entity_origin ) ) 3198 3103 { 3199 3104 //tell player to build a repeater to provide power … … 3209 3114 if( buildable == BA_H_REPEATER ) 3210 3115 { 3211 tempent = G_FindBuildable( BA_H_REACTOR ); 3212 3213 if( tempent == NULL ) // No reactor 3214 reason = IBE_RPTWARN; 3215 else if( g_markDeconstruct.integer && G_IsPowered( entity_origin ) == BA_H_REACTOR ) 3116 for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) 3117 { 3118 if( tempent->s.eType != ET_BUILDABLE ) 3119 continue; 3120 3121 if( tempent->s.modelindex == BA_H_REACTOR ) 3122 break; 3123 } 3124 3125 if( i >= level.num_entities ) 3126 { 3127 //no reactor present 3128 3129 //check for other nearby repeaters 3130 for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) 3131 { 3132 if( tempent->s.eType != ET_BUILDABLE ) 3133 continue; 3134 3135 if( tempent->s.modelindex == BA_H_REPEATER && 3136 Distance( tempent->s.origin, entity_origin ) < REPEATER_BASESIZE ) 3137 { 3138 reason = IBE_RPTWARN2; 3139 break; 3140 } 3141 } 3142 3143 if( reason == IBE_NONE ) 3144 reason = IBE_RPTWARN; 3145 } 3146 else if( G_IsPowered( entity_origin ) ) 3216 3147 reason = IBE_RPTWARN2; 3217 else if( !g_markDeconstruct.integer && G_IsPowered( entity_origin ) ) 3218 reason = IBE_RPTWARN2; 3219 } 3220 3221 // Check permission to build here 3222 if( tr1.surfaceFlags & SURF_NOHUMANBUILD || contents & CONTENTS_NOHUMANBUILD ) 3148 } 3149 3150 //check permission to build here 3151 if( tr1.surfaceFlags & SURF_NOHUMANBUILD || tr1.surfaceFlags & SURF_NOBUILD || 3152 contents & CONTENTS_NOHUMANBUILD || contents & CONTENTS_NOBUILD ) 3223 3153 reason = IBE_PERMISSION; 3224 } 3225 3226 // Check permission to build here 3227 if( tr1.surfaceFlags & SURF_NOBUILD || contents & CONTENTS_NOBUILD ) 3228 reason = IBE_PERMISSION; 3229 3230 // Can we only have one of these? 3231 if( BG_FindUniqueTestForBuildable( buildable ) ) 3232 { 3233 tempent = G_FindBuildable( buildable ); 3234 if( tempent && !tempent->deconstruct ) 3235 { 3236 switch( buildable ) 3154 3155 //can we only build one of these? 3156 if( BG_FindUniqueTestForBuildable( buildable ) ) 3157 { 3158 for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) 3237 3159 { 3238 case BA_A_OVERMIND: 3239 reason = IBE_OVERMIND; 3240 break; 3241 3242 case BA_A_HOVEL: 3243 reason = IBE_HOVEL; 3244 break; 3245 3246 case BA_H_REACTOR: 3160 if( tempent->s.eType != ET_BUILDABLE ) 3161 continue; 3162 3163 if( tempent->s.modelindex == BA_H_REACTOR && !tempent->deconstruct ) 3164 { 3247 3165 reason = IBE_REACTOR; 3248 3166 break; 3249 3250 default: 3251 Com_Error( ERR_FATAL, "No reason for denying build of %d\n", buildable ); 3252 break; 3167 } 3168 if( tempent->s.modelindex == buildable ) 3169 level.markedBuildables[ level.numBuildablesForRemoval++ ] = tempent; 3253 3170 } 3254 3171 } 3255 } 3256 3257 if( ( tempReason = G_SufficientBPAvailable( buildable, origin ) ) != IBE_NONE ) 3258 reason = tempReason; 3259 3260 if( g_zoneBuildPoints.integer && 3261 buildable != BA_A_SPAWN && 3262 buildable != BA_A_OVERMIND && 3263 buildable != BA_H_REACTOR && 3264 buildable != BA_H_REPEATER ) 3172 3173 if( !G_SufficientBPAvailable( BIT_HUMANS, buildPoints, buildable ) ) 3174 reason = IBE_NOPOWER; 3175 } 3176 3177 if(buildable != BA_A_SPAWN && buildable != BA_A_OVERMIND && buildable != BA_H_REACTOR && buildable != BA_H_REPEATER) 3265 3178 { 3266 3179 tempent = G_FindGenerator(ent->client->ps.stats[ STAT_PTEAM ], origin); 3267 if( reason == IBE_NONE &&3180 if( g_zoneBuildPoints.integer && reason == IBE_NONE && 3268 3181 (!tempent || !G_SufficientGeneratorBPAvailable(tempent, buildPoints)) 3269 3182 ) … … 3278 3191 //this item does not fit here 3279 3192 if( reason == IBE_NONE && ( tr2.fraction < 1.0 || tr3.fraction < 1.0 ) ) 3280 reason = IBE_NOROOM; 3281 3282 if( reason != IBE_NONE ) 3283 level.numBuildablesForRemoval = 0; 3284 3285 // Relink buildables 3286 G_SetBuildableLinkState( qtrue ); 3193 return IBE_NOROOM; 3287 3194 3288 3195 return reason; … … 3330 3237 else if( BG_FindTrajectoryForBuildable( buildable ) == TR_BUOYANCY ) 3331 3238 VectorSet( normal, 0.0f, 0.0f, -1.0f ); 3239 else 3240 VectorSet( normal, 0.0f, 0.0f, 1.0f ); 3241 } 3242 else 3243 { 3244 // in-game building by a player 3245 3246 if( builder->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) 3247 { 3248 if( builder->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) 3249 VectorSet( normal, 0.0f, 0.0f, -1.0f ); 3250 else 3251 VectorCopy( builder->client->ps.grapplePoint, normal ); 3252 } 3332 3253 else 3333 3254 VectorSet( normal, 0.0f, 0.0f, 1.0f ); 3334 3255 } 3335 else3336 {3337 // in-game building by a player3338 BG_GetClientNormal( &builder->client->ps, normal );3339 }3340 3256 3341 3257 // when building the initial layout, spawn the entity slightly off its 3342 // target surface so that it can be "dropped" onto it 3258 // target surface so that it can be "dropped" onto it 3343 3259 if( !builder->client ) 3344 3260 VectorMA( origin, 1.0f, normal, origin ); … … 3484 3400 3485 3401 G_SetOrigin( built, origin ); 3486 3402 3487 3403 // gently nudge the buildable onto the surface :) 3488 3404 VectorScale( normal, -50.0f, built->s.pos.trDelta ); … … 3720 3636 ============ 3721 3637 G_LayoutSave 3638 3722 3639 ============ 3723 3640 */ … … 3774 3691 } 3775 3692 3776 /*3777 ============3778 G_LayoutList3779 ============3780 */3781 3693 int G_LayoutList( const char *map, char *list, int len ) 3782 3694 { … … 3788 3700 char *filePtr; 3789 3701 3790 Q_strcat( layouts, sizeof( layouts ), "*BUILTIN* " ); 3702 Q_strcat( layouts, sizeof( layouts ), "*BUILTIN* " ); 3791 3703 numFiles = trap_FS_GetFileList( va( "layouts/%s", map ), ".dat", 3792 3704 fileList, sizeof( fileList ) ); … … 3797 3709 listLen = strlen( layouts ); 3798 3710 if( fileLen < 5 ) 3799 continue; 3711 continue; 3800 3712 3801 3713 // list is full, stop trying to add to it … … 3833 3745 char layouts[ MAX_CVAR_VALUE_STRING ]; 3834 3746 char layouts2[ MAX_CVAR_VALUE_STRING ]; 3835 char *l; 3747 char *l; 3836 3748 char map[ MAX_QPATH ]; 3837 3749 char *s; … … 3842 3754 trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); 3843 3755 3844 // one time use cvar 3756 // one time use cvar 3845 3757 trap_Cvar_Set( "g_layouts", "" ); 3846 3847 // pick an included layout at random if no list has been provided 3758 3759 // pick an included layout at random if no list has been provided 3848 3760 if( !layouts[ 0 ] && g_layoutAuto.integer ) 3849 3761 { … … 3868 3780 continue; 3869 3781 } 3870 3782 3871 3783 Com_sprintf( fileName, sizeof( fileName ), "layouts/%s/%s.dat", map, s ); 3872 3784 if( trap_FS_FOpenFile( fileName, NULL, FS_READ ) > 0 ) … … 3903 3815 } 3904 3816 3905 /*3906 ============3907 G_LayoutBuildItem3908 ============3909 */3910 3817 static void G_LayoutBuildItem( buildable_t buildable, vec3_t origin, 3911 3818 vec3_t angles, vec3_t origin2, vec3_t angles2 ) 3912 3819 { 3913 3820 gentity_t *builder; 3914 3821 3915 3822 builder = G_Spawn( ); 3916 3823 builder->client = 0; … … 3946 3853 if( !level.layout[ 0 ] || !Q_stricmp( level.layout, "*BUILTIN*" ) ) 3947 3854 return; 3948 3855 3949 3856 trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); 3950 3857 len = trap_FS_FOpenFile( va( "layouts/%s/%s.dat", map, level.layout ), … … 3965 3872 G_Printf( S_COLOR_RED "ERROR: line overflow in %s before \"%s\"\n", 3966 3873 va( "layouts/%s/%s.dat", map, level.layout ), line ); 3967 return; 3874 return; 3968 3875 } 3969 3876 line[ i++ ] = *layout; … … 3971 3878 if( *layout == '\n' ) 3972 3879 { 3973 i = 0; 3880 i = 0; 3974 3881 sscanf( line, "%d %f %f %f %f %f %f %f %f %f %f %f %f\n", 3975 3882 &buildable, … … 3989 3896 } 3990 3897 3991 /*3992 ============3993 G_BaseSelfDestruct3994 ============3995 */3996 3898 void G_BaseSelfDestruct( pTeam_t team ) 3997 3899 { -
src/game/g_client.c
r122 r2 777 777 SpawnCorpse( ent ); 778 778 779 // Clients can't respawn - they must go throughthe class cmd779 //TA: Clients can't respawn - they must go thru the class cmd 780 780 ent->client->pers.classSelection = PCL_NONE; 781 781 ClientSpawn( ent, NULL, NULL, NULL ); … … 890 890 if( *p == 0 || colorlessLen == 0 ) 891 891 Q_strncpyz( p, "UnnamedPlayer", outSize ); 892 }893 894 895 /*896 ===================897 G_NextNewbieName898 899 Generate a unique, known-good name for an UnnamedPlayer900 ===================901 */902 char *G_NextNewbieName( gentity_t *ent )903 {904 char newname[ MAX_NAME_LENGTH ];905 char namePrefix[ MAX_NAME_LENGTH - 4 ];906 char err[ MAX_STRING_CHARS ];907 908 if( g_newbieNamePrefix.string[ 0 ] )909 Q_strncpyz( namePrefix, g_newbieNamePrefix.string , sizeof( namePrefix ) );910 else911 strcpy( namePrefix, "Newbie#" );912 913 while( level.numNewbies < 10000 )914 {915 strcpy( newname, va( "%s%i", namePrefix, level.numNewbies ) );916 if ( G_admin_name_check( ent, newname, err, sizeof( err ) ) )917 {918 return va( "%s", newname );919 }920 level.numNewbies++; // Only increments if the last requested name was used.921 }922 return "UnnamedPlayer";923 892 } 924 893 … … 1002 971 char err[ MAX_STRING_CHARS ]; 1003 972 qboolean revertName = qfalse; 1004 qboolean showRenameMsg = qtrue;1005 973 gclient_t *client; 1006 974 char c1[ MAX_INFO_STRING ]; … … 1039 1007 if( strcmp( oldname, newname ) ) 1040 1008 { 1041 1042 if( !strlen( oldname ) && client->pers.connected != CON_CONNECTED ) 1043 showRenameMsg = qfalse; 1044 // in case we need to revert and there's no oldname 1045 ClientCleanName( va( "%s", client->pers.netname ), oldname, sizeof( oldname ) ); 1046 1047 if( g_newbieNumbering.integer ) 1048 { 1049 if( !strcmp( newname, "UnnamedPlayer" ) ) 1050 Q_strncpyz( newname, G_NextNewbieName( ent ), sizeof( newname ) ); 1051 if( !strcmp( oldname, "UnnamedPlayer" ) ) 1052 Q_strncpyz( oldname, G_NextNewbieName( ent ), sizeof( oldname ) ); 1053 } 1009 // in case we need to revert and there's no oldname 1010 if( client->pers.connected != CON_CONNECTED ) 1011 Q_strncpyz( oldname, "UnnamedPlayer", sizeof( oldname ) ); 1054 1012 1055 1013 if( client->pers.muted ) … … 1093 1051 Q_strncpyz( client->pers.netname, newname, 1094 1052 sizeof( client->pers.netname ) ); 1095 Info_SetValueForKey( userinfo, "name", newname );1096 trap_SetUserinfo( clientNum, userinfo );1097 1053 if( client->pers.connected == CON_CONNECTED ) 1098 1054 { … … 1109 1065 } 1110 1066 1111 if( client->pers.connected >= CON_CONNECTING && showRenameMsg)1067 if( client->pers.connected == CON_CONNECTED ) 1112 1068 { 1113 1069 if( strcmp( oldname, client->pers.netname ) ) … … 1398 1354 // locate ent at a spawn point 1399 1355 1400 client->pers.classSelection = PCL_NONE;1401 1356 ClientSpawn( ent, NULL, NULL, NULL ); 1402 1357 … … 1406 1361 G_admin_namelog_update( client, qfalse ); 1407 1362 1408 // autoregister client if possible1409 G_admin_autoregister( ent );1410 1411 1363 // request the clients PTR code 1412 1364 trap_SendServerCommand( ent - g_entities, "ptrcrequest" ); … … 1416 1368 // count current clients and rank for scoreboard 1417 1369 CalculateRanks( ); 1418 }1419 1420 /*1421 ==================1422 ClientPingOverride1423 1424 Called by server every time a client connects to check1425 whether it is immune to ping restrictions.1426 ==================1427 */1428 int ClientPingOverride( void )1429 {1430 char userinfo[ MAX_INFO_STRING ];1431 // create a temporary gentity1432 gentity_t ent;1433 gclient_t client;1434 ent.client = &client;1435 1436 // userinfo for the client is not yet availible so just use Argv(1)1437 trap_Argv( 1, userinfo, sizeof( userinfo ) );1438 Q_strncpyz( client.pers.guid, Info_ValueForKey( userinfo, "cl_guid" ), sizeof( client.pers.guid ) );1439 if ( !client.pers.guid[0] )1440 return 0;1441 1442 return G_admin_permission( &ent, ADMF_PINGOVERRIDE );1443 1370 } 1444 1371 … … 1477 1404 teamLocal = client->pers.teamSelection; 1478 1405 1479 // only start client if chosen a class and joined a team1406 //TA: only start client if chosen a class and joined a team 1480 1407 if( client->pers.classSelection == PCL_NONE && teamLocal == PTE_NONE ) 1481 1408 { … … 1589 1516 ent->flags = 0; 1590 1517 1591 // calculate each client's acceleration1518 //TA: calculate each client's acceleration 1592 1519 ent->evaluateAcceleration = qtrue; 1593 1520 … … 1646 1573 client->ps.stats[ STAT_STAMINA ] = MAX_STAMINA; 1647 1574 1648 client->jetpack_beat = 0;1649 client->jetpack_power = g_jetpackLimit.integer;1650 1651 1575 G_SetOrigin( ent, spawn_origin ); 1652 1576 VectorCopy( spawn_origin, client->ps.origin ); … … 1757 1681 } 1758 1682 1759 // must do this here so the number of active clients is calculated1683 //TA: must do this here so the number of active clients is calculated 1760 1684 CalculateRanks( ); 1761 1685 … … 1793 1717 G_admin_namelog_update( ent->client, qtrue ); 1794 1718 G_LeaveTeam( ent ); 1795 G_Vote( ent, qfalse );1796 1719 1797 1720 // stop any following clients -
src/game/g_cmds.c
r122 r1 53 53 skip = qfalse; 54 54 } 55 55 56 56 if( *in == 27 || *in == '^' ) 57 57 { … … 68 68 *out++ = tolower( *in++ ); 69 69 } 70 out -= spaces; 70 out -= spaces; 71 71 *out = 0; 72 72 } … … 97 97 cl = &level.clients[ idnum ]; 98 98 99 if( cl->pers.connected == CON_DISCONNECTED )99 if( cl->pers.connected != CON_CONNECTED ) 100 100 return -1; 101 101 … … 108 108 for( idnum = 0, cl = level.clients; idnum < level.maxclients; idnum++, cl++ ) 109 109 { 110 if( cl->pers.connected == CON_DISCONNECTED )110 if( cl->pers.connected != CON_CONNECTED ) 111 111 continue; 112 112 … … 127 127 This is a companion function to G_ClientNumbersFromString() 128 128 129 err will be populated with an error message. 130 ================== 131 */ 132 void G_MatchOnePlayer( int *plist, int num, char *err, int len ) 129 returns qtrue if the int array plist only has one client id, false otherwise 130 In the case of false, err will be populated with an error message. 131 ================== 132 */ 133 qboolean G_MatchOnePlayer( int *plist, char *err, int len ) 133 134 { 134 135 gclient_t *cl; 135 int i;136 int *p; 136 137 char line[ MAX_NAME_LENGTH + 10 ] = {""}; 137 138 138 139 err[ 0 ] = '\0'; 139 if( num == 0)140 if( plist[ 0 ] == -1 ) 140 141 { 141 142 Q_strcat( err, len, "no connected player by that name or slot #" ); 142 } 143 else if( num > 1 ) 143 return qfalse; 144 } 145 if( plist[ 1 ] != -1 ) 144 146 { 145 147 Q_strcat( err, len, "more than one player name matches. " 146 148 "be more specific or use the slot #:\n" ); 147 for( i = 0; i < num; i++ ) 148 { 149 cl = &level.clients[ plist[ i ] ]; 150 if( cl->pers.connected == CON_DISCONNECTED ) 151 continue; 152 Com_sprintf( line, sizeof( line ), "%2i - %s^7\n", 153 plist[ i ], cl->pers.netname ); 154 if( strlen( err ) + strlen( line ) > len ) 155 break; 156 Q_strcat( err, len, line ); 157 } 158 } 149 for( p = plist; *p != -1; p++ ) 150 { 151 cl = &level.clients[ *p ]; 152 if( cl->pers.connected == CON_CONNECTED ) 153 { 154 Com_sprintf( line, sizeof( line ), "%2i - %s^7\n", 155 *p, cl->pers.netname ); 156 if( strlen( err ) + strlen( line ) > len ) 157 break; 158 Q_strcat( err, len, line ); 159 } 160 } 161 return qfalse; 162 } 163 return qtrue; 159 164 } 160 165 … … 164 169 165 170 Sets plist to an array of integers that represent client numbers that have 166 names that are a partial match for s. 167 168 Returns number of matching clientids up to max.169 ================== 170 */ 171 int G_ClientNumbersFromString( char *s, int *plist , int max)171 names that are a partial match for s. List is terminated by a -1. 172 173 Returns number of matching clientids. 174 ================== 175 */ 176 int G_ClientNumbersFromString( char *s, int *plist ) 172 177 { 173 178 gclient_t *p; 174 179 int i, found = 0; 175 char n2[ MAX_NAME_LENGTH ] = {""}; 176 char s2[ MAX_NAME_LENGTH ] = {""}; 180 char n2[ MAX_NAME_LENGTH ] = {""}; 181 char s2[ MAX_NAME_LENGTH ] = {""}; 182 qboolean is_slot = qtrue; 183 184 *plist = -1; 177 185 178 186 // if a number is provided, it might be a slot # 179 for( i = 0; s[ i ] && isdigit( s[ i ] ); i++ ); 180 if( !s[ i ] ) 181 { 187 for( i = 0; i < (int)strlen( s ); i++ ) 188 { 189 if( s[i] < '0' || s[i] > '9' ) 190 { 191 is_slot = qfalse; 192 break; 193 } 194 } 195 196 if( is_slot ) { 182 197 i = atoi( s ); 183 if( i >= 0 && i < level.maxclients ) 184 { 198 if( i >= 0 && i < level.maxclients ) { 185 199 p = &level.clients[ i ]; 186 if( p->pers.connected != CON_DISCONNECTED ) 187 { 188 *plist = i; 200 if( p->pers.connected == CON_CONNECTED || 201 p->pers.connected == CON_CONNECTING ) 202 { 203 *plist++ = i; 204 *plist = -1; 189 205 return 1; 190 206 } … … 198 214 if( strlen( s2 ) < 1 ) 199 215 return 0; 200 for( i = 0; i < level.maxclients && found <= max; i++ )216 for( i = 0; i < level.maxclients; i++ ) 201 217 { 202 218 p = &level.clients[ i ]; 203 if( p->pers.connected == CON_DISCONNECTED ) 219 if(p->pers.connected != CON_CONNECTED 220 && p->pers.connected != CON_CONNECTING) 204 221 { 205 222 continue; … … 212 229 } 213 230 } 231 *plist = -1; 214 232 return found; 215 233 } … … 527 545 return; 528 546 529 G_TeamVote( self, qfalse );530 531 547 for( i = 0; i < level.num_entities; i++ ) 532 548 { … … 620 636 ent->client->pers.joinedATeam = qtrue; 621 637 ent->client->pers.teamChangeTime = level.time; 638 622 639 //update ClientInfo 623 640 ClientUserinfoChanged( ent->client->ps.clientNum ); 624 CalculateRanks( );625 641 } 626 642 … … 638 654 int aliens = level.numAlienClients; 639 655 int humans = level.numHumanClients; 640 int warmup;641 656 642 657 // stop team join spam 643 658 if( level.time - ent->client->pers.teamChangeTime < 1000 ) 644 659 return; 645 646 // do warm up647 if( g_doWarmup.integer )648 {649 warmup = g_warmup.integer - ( ( level.time - level.startTime ) / 1000) - 1;650 if( warmup > 0 )651 {652 trap_SendServerCommand( ent - g_entities, va( "print \"team: you can't join"653 " a team during warm up (%d seconds remaining)\n\"", warmup ) );654 return;655 }656 }657 660 658 661 if( oldteam == PTE_ALIENS ) … … 661 664 humans--; 662 665 666 // do warm up 667 if( g_doWarmup.integer && 668 level.time - level.startTime < g_warmup.integer * 1000 ) 669 { 670 /* 671 trap_SendServerCommand( ent - g_entities, va( "print \"team: you can't join" 672 " a team during warm up (%d seconds remaining)\n\"", 673 g_warmup.integer - ( level.time - level.startTime ) / 1000 ) ); 674 */ 675 return; 676 } 677 663 678 trap_Argv( 1, s, sizeof( s ) ); 664 679 … … 667 682 trap_SendServerCommand( ent-g_entities, va("print \"team: %i\n\"", 668 683 oldteam ) ); 669 return;670 }671 672 // g_maxGameClients stuff673 if( !force && oldteam == PTE_NONE && g_maxGameClients.integer &&674 level.numPlayingClients >= g_maxGameClients.integer )675 {676 trap_SendServerCommand( ent-g_entities, va( "print \"The maximum number of "677 "playing clients has been reached (g_maxGameClients = %d)\n\"",678 g_maxGameClients.integer ) );679 return;680 }681 682 //guard against build timer exploit683 if( ent->client->pers.teamSelection != PTE_NONE &&684 ( ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0 ||685 ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0_UPG ||686 BG_InventoryContainsWeapon( WP_HBUILD, ent->client->ps.stats ) ||687 BG_InventoryContainsWeapon( WP_HBUILD2, ent->client->ps.stats ) ) &&688 ent->client->ps.stats[ STAT_MISC ] > 0 )689 {690 trap_SendServerCommand( ent-g_entities, va( "print \"You cannot change teams until build timer expires\n\"" ) );691 684 return; 692 685 } … … 702 695 return; 703 696 } 704 705 if( !force && !level.humanTeamLocked && g_teamForceBalance.integer && aliens > humans ) 706 { 697 else if( level.humanTeamLocked ) 698 { 699 // if only one team has been locked, let people join the other 700 // regardless of balance 701 force = qtrue; 702 } 703 704 if( !force && g_teamForceBalance.integer && 705 ent->client->pers.teamSelection == PTE_ALIENS && 706 aliens > humans ) 707 { 708 //G_TriggerMenu( ent - g_entities, MN_A_TEAMFULL ); 707 709 trap_SendServerCommand( ent-g_entities, va("print \"team: The alien team has too many players.\n\"" ) ); 708 710 return; … … 719 721 return; 720 722 } 721 if( !force && !level.alienTeamLocked && g_teamForceBalance.integer && humans > aliens ) 722 { 723 else if( level.alienTeamLocked ) 724 { 725 // if only one team has been locked, let people join the other 726 // regardless of balance 727 force = qtrue; 728 } 729 730 if( !force && g_teamForceBalance.integer && 731 ent->client->pers.teamSelection == PTE_HUMANS && 732 humans > aliens ) 733 { 734 //G_TriggerMenu( ent - g_entities, MN_H_TEAMFULL ); 723 735 trap_SendServerCommand( ent-g_entities, va("print \"team: The human team has too many players.\n\"" ) ); 724 736 return; … … 731 743 if( level.humanTeamLocked && level.alienTeamLocked ) 732 744 team = PTE_NONE; 733 else if(humans > aliens ) 745 else if( level.numHumanClients > level.numAlienClients || 746 (ent->client->pers.teamSelection == PTE_ALIENS && 747 humans > aliens ) ) 734 748 team = PTE_ALIENS; 735 else if( humans < aliens ) 749 else if( ( level.numHumanClients < level.numAlienClients ) || 750 ( ent->client->pers.teamSelection == PTE_HUMANS && 751 humans < aliens ) ) 736 752 team = PTE_HUMANS; 737 753 else … … 750 766 751 767 // stop team join spam 752 if( ent->client->pers.teamSelection == team ) 753 return; 754 768 if( oldteam == team ) 769 return; 770 771 //guard against build timer exploit 772 if( oldteam != PTE_NONE && 773 ( ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0 || 774 ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0_UPG || 775 BG_InventoryContainsWeapon( WP_HBUILD, ent->client->ps.stats ) || 776 BG_InventoryContainsWeapon( WP_HBUILD2, ent->client->ps.stats ) ) && 777 ent->client->ps.stats[ STAT_MISC ] > 0 ) 778 { 779 trap_SendServerCommand( ent-g_entities, 780 va( "print \"You cannot change teams until build timer expires\n\"" ) ); 781 return; 782 } 783 784 785 oldteam = ent->client->pers.teamSelection; 755 786 G_ChangeTeam( ent, team ); 756 787 757 if( team == PTE_ALIENS ) 758 { 788 if( team == PTE_ALIENS ) { 759 789 if ( oldteam == PTE_HUMANS ) 760 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " abandoned humans and joined the aliens\n\"", ent->client->pers.netname ) ); 790 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " abandoned humans and joined the aliens\n\"", 791 ent->client->pers.netname ) ); 761 792 else 762 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", ent->client->pers.netname ) );763 }764 else if( team == PTE_HUMANS )765 {793 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", 794 ent->client->pers.netname ) ); 795 } 796 else if( team == PTE_HUMANS ) { 766 797 if ( oldteam == PTE_ALIENS ) 767 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " abandoned aliens and joined the humans\n\"", ent->client->pers.netname ) ); 798 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " abandoned aliens and joined the humans\n\"", 799 ent->client->pers.netname ) ); 768 800 else 769 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans\n\"", ent->client->pers.netname ) );770 }771 else if( team == PTE_NONE )772 {801 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " joined the humans\n\"", 802 ent->client->pers.netname ) ); 803 } 804 else if( team == PTE_NONE ) { 773 805 if ( oldteam == PTE_HUMANS ) 774 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " left the humans\n\"", ent->client->pers.netname ) ); 806 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " left the humans\n\"", 807 ent->client->pers.netname ) ); 775 808 else 776 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " left the aliens\n\"", ent->client->pers.netname ) ); 809 trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " left the aliens\n\"", 810 ent->client->pers.netname ) ); 777 811 } 778 812 } … … 802 836 return; 803 837 804 if( ( mode == SAY_TEAM || mode == SAY_ACTION_T )&& !OnSameTeam( ent, other ) )838 if( mode == SAY_TEAM && !OnSameTeam( ent, other ) ) 805 839 { 806 840 toSend = qfalse; … … 821 855 } 822 856 823 if( mode == SAY_ADMINS && !G_admin_permission( other, ADMF_ADMINCHAT) )824 return;825 826 857 if( mode == SAY_ALL ) 827 858 usePrefix = qtrue; … … 833 864 { 834 865 trap_SendServerCommand( other-g_entities, va( "%s \"%s%s%s%c%c%s\"", 835 ( mode == SAY_TEAM || mode == SAY_ACTION_T )? "tchat" : "chat",866 mode == SAY_TEAM ? "tchat" : "chat", 836 867 ( ignore ) ? "[skipnotify]" : "", 837 868 usePrefix ? prefix : "", … … 887 918 color = COLOR_GREEN; 888 919 break; 889 890 case SAY_ACTION:891 G_LogPrintf( "action: %s: %s\n", ent->client->pers.netname, chatText );892 Com_sprintf( name, sizeof( name ), "^2%s^7%s%s%c%c"EC" ", g_actionPrefix.string, prefix,893 ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );894 color = COLOR_WHITE;895 break;896 case SAY_ACTION_T:897 G_LogPrintf( "actionteam: %s: %s\n", ent->client->pers.netname, chatText );898 if( Team_GetLocationMsg( ent, location, sizeof( location ) ) )899 Com_sprintf( name, sizeof( name ), EC"^5%s^7%s%c%c"EC"(%s)"EC" ", g_actionPrefix.string,900 ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, location );901 else902 Com_sprintf( name, sizeof( name ), EC"^5%s^7%s%c%c"EC""EC" ", g_actionPrefix.string,903 ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );904 color = COLOR_WHITE;905 break;906 920 907 921 case SAY_TEAM: … … 931 945 color = COLOR_MAGENTA; 932 946 break; 933 934 case SAY_ADMINS: 935 if( G_admin_permission( ent, ADMF_ADMINCHAT ) ) //Differentiate between inter-admin chatter and user-admin alerts 936 { 937 G_LogPrintf( "say_admins: [ADMIN]%s: %s\n", ent->client->pers.netname, chatText ); 938 Com_sprintf( name, sizeof( name ), "%s[ADMIN]%s%c%c"EC": ", prefix, 939 ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE ); 940 color = COLOR_MAGENTA; 941 } 942 else 943 { 944 G_LogPrintf( "say_admins: [PLAYER]%s: %s\n", ent->client->pers.netname, chatText ); 945 Com_sprintf( name, sizeof( name ), "%s[PLAYER]%s%c%c"EC": ", prefix, 946 ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE ); 947 color = COLOR_MAGENTA; 948 } 949 break; 950 } 951 952 Com_sprintf( text, sizeof( text ), "%s^7", chatText ); 947 } 948 949 Q_strncpyz( text, chatText, sizeof( text ) ); 953 950 954 951 //R1's simple flood protection (lowered in g_client timer actions) … … 989 986 char *p; 990 987 char *args; 991 int offset = 0;992 988 int mode = SAY_ALL; 993 989 … … 995 991 if( Q_stricmpn( args, "say_team ", 9 ) == 0 ) 996 992 mode = SAY_TEAM; 997 if( Q_stricmpn( args, "say_admins ", 11 ) == 0 || Q_stricmpn( args, "a ", 2 ) == 0)998 mode = SAY_ADMINS;999 993 1000 994 // support parsing /m out of say text since some people have a hard … … 1008 1002 return; 1009 1003 } 1010 1011 if( !Q_stricmpn( args, "say /a ", 7) || 1012 !Q_stricmpn( args, "say_team /a ", 12) || 1013 !Q_stricmpn( args, "say /say_admins ", 16) || 1014 !Q_stricmpn( args, "say_team /say_admins ", 21) ) 1015 { 1016 mode = SAY_ADMINS; 1017 offset =3; 1018 } 1019 1020 if( mode == SAY_ADMINS) 1021 if(!G_admin_permission( ent, ADMF_ADMINCHAT ) ) 1022 { 1023 if( !g_publicSayadmins.integer ) 1024 { 1025 ADMP( "Sorry, but public use of say_admins has been disabled.\n" ); 1026 return; 1027 } 1028 else 1029 { 1030 ADMP( "Your message has been sent to any available admins and to the server logs.\n" ); 1031 } 1032 } 1033 1004 1034 1005 if( g_allowDonate.integer ) 1035 1006 { … … 1056 1027 } 1057 1028 } 1058 1059 if( g_allowActions.integer && !Q_stricmpn( args, "say /me ", 8 ) )1060 {1061 mode = SAY_ACTION;1062 offset = 4;1063 }1064 1065 if( g_allowActions.integer && !Q_stricmpn( args, "say_team /me ", 13 ) )1066 {1067 mode = SAY_ACTION_T;1068 offset = 4;1069 }1070 1029 1071 1030 p = ConcatArgs( 1 ); 1072 p += offset;1073 1031 1074 1032 G_Say( ent, NULL, mode, p ); … … 1186 1144 } 1187 1145 1188 if( G_ClientNumbersFromString( arg2, clientNums , MAX_CLIENTS) == 1 )1146 if( G_ClientNumbersFromString( arg2, clientNums ) == 1 ) 1189 1147 { 1190 1148 // there was only one partial name match … … 1198 1156 1199 1157 if( clientNum != -1 && 1200 level.clients[ clientNum ].pers.connected != CON_CONNECTED )1158 level.clients[ clientNum ].pers.connected == CON_DISCONNECTED ) 1201 1159 { 1202 1160 clientNum = -1; … … 1266 1224 "Un-Mute player \'%s\'", name ); 1267 1225 } 1268 else if( !Q_stricmp( arg1, " restartmap" ) )1226 else if( !Q_stricmp( arg1, "map_restart" ) ) 1269 1227 { 1270 1228 Com_sprintf( level.voteString, sizeof( level.voteString ), "%s", arg1 ); … … 1285 1243 sizeof( level.voteDisplayString ), "Change to map '%s'", arg2 ); 1286 1244 } 1287 else if( !Q_stricmp( arg1, " nextmap" ) )1288 { 1289 Com_sprintf( level.voteString, sizeof( level.voteString ), " advanceMapRotation" );1245 else if( !Q_stricmp( arg1, "draw" ) ) 1246 { 1247 Com_sprintf( level.voteString, sizeof( level.voteString ), "evacuation" ); 1290 1248 Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), 1291 " Skip to next map in rotation" );1249 "End match in a draw" ); 1292 1250 } 1293 1251 else … … 1295 1253 trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); 1296 1254 trap_SendServerCommand( ent-g_entities, "print \"Valid vote commands are: " 1297 "map, restartmap, nextmap, kick, mute and unmute\n" );1255 "map, map_restart, draw, kick, mute and unmute\n" ); 1298 1256 return; 1299 1257 } … … 1310 1268 level.voteYes = 1; 1311 1269 level.voteNo = 0; 1312 ent->client->pers.vote = qtrue;1313 1270 1314 1271 for( i = 0 ; i < level.maxclients ; i++ ) … … 1319 1276 trap_SetConfigstring( CS_VOTE_TIME, va( "%i", level.voteTime ) ); 1320 1277 trap_SetConfigstring( CS_VOTE_STRING, level.voteDisplayString ); 1321 trap_SetConfigstring( CS_VOTE_YES, "1");1322 trap_SetConfigstring( CS_VOTE_NO, "0");1278 trap_SetConfigstring( CS_VOTE_YES, va( "%i", level.voteYes ) ); 1279 trap_SetConfigstring( CS_VOTE_NO, va( "%i", level.voteNo ) ); 1323 1280 } 1324 1281 … … 1346 1303 trap_SendServerCommand( ent-g_entities, "print \"Vote cast\n\"" ); 1347 1304 1305 ent->client->ps.eFlags |= EF_VOTED; 1306 1348 1307 trap_Argv( 1, msg, sizeof( msg ) ); 1349 ent->client->pers.vote = ( tolower( msg[ 0 ] ) == 'y' || msg[ 0 ] == '1' ); 1350 G_Vote( ent, qtrue ); 1351 1352 // a majority will be determined in CheckVote, which will also account 1308 1309 if( msg[ 0 ] == 'y' || msg[ 1 ] == 'Y' || msg[ 1 ] == '1' ) 1310 { 1311 level.voteYes++; 1312 trap_SetConfigstring( CS_VOTE_YES, va( "%i", level.voteYes ) ); 1313 } 1314 else 1315 { 1316 level.voteNo++; 1317 trap_SetConfigstring( CS_VOTE_NO, va( "%i", level.voteNo ) ); 1318 } 1319 1320 // a majority will be determined in G_CheckVote, which will also account 1353 1321 // for players entering or leaving 1354 1322 } … … 1418 1386 } 1419 1387 1420 if( G_ClientNumbersFromString( arg2, clientNums , MAX_CLIENTS) == 1 )1388 if( G_ClientNumbersFromString( arg2, clientNums ) == 1 ) 1421 1389 { 1422 1390 // there was only one partial name match … … 1530 1498 ent->client->pers.voteCount++; 1531 1499 1532 G_TeamCommand( team, va( "print \"%s " S_COLOR_WHITE "called a team vote\n\"", 1533 ent->client->pers.netname ) ); 1500 for( i = 0 ; i < level.maxclients ; i++ ) 1501 { 1502 if( level.clients[ i ].pers.connected == CON_DISCONNECTED ) 1503 continue; 1504 1505 if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team ) 1506 trap_SendServerCommand( i, va("print \"%s " S_COLOR_WHITE 1507 "called a team vote\n\"", ent->client->pers.netname ) ); 1508 } 1509 G_Printf( "'%s^7' called a teamvote for '%s'\n", ent->client->pers.netname, 1510 level.teamVoteString[ cs_offset ] ) ; 1534 1511 1535 1512 // start the voting, the caller autoamtically votes yes … … 1537 1514 level.teamVoteYes[ cs_offset ] = 1; 1538 1515 level.teamVoteNo[ cs_offset ] = 0; 1539 ent->client->pers.teamVote = qtrue;1540 1516 1541 1517 for( i = 0 ; i < level.maxclients ; i++ ) … … 1547 1523 ent->client->ps.eFlags |= EF_TEAMVOTED; 1548 1524 1549 trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, 1550 va( "%i", level.teamVoteTime[ cs_offset ] ) ); 1551 trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, 1552 level.teamVoteDisplayString[ cs_offset ] ); 1553 trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, "1" ); 1554 trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, "0" ); 1525 trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, va( "%i", level.teamVoteTime[ cs_offset ] ) ); 1526 trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, level.teamVoteDisplayString[ cs_offset ] ); 1527 trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, va( "%i", level.teamVoteYes[ cs_offset ] ) ); 1528 trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va( "%i", level.teamVoteNo[ cs_offset ] ) ); 1555 1529 } 1556 1530 … … 1583 1557 trap_SendServerCommand( ent-g_entities, "print \"Team vote cast\n\"" ); 1584 1558 1559 ent->client->ps.eFlags |= EF_TEAMVOTED; 1560 1585 1561 trap_Argv( 1, msg, sizeof( msg ) ); 1586 ent->client->pers.teamVote = ( tolower( msg[ 0 ] ) == 'y' || msg[ 0 ] == '1' ); 1587 G_TeamVote( ent, qtrue ); 1588 1589 // a majority will be determined in CheckTeamVote, which will also account 1562 1563 if( msg[ 0 ] == 'y' || msg[ 1 ] == 'Y' || msg[ 1 ] == '1' ) 1564 { 1565 level.teamVoteYes[ cs_offset ]++; 1566 trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, va( "%i", level.teamVoteYes[ cs_offset ] ) ); 1567 } 1568 else 1569 { 1570 level.teamVoteNo[ cs_offset ]++; 1571 trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va( "%i", level.teamVoteNo[ cs_offset ] ) ); 1572 } 1573 1574 // a majority will be determined in TeamCheckVote, which will also account 1590 1575 // for players entering or leaving 1591 1576 } … … 1625 1610 #define EVOLVE_TRACE_HEIGHT 128.0f 1626 1611 #define AS_OVER_RT3 ((ALIENSENSE_RANGE*0.5f)/M_ROOT3) 1627 1628 static qboolean G_RoomForClassChange( gentity_t *ent, pClass_t class,1629 vec3_t newOrigin )1630 {1631 vec3_t fromMins, fromMaxs;1632 vec3_t toMins, toMaxs;1633 vec3_t temp;1634 trace_t tr;1635 float nudgeHeight;1636 float maxHorizGrowth;1637 pClass_t oldClass = ent->client->ps.stats[ STAT_PCLASS ];1638 1639 BG_FindBBoxForClass( oldClass, fromMins, fromMaxs, NULL, NULL, NULL );1640 BG_FindBBoxForClass( class, toMins, toMaxs, NULL, NULL, NULL );1641 1642 VectorCopy( ent->s.origin, newOrigin );1643 1644 // find max x/y diff1645 maxHorizGrowth = toMaxs[ 0 ] - fromMaxs[ 0 ];1646 if( toMaxs[ 1 ] - fromMaxs[ 1 ] > maxHorizGrowth )1647 maxHorizGrowth = toMaxs[ 1 ] - fromMaxs[ 1 ];1648 if( toMins[ 0 ] - fromMins[ 0 ] > -maxHorizGrowth )1649 maxHorizGrowth = -( toMins[ 0 ] - fromMins[ 0 ] );1650 if( toMins[ 1 ] - fromMins[ 1 ] > -maxHorizGrowth )1651 maxHorizGrowth = -( toMins[ 1 ] - fromMins[ 1 ] );1652 1653 if( maxHorizGrowth > 0.0f )1654 {1655 // test by moving the player up the max required on a 60 degree slope1656 nudgeHeight = maxHorizGrowth * 2.0f;1657 }1658 else1659 {1660 // player is shrinking, so there's no need to nudge them upwards1661 nudgeHeight = 0.0f;1662 }1663 1664 // find what the new origin would be on a level surface1665 newOrigin[ 2 ] += fabs( toMins[ 2 ] ) - fabs( fromMins[ 2 ] );1666 1667 //compute a place up in the air to start the real trace1668 VectorCopy( newOrigin, temp );1669 temp[ 2 ] += nudgeHeight;1670 trap_Trace( &tr, newOrigin, toMins, toMaxs, temp, ent->s.number, MASK_SHOT );1671 1672 //trace down to the ground so that we can evolve on slopes1673 VectorCopy( newOrigin, temp );1674 temp[ 2 ] += ( nudgeHeight * tr.fraction );1675 trap_Trace( &tr, temp, toMins, toMaxs, newOrigin, ent->s.number, MASK_SHOT );1676 VectorCopy( tr.endpos, newOrigin );1677 1678 //make REALLY sure1679 trap_Trace( &tr, newOrigin, toMins, toMaxs, newOrigin,1680 ent->s.number, MASK_SHOT );1681 1682 //check there is room to evolve1683 if( !tr.startsolid && tr.fraction == 1.0f )1684 return qtrue;1685 else1686 return qfalse;1687 }1688 1612 1689 1613 /* … … 2024 1948 G_TeamCommand( ent->client->pers.teamSelection, 2025 1949 va( "print \"%s ^3DECONSTRUCTED^7 by %s^7\n\"", 2026 BG_FindHumanNameForBuildable( traceEnt->s.modelindex ), 1950 BG_FindHumanNameForBuildable( traceEnt->s.modelindex ), 2027 1951 ent->client->pers.netname ) ); 2028 1952 … … 2030 1954 ent->client->ps.clientNum, 2031 1955 traceEnt->s.modelindex, 2032 ent->client->pers.netname, 1956 ent->client->pers.netname, 2033 1957 BG_FindNameForBuildable( traceEnt->s.modelindex ) ); 2034 1958 … … 2133 2057 //special case to allow switching between 2134 2058 //the blaster and the primary weapon 2135 ent->client->ps.weaponTime = 0;2136 2059 2137 2060 if( ent->client->ps.weapon != WP_BLASTER ) … … 2344 2267 else 2345 2268 { 2346 if( upgrade == UP_BATTLESUIT )2347 {2348 vec3_t newOrigin;2349 2350 if( !G_RoomForClassChange( ent, PCL_HUMAN_BSUIT, newOrigin ) )2351 {2352 trap_SendServerCommand( ent-g_entities, va( "print \"Not enough room here to put on a Battle Suit\n\"") );2353 return;2354 }2355 VectorCopy( newOrigin, ent->s.pos.trBase );2356 ent->client->ps.stats[ STAT_PCLASS ] = PCL_HUMAN_BSUIT;2357 ent->client->ps.eFlags ^= EF_TELEPORT_BIT;2358 }2359 2360 2269 //add to inventory 2361 2270 BG_AddUpgradeToInventory( upgrade, ent->client->ps.stats ); … … 2453 2362 if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) 2454 2363 { 2455 // shouldn't really need to test for this, but just to be safe2456 if( upgrade == UP_BATTLESUIT )2457 {2458 vec3_t newOrigin;2459 2460 if( !G_RoomForClassChange( ent, PCL_HUMAN, newOrigin ) )2461 {2462 trap_SendServerCommand( ent-g_entities, va( "print \"Not enough room here to take off your Battle Suit\n\"") );2463 return;2464 }2465 VectorCopy( newOrigin, ent->s.pos.trBase );2466 ent->client->ps.stats[ STAT_PCLASS ] = PCL_HUMAN;2467 ent->client->ps.eFlags ^= EF_TELEPORT_BIT;2468 }2469 2470 //add to inventory2471 2364 BG_RemoveUpgradeFromInventory( upgrade, ent->client->ps.stats ); 2472 2365 … … 2596 2489 2597 2490 if(g_repeaterOnReactor.integer && buildable == BA_H_REACTOR && level.reactorPresent) 2598 buildable = BA_H_REPEATER;2491 buildable = BA_H_REPEATER; 2599 2492 2600 2493 team = ent->client->ps.stats[ STAT_PTEAM ]; … … 2718 2611 clientNum = atoi( arg1 ); 2719 2612 } 2720 else if( G_ClientNumbersFromString( arg1, clientNums , MAX_CLIENTS) == 1 )2613 else if( G_ClientNumbersFromString( arg1, clientNums ) == 1 ) 2721 2614 { 2722 2615 // there was one partial name match … … 3076 2969 { 3077 2970 trap_Argv( 1, arg, sizeof( arg ) ); 3078 if( G_ClientNumbersFromString( arg, pids , MAX_CLIENTS) == 1 )2971 if( G_ClientNumbersFromString( arg, pids ) == 1 ) 3079 2972 { 3080 2973 i = pids[ 0 ]; … … 3241 3134 3242 3135 Q_strncpyz( name, ConcatArgs( 1 ), sizeof( name ) ); 3243 matches = G_ClientNumbersFromString( name, pids , MAX_CLIENTS);3136 matches = G_ClientNumbersFromString( name, pids ); 3244 3137 if( matches < 1 ) 3245 3138 { … … 3302 3195 { "say", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, 3303 3196 { "say_team", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, 3304 { "say_admins", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f },3305 { "a", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f },3306 3197 { "m", CMD_MESSAGE|CMD_INTERMISSION, G_PrivateMessage }, 3307 3198 { "mt", CMD_MESSAGE|CMD_INTERMISSION, G_PrivateMessage }, 3308 { "me", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, 3199 3309 3200 { "score", CMD_INTERMISSION, ScoreboardMessage }, 3310 3201 … … 3595 3486 G_SayArgv( 1+skipargs, name, sizeof( name ) ); 3596 3487 msg = G_SayConcatArgs( 2+skipargs ); 3597 pcount = G_ClientNumbersFromString( name, pids , MAX_CLIENTS);3488 pcount = G_ClientNumbersFromString( name, pids ); 3598 3489 3599 3490 if( ent ) -
src/game/g_combat.c
r122 r1 186 186 self->client->pers.netname, obit ); 187 187 188 // close any menus the client has open188 //TA: close any menus the client has open 189 189 G_CloseMenus( self->client->ps.clientNum ); 190 190 191 // deactivate all upgrades191 //TA: deactivate all upgrades 192 192 for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) 193 193 BG_DeactivateUpgrade( i, self->client->ps.stats ); … … 379 379 } 380 380 381 self->client->pers.classSelection = PCL_NONE; // reset the classtype381 self->client->pers.classSelection = PCL_NONE; //TA: reset the classtype 382 382 VectorCopy( self->s.origin, self->client->pers.lastDeathLocation ); 383 383 … … 402 402 self->client->respawnTime = level.time + 1700; 403 403 404 // clear misc404 // remove powerups 405 405 memset( self->client->ps.powerups, 0, sizeof( self->client->ps.powerups ) ); 406 406 … … 461 461 trap_LinkEntity( self ); 462 462 } 463 464 465 ////////TA: locdamage 463 466 464 467 /* … … 709 712 clientHeight = targ->r.maxs[ 2 ] - targ->r.mins[ 2 ]; 710 713 711 BG_GetClientNormal( &targ->client->ps, normal ); 714 if( targ->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) 715 VectorCopy( targ->client->ps.grapplePoint, normal ); 716 else 717 VectorSet( normal, 0, 0, 1 ); 712 718 713 719 VectorMA( targOrigin, targ->r.mins[ 2 ], normal, floor ); … … 885 891 } 886 892 893 ////////TA: locdamage 894 887 895 888 896 /* … … 910 918 */ 911 919 912 // team is the team that is immune to this damage920 //TA: team is the team that is immune to this damage 913 921 void G_SelectiveDamage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, 914 922 vec3_t dir, vec3_t point, int damage, int dflags, int mod, int team ) … … 1040 1048 push[2] = 64.0f; 1041 1049 VectorAdd( targ->client->ps.velocity, push, targ->client->ps.velocity ); 1042 return;1043 }1044 else if( !g_friendlyFireMovementAttacks.integer && (mod == MOD_LEVEL4_CHARGE || mod == MOD_LEVEL3_POUNCE )){1045 // don't do friendly fire on movement attacks1046 1050 return; 1047 1051 } … … 1067 1071 if( !g_friendlyBuildableFire.integer ) 1068 1072 return; 1069 // don't do friendly fire on movement attacks1070 if( !g_friendlyFireMovementAttacks.integer && (mod == MOD_LEVEL4_CHARGE || mod == MOD_LEVEL3_POUNCE ))1071 return;1072 1073 } 1073 1074 … … 1156 1157 targ->lastDamageTime = level.time; 1157 1158 1158 // add to the attackers "account" on the target1159 //TA: add to the attackers "account" on the target 1159 1160 if( targ->client && attacker->client ) 1160 1161 { … … 1238 1239 } 1239 1240 1241 1242 //TA: 1240 1243 /* 1241 1244 ============ -
src/game/g_local.h
r122 r1 350 350 int savedCredit; 351 351 352 // votes353 qboolean vote;354 qboolean teamVote;355 356 352 vec3_t lastDeathLocation; 357 353 char guid[ 33 ]; … … 412 408 413 409 // timers 414 int respawnTime; // can respawn when time > this 410 int respawnTime; // can respawn when time > this, force after g_forcerespwan 415 411 int inactivityTime; // kick players when time > this 416 412 qboolean inactivityWarning;// qtrue if the five seoond warning has been given … … 437 433 438 434 gentity_t *hovel; 435 436 int lastUpdateFrame; 437 qboolean warping; 438 qboolean warped; 439 439 440 440 int lastPoisonTime; … … 468 468 int unlaggedTime; 469 469 470 int jetpack_beat; // waiting time before turn on jetpack when power down471 int jetpack_power;472 470 }; 473 471 … … 565 563 int numPlayingClients; // connected, non-spectators 566 564 int sortedClients[MAX_CLIENTS]; // sorted by score 567 int numNewbies; // number of UnnamedPlayers who have been renamed this round.568 565 569 566 int snd_fry; // sound index for standing in lava … … 704 701 qboolean G_FollowNewClient( gentity_t *ent, int dir ); 705 702 void G_ToggleFollow( gentity_t *ent ); 706 void G_MatchOnePlayer( int *plist, int num, char *err, int len ); 707 int G_ClientNumbersFromString( char *s, int *plist, int max ); 708 void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ); 703 qboolean G_MatchOnePlayer( int *plist, char *err, int len ); 704 int G_ClientNumbersFromString( char *s, int *plist ); 709 705 int G_SayArgc( void ); 710 706 qboolean G_SayArgv( int n, char *buffer, int bufferLength ); … … 761 757 762 758 gentity_t* G_FindGenerator( buildableTeam_t team, vec3_t origin ); 763 buildable_tG_IsPowered( vec3_t origin );759 qboolean G_IsPowered( vec3_t origin ); 764 760 qboolean G_IsDCCBuilt( void ); 765 761 qboolean G_IsOvermindBuilt( void ); … … 930 926 void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ); 931 927 qboolean SpotWouldTelefrag( gentity_t *spot ); 932 char *G_NextNewbieName( gentity_t *ent );933 928 934 929 // … … 964 959 void QDECL G_Printf( const char *fmt, ... ); 965 960 void QDECL G_Error( const char *fmt, ... ); 966 void G_Vote( gentity_t *ent, qboolean voting );967 void G_TeamVote( gentity_t *ent, qboolean voting );968 961 void CheckVote( void ); 969 962 void CheckTeamVote( int teamnum ); … … 980 973 void ClientBegin( int clientNum ); 981 974 void ClientCommand( int clientNum ); 982 int ClientPingOverride( void );983 975 984 976 // … … 1119 1111 extern vmCvar_t g_dedicated; 1120 1112 extern vmCvar_t g_cheats; 1121 extern vmCvar_t g_version;1122 1113 extern vmCvar_t g_maxclients; // allow this many total, including spectators 1123 1114 extern vmCvar_t g_maxGameClients; // allow this many active … … 1126 1117 extern vmCvar_t g_minNameChangePeriod; 1127 1118 extern vmCvar_t g_maxNameChanges; 1128 extern vmCvar_t g_newbieNumbering;1129 extern vmCvar_t g_newbieNamePrefix;1130 1119 1131 1120 extern vmCvar_t g_timelimit; … … 1136 1125 extern vmCvar_t g_friendlyFireAliens; 1137 1126 extern vmCvar_t g_friendlyBuildableFire; 1138 extern vmCvar_t g_friendlyFireMovementAttacks;1139 1127 extern vmCvar_t g_password; 1140 1128 extern vmCvar_t g_needpass; … … 1143 1131 extern vmCvar_t g_knockback; 1144 1132 extern vmCvar_t g_quadfactor; 1133 extern vmCvar_t g_forcerespawn; 1145 1134 extern vmCvar_t g_inactivity; 1146 1135 extern vmCvar_t g_debugMove; … … 1169 1158 extern vmCvar_t g_grangerMode; 1170 1159 extern vmCvar_t g_repeaterOnReactor; 1171 extern vmCvar_t g_jetpackLimit;1172 1160 extern vmCvar_t g_autoDonate; 1173 1161 extern vmCvar_t g_enableDust; … … 1210 1198 extern vmCvar_t g_shove; 1211 1199 1200 extern vmCvar_t g_maxWarp; 1201 extern vmCvar_t g_skipCorrection; 1202 1212 1203 extern vmCvar_t g_mapConfigs; 1213 1204 … … 1221 1212 extern vmCvar_t g_adminTempBan; 1222 1213 extern vmCvar_t g_minLevelToSpecMM1; 1223 extern vmCvar_t g_adminWarnMessage; 1214 1224 1215 extern vmCvar_t g_privateMessages; 1225 extern vmCvar_t g_publicSayadmins;1226 extern vmCvar_t g_allowActions;1227 extern vmCvar_t g_actionPrefix;1228 1216 extern vmCvar_t g_floodProtection; 1229 extern vmCvar_t g_autoRegister;1230 1217 1231 1218 extern vmCvar_t g_slapKnockback; … … 1241 1228 extern vmCvar_t g_cheatAdminLevel; // an admin above or equal this level can use cheat, disable if 0 1242 1229 1243 extern vmCvar_t g_playerVotePercent; 1244 extern vmCvar_t g_globalVotePercent; 1230 extern vmCvar_t wbpguid; // woolball command target public guid 1245 1231 1246 1232 void trap_Printf( const char *fmt ); -
src/game/g_main.c
r122 r1 23 23 24 24 #include "g_local.h" 25 26 #include "../qcommon/q_shared.h"27 25 28 26 level_locals_t level; … … 42 40 gclient_t g_clients[ MAX_CLIENTS ]; 43 41 44 vmCvar_t g_version;45 42 vmCvar_t g_fraglimit; 46 43 vmCvar_t g_timelimit; … … 52 49 vmCvar_t g_friendlyFireHumans; 53 50 vmCvar_t g_friendlyBuildableFire; 54 vmCvar_t g_friendlyFireMovementAttacks;55 51 vmCvar_t g_password; 56 52 vmCvar_t g_needpass; … … 63 59 vmCvar_t g_knockback; 64 60 vmCvar_t g_quadfactor; 61 vmCvar_t g_forcerespawn; 65 62 vmCvar_t g_inactivity; 66 63 vmCvar_t g_debugMove; … … 88 85 vmCvar_t g_smoothClients; 89 86 vmCvar_t pmove_fixed; 87 vmCvar_t pmove_msec; 90 88 vmCvar_t g_rankings; 91 vmCvar_t pmove_msec;92 89 vmCvar_t g_listEntity; 93 90 vmCvar_t g_minCommandPeriod; 94 91 vmCvar_t g_minNameChangePeriod; 95 92 vmCvar_t g_maxNameChanges; 96 vmCvar_t g_newbieNumbering;97 vmCvar_t g_newbieNamePrefix;98 93 99 94 vmCvar_t g_reactorBuildPoints; … … 130 125 vmCvar_t g_shove; 131 126 127 vmCvar_t g_maxWarp; 128 vmCvar_t g_skipCorrection; 129 132 130 vmCvar_t g_mapConfigs; 133 131 vmCvar_t g_chatTeamPrefix; … … 141 139 vmCvar_t g_adminParseSay; 142 140 vmCvar_t g_adminNameProtect; 143 vmCvar_t g_autoRegister;144 141 vmCvar_t g_adminTempBan; 145 142 vmCvar_t g_minLevelToSpecMM1; 146 vmCvar_t g_adminWarnMessage;147 143 148 144 vmCvar_t g_privateMessages; 149 vmCvar_t g_publicSayadmins;150 145 vmCvar_t g_floodProtection; 151 146 … … 154 149 155 150 vmCvar_t g_tag; 156 157 vmCvar_t g_allowActions;158 vmCvar_t g_actionPrefix;159 151 160 152 vmCvar_t g_hiddenClients; … … 174 166 vmCvar_t g_grangerMode; 175 167 vmCvar_t g_repeaterOnReactor; 176 vmCvar_t g_jetpackLimit; 177 178 vmCvar_t g_playerVotePercent; 179 vmCvar_t g_globalVotePercent; 168 169 vmCvar_t wbpguid; 180 170 181 171 static cvarTable_t gameCvarTable[ ] = … … 194 184 // latched vars 195 185 196 { &g_version, "g_version", FULL_VERSION, CVAR_SERVERINFO | CVAR_ROM, 0, qfalse },197 198 186 { &g_maxclients, "sv_maxclients", "12", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, 199 187 { &g_maxGameClients, "g_maxGameClients", "0", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, 200 188 201 189 // change anytime vars 202 { &g_maxGameClients, "g_maxGameClients", "0", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qfalse },203 204 190 { &g_timelimit, "timelimit", "0", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue }, 205 191 { &g_suddenDeathTime, "g_suddenDeathTime", "0", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue }, 206 192 { &g_suddenDeathMode, "g_suddenDeathMode", "0", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue }, 207 { &g_playerVotePercent, "g_playerVotePercent", "55", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },208 { &g_globalVotePercent, "g_globalVotePercent", "65", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },209 193 210 194 { &g_synchronousClients, "g_synchronousClients", "0", CVAR_SYSTEMINFO, 0, qfalse }, … … 214 198 { &g_friendlyFireHumans, "g_friendlyFireHumans", "1", CVAR_ARCHIVE, 0, qtrue }, 215 199 { &g_friendlyBuildableFire, "g_friendlyBuildableFire", "1", CVAR_ARCHIVE, 0, qtrue }, 216 { &g_friendlyFireMovementAttacks, "g_friendlyFireMovementAttacks", "1", CVAR_ARCHIVE, 0, qtrue },217 200 218 201 { &g_teamAutoJoin, "g_teamAutoJoin", "0", CVAR_ARCHIVE }, … … 240 223 { &g_weaponRespawn, "g_weaponrespawn", "5", 0, 0, qtrue }, 241 224 { &g_weaponTeamRespawn, "g_weaponTeamRespawn", "30", 0, 0, qtrue }, 225 { &g_forcerespawn, "g_forcerespawn", "20", 0, 0, qtrue }, 242 226 { &g_inactivity, "g_inactivity", "0", 0, 0, qtrue }, 243 227 { &g_debugMove, "g_debugMove", "0", 0, 0, qfalse }, … … 256 240 { &g_minNameChangePeriod, "g_minNameChangePeriod", "5", 0, 0, qfalse}, 257 241 { &g_maxNameChanges, "g_maxNameChanges", "5", 0, 0, qfalse}, 258 { &g_newbieNumbering, "g_newbieNumbering", "0", CVAR_ARCHIVE, 0, qfalse},259 { &g_newbieNamePrefix, "g_newbieNamePrefix", "Newbie#", CVAR_ARCHIVE, 0, qfalse},260 242 261 243 { &g_smoothClients, "g_smoothClients", "1", 0, 0, qfalse}, … … 298 280 { &g_shove, "g_shove", "0.0", CVAR_ARCHIVE, 0, qfalse }, 299 281 282 { &g_maxWarp, "g_maxWarp", "3", CVAR_ARCHIVE, 0, qfalse }, 283 { &g_skipCorrection, "g_skipCorrection", "1", CVAR_ARCHIVE, 0, qfalse }, 284 300 285 { &g_mapConfigs, "g_mapConfigs", "mapconfigs", CVAR_ARCHIVE, 0, qfalse }, 301 286 { NULL, "g_mapConfigsLoaded", "0", CVAR_ROM, 0, qfalse }, … … 309 294 { &g_adminNameProtect, "g_adminNameProtect", "1", CVAR_ARCHIVE, 0, qfalse }, 310 295 { &g_adminTempBan, "g_adminTempBan", "120", CVAR_ARCHIVE, 0, qfalse }, 311 { &g_adminWarnMessage, "g_adminWarnMessage", "You have been warned by an administrator.\n Cease imeediately or face admin action!\n", CVAR_ARCHIVE, 0, qfalse },312 { &g_autoRegister, "g_autoRegister", "0", CVAR_ARCHIVE, 0, qfalse },313 296 314 297 { &g_privateMessages, "g_privateMessages", "1", CVAR_ARCHIVE, 0, qfalse }, 315 { &g_publicSayadmins, "g_publicSayadmins", "1", CVAR_ARCHIVE, 0, qfalse },316 298 { &g_minLevelToSpecMM1, "g_minLevelToSpecMM1", "0", CVAR_ARCHIVE, 0, qfalse }, 317 299 { &g_floodProtection, "g_floodProtection", "150", CVAR_ARCHIVE, 0, qfalse }, … … 332 314 { &g_noBaseAttack, "g_noBaseAttack", "0", 0, 0, qfalse}, 333 315 { &g_cheatAdminLevel, "g_cheatAdminLevel", "0", CVAR_SERVERINFO, 0, qfalse}, 316 { &wbpguid, "wbpguid", "", CVAR_ARCHIVE, 0, qfalse }, 334 317 335 318 { &g_allowDonate, "g_allowDonate", "1", CVAR_ARCHIVE, 0, qfalse}, … … 337 320 { &g_allowShare, "g_allowShare", "1", CVAR_ARCHIVE, 0, qfalse}, 338 321 { &g_grangerMode, "g_grangerMode", "0", 0, 0, qfalse }, 339 { &g_repeaterOnReactor, "g_repeaterOnReactor", "1", 0, 0, qfalse }, 340 { &g_jetpackLimit, "g_jetpackLimit", "40", 0, 0, qfalse }, 341 { &g_allowActions, "g_allowActions", "1", CVAR_ARCHIVE, 0, qfalse }, 342 { &g_actionPrefix, "g_actionPrefix", "***", CVAR_ARCHIVE, 0, qfalse } 322 { &g_repeaterOnReactor, "g_repeaterOnReactor", "1", 0, 0, qfalse } 343 323 }; 344 324 … … 405 385 case GAME_CONSOLE_COMMAND: 406 386 return ConsoleCommand( ); 407 408 case GAME_PING_OVERRIDE:409 return ClientPingOverride( );410 387 } 411 388 … … 714 691 G_FindTeams( ); 715 692 693 //TA: 716 694 BG_InitClassOverrides( ); 717 695 BG_InitBuildableOverrides( ); … … 741 719 G_RemapTeamShaders( ); 742 720 743 // so the server counts the spawns without a client attached721 //TA: so the server counts the spawns without a client attached 744 722 G_CountSpawns( ); 745 723 … … 1220 1198 level.overmindPresent = qfalse; 1221 1199 1222 for( i = 1, ent = g_entities + i ; i < level.num_entities && g_zoneBuildPoints.integer; i++, ent++ )1200 for( i = 1, ent = g_entities + i ; i < level.num_entities ; i++, ent++ ) 1223 1201 { 1224 1202 buildable = ent->s.modelindex; … … 1256 1234 buildPoints = BG_FindBuildPointsForBuildable( buildable ); 1257 1235 1258 if(g_zoneBuildPoints.integer && ent->parentNode && ent->s.modelindex != BA_A_SPAWN) 1259 { 1260 if(ent->parentNode->buildpoints >= buildPoints) 1261 ent->parentNode->buildpoints -= buildPoints; 1262 else 1263 ent->powered = 0; 1264 } 1236 if(ent->parentNode && ent->s.modelindex != BA_A_SPAWN) 1237 ent->parentNode->buildpoints -= buildPoints; 1265 1238 1266 1239 if( BG_FindTeamForBuildable( buildable ) == BIT_HUMANS ) … … 1688 1661 G_AdvanceMapRotation( ); 1689 1662 else 1690 trap_SendConsoleCommand( EXEC_APPEND, " restartmap\n" );1663 trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" ); 1691 1664 1692 1665 level.restarted = qtrue; … … 2117 2090 } 2118 2091 2119 /*2120 ==================2121 G_Vote2122 ==================2123 */2124 void G_Vote( gentity_t *ent, qboolean voting )2125 {2126 if( !level.voteTime )2127 return;2128 2129 if( voting )2130 {2131 if( ent->client->ps.eFlags & EF_VOTED )2132 return;2133 ent->client->ps.eFlags |= EF_VOTED;2134 }2135 else2136 {2137 if( !( ent->client->ps.eFlags & EF_VOTED ) )2138 return;2139 ent->client->ps.eFlags &= ~EF_VOTED;2140 }2141 2142 if( ent->client->pers.vote )2143 {2144 if( voting )2145 level.voteYes++;2146 else2147 level.voteYes--;2148 trap_SetConfigstring( CS_VOTE_YES, va( "%d", level.voteYes ) );2149 }2150 else2151 {2152 if( voting )2153 level.voteNo++;2154 else2155 level.voteNo--;2156 trap_SetConfigstring( CS_VOTE_NO, va( "%d", level.voteNo ) );2157 }2158 }2159 2160 /*2161 ==================2162 G_TeamVote2163 ==================2164 */2165 void G_TeamVote( gentity_t *ent, qboolean voting )2166 {2167 int cs_offset;2168 2169 if( ent->client->pers.teamSelection == PTE_HUMANS )2170 cs_offset = 0;2171 else if( ent->client->pers.teamSelection == PTE_ALIENS )2172 cs_offset = 1;2173 else2174 return;2175 2176 if( !level.teamVoteTime[ cs_offset ] )2177 return;2178 2179 if( voting )2180 {2181 if( ent->client->ps.eFlags & EF_TEAMVOTED )2182 return;2183 ent->client->ps.eFlags |= EF_TEAMVOTED;2184 }2185 else2186 {2187 if( !( ent->client->ps.eFlags & EF_TEAMVOTED ) )2188 return;2189 ent->client->ps.eFlags &= ~EF_TEAMVOTED;2190 }2191 2192 if( ent->client->pers.teamVote )2193 {2194 if( voting )2195 level.teamVoteYes[ cs_offset ]++;2196 else2197 level.teamVoteYes[ cs_offset ]--;2198 trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset,2199 va( "%d", level.teamVoteYes[ cs_offset ] ) );2200 }2201 else2202 {2203 if( voting )2204 level.teamVoteNo[ cs_offset ]++;2205 else2206 level.teamVoteNo[ cs_offset ]--;2207 trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset,2208 va( "%d", level.teamVoteNo[ cs_offset ] ) );2209 }2210 }2211 2092 2212 2093 … … 2227 2108 void CheckVote( void ) 2228 2109 { 2229 double percent;2230 2231 2110 if( level.voteExecuteTime && level.voteExecuteTime < level.time ) 2232 2111 { … … 2234 2113 2235 2114 trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) ); 2236 if( !Q_stricmp( level.voteString, " restartmap" ) ||2115 if( !Q_stricmp( level.voteString, "map_restart" ) || 2237 2116 !Q_stricmpn( level.voteString, "map", 3 ) ) 2238 2117 { … … 2240 2119 } 2241 2120 } 2242 2243 if (strstr(level.voteString, "mute") || strstr(level.voteString, "unmute") || strstr(level.voteString, "kick"))2244 percent = g_playerVotePercent.integer;2245 else2246 percent = g_globalVotePercent.integer;2247 2121 2248 2122 if( !level.voteTime ) 2249 2123 return; 2250 2124 2251 // warning: not sure about > or >=2252 2253 2125 if( level.time - level.voteTime >= VOTE_TIME ) 2254 2126 { 2255 if( level.voteYes > = rint ( (level.numVotingClients * percent) / 100 ))2127 if( level.voteYes > level.voteNo ) 2256 2128 { 2257 2129 // execute the command, then remove the vote … … 2267 2139 else 2268 2140 { 2269 if( level.voteYes > = rint ( (level.numVotingClients * percent) / 100 ))2141 if( level.voteYes > level.numVotingClients / 2 ) 2270 2142 { 2271 2143 // execute the command, then remove the vote … … 2273 2145 level.voteExecuteTime = level.time + 3000; 2274 2146 } 2275 else if( level.voteNo > rint ( (level.numVotingClients * (100 - percent) ) / 100 ))2147 else if( level.voteNo >= level.numVotingClients / 2 ) 2276 2148 { 2277 2149 // same behavior as a timeout … … 2346 2218 if( level.time - level.teamVoteTime[ cs_offset ] >= VOTE_TIME ) 2347 2219 { 2348 G_TeamCommand( team, "print \"Team vote failed\n\"" );2220 trap_SendServerCommand( -1, "print \"Team vote failed\n\"" ); 2349 2221 } 2350 2222 else … … 2353 2225 { 2354 2226 // execute the command, then remove the vote 2355 G_TeamCommand( team, "print \"Team vote passed\n\"" ); 2227 trap_SendServerCommand( -1, "print \"Team vote passed\n\"" ); 2228 // 2356 2229 trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) ); 2357 2230 } … … 2359 2232 { 2360 2233 // same behavior as a timeout 2361 G_TeamCommand( team, "print \"Team vote failed\n\"" );2234 trap_SendServerCommand( -1, "print \"Team vote failed\n\"" ); 2362 2235 } 2363 2236 else … … 2485 2358 msec = level.time - level.previousTime; 2486 2359 2487 // seed the rng2360 //TA: seed the rng 2488 2361 srand( level.framenum ); 2489 2362 … … 2534 2407 continue; 2535 2408 2536 // calculate the acceleration of this entity2409 //TA: calculate the acceleration of this entity 2537 2410 if( ent->evaluateAcceleration ) 2538 2411 G_EvaluateAcceleration( ent, msec ); … … 2591 2464 end = trap_Milliseconds(); 2592 2465 2466 //TA: 2593 2467 G_CountSpawns( ); 2594 2468 G_CalculateBuildPoints( ); -
src/game/g_maprotation.c
r118 r0 27 27 28 28 static mapRotations_t mapRotations; 29 30 /*31 ===============32 G_MapExists33 34 Check if a map exists35 ===============36 */37 static qboolean G_MapExists( char *name )38 {39 fileHandle_t f;40 41 if( trap_FS_FOpenFile( va( "maps/%s.bsp", name ), &f, FS_READ ) > 0 )42 {43 trap_FS_FCloseFile( f );44 return qtrue;45 }46 else47 return qfalse;48 }49 50 /*51 ===============52 G_RotationExists53 54 Check if a rotation exists55 ===============56 */57 static qboolean G_RotationExists( char *name )58 {59 int i;60 61 for( i = 0; i < mapRotations.numRotations; i++ )62 {63 if( Q_strncmp( mapRotations.rotations[ i ].name, name, MAX_QPATH ) == 0 )64 return qtrue;65 }66 67 return qfalse;68 }69 29 70 30 /* … … 309 269 { 310 270 char *text_p; 311 int i , j, k;271 int i; 312 272 int len; 313 273 char *token; … … 368 328 } 369 329 370 //start parsing map rotations again330 //start parsing particle systems again 371 331 mrNameSet = qfalse; 372 332 … … 401 361 } 402 362 403 for( i = 0; i < mapRotations.numRotations; i++ )404 {405 for( j = 0; j < mapRotations.rotations[ i ].numMaps; j++ )406 {407 if( !G_MapExists( mapRotations.rotations[ i ].maps[ j ].name ) )408 {409 G_Printf( S_COLOR_RED "ERROR: map \"%s\" doesn't exist\n",410 mapRotations.rotations[ i ].maps[ j ].name );411 return qfalse;412 }413 414 for( k = 0; k < mapRotations.rotations[ i ].maps[ j ].numConditions; k++ )415 {416 if( !G_MapExists( mapRotations.rotations[ i ].maps[ j ].conditions[ k ].dest ) &&417 !G_RotationExists( mapRotations.rotations[ i ].maps[ j ].conditions[ k ].dest ) )418 {419 G_Printf( S_COLOR_RED "ERROR: conditional destination \"%s\" doesn't exist\n",420 mapRotations.rotations[ i ].maps[ j ].conditions[ k ].dest );421 return qfalse;422 }423 424 }425 426 }427 }428 429 363 return qtrue; 430 364 } … … 610 544 } 611 545 546 //this should probably be prevented by a 2nd pass at compile time 547 //but i'm lazy (FIXME) 612 548 return MCT_ERR; 613 549 } -
src/game/g_misc.c
r122 r0 328 328 void SP_misc_anim_model( gentity_t *self ) 329 329 { 330 self->s.powerups = (int)self->animation[ 0 ];330 self->s.powerups = (int)self->animation[ 0 ]; 331 331 self->s.weapon = (int)self->animation[ 1 ]; 332 332 self->s.torsoAnim = (int)self->animation[ 2 ]; -
src/game/g_missile.c
r118 r0 83 83 ent->s.eType = ET_GENERAL; 84 84 85 //TA: tired... can't be fucked... hack 85 86 if( ent->s.weapon != WP_LOCKBLOB_LAUNCHER && 86 87 ent->s.weapon != WP_FLAMER ) -
src/game/g_mover.c
r122 r0 1335 1335 vec3_t mins, maxs; 1336 1336 int i, best; 1337 1338 //TA: disable shootable doors 1339 // set all of the slaves as shootable 1340 //for( other = ent; other; other = other->teamchain ) 1341 // other->takedamage = qtrue; 1337 1342 1338 1343 // find the bounds of everything on the team … … 1708 1713 VectorClear( ent->s.apos.trDelta ); 1709 1714 1710 ent->s.powerups = (int)ent->animation[ 0 ]; //first frame1711 ent->s.weapon = abs( (int)ent->animation[ 1 ] ); //number of frames1715 ent->s.powerups = (int)ent->animation[ 0 ]; //first frame 1716 ent->s.weapon = abs( (int)ent->animation[ 1 ] ); //number of frames 1712 1717 1713 1718 //must be at least one frame -- mapper has forgotten animation key -
src/game/g_physics.c
r118 r0 63 63 { 64 64 VectorMA( trace->endpos, 0.5f, trace->plane.normal, trace->endpos ); // make sure it is off ground 65 // Never allow origin to be snapped lower (buildables fall through map bug) 66 trace->endpos[2] = (float)ceil(trace->endpos[2]); 67 SnapVector( trace->endpos ); 65 68 G_SetOrigin( ent, trace->endpos ); 66 69 ent->s.groundEntityNum = trace->entityNum; -
src/game/g_public.h
r122 r1 24 24 // g_public.h -- game module information visible to server 25 25 26 #define GAME_API_VERSION 926 #define GAME_API_VERSION 8 27 27 28 28 // entity->svFlags … … 32 32 #define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects 33 33 34 // TTimo 35 // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=551 34 36 #define SVF_CLIENTMASK 0x00000002 35 37 … … 114 116 G_CVAR_UPDATE, // ( vmCvar_t *vmCvar ); 115 117 G_CVAR_SET, // ( const char *var_name, const char *value ); 116 G_CVAR_VARIABLE_VALUE, // ( const char *var_name );117 118 G_CVAR_VARIABLE_INTEGER_VALUE, // ( const char *var_name ); 118 119 … … 253 254 GAME_RUN_FRAME, // ( int levelTime ); 254 255 255 GAME_CONSOLE_COMMAND ,// ( void );256 GAME_CONSOLE_COMMAND // ( void ); 256 257 // ConsoleCommand will be called when a command has been issued 257 258 // that is not recognized as a builtin function. 258 259 // The game can issue trap_argc() / trap_argv() commands to get the command 259 260 // and parameters. Return qfalse if the game doesn't recognize it as a command. 260 261 GAME_PING_OVERRIDE // ( void ), guid retrieved through trap_Argc and trap_Argv262 // returns 1 if the client overrides ping restrictions263 261 } gameExport_t; 264 262 -
src/game/g_session.c
r122 r1 75 75 char s[ MAX_STRING_CHARS ]; 76 76 const char *var; 77 78 // bk001205 - format 77 79 int teamLeader; 78 80 int spectatorState; … … 97 99 &client->sess.ignoreList.lo 98 100 ); 99 101 // bk001205 - format issues 100 102 client->sess.sessionTeam = (team_t)sessionTeam; 101 103 client->sess.restartTeam = (pTeam_t)restartTeam; … … 154 156 int i; 155 157 156 // FIXME: What's this for?158 //TA: ? 157 159 trap_Cvar_Set( "session", va( "%i", 0 ) ); 158 160 -
src/game/g_spawn.c
r122 r1 235 235 { "info_player_intermission", SP_info_player_intermission }, 236 236 237 //TA: extra bits 237 238 { "info_alien_intermission", SP_info_alien_intermission }, 238 239 { "info_human_intermission", SP_info_human_intermission }, -
src/game/g_svcmds.c
r122 r0 52 52 If 0, then only addresses matching the list will be allowed. This lets you easily set up a private game, or a game that only allows players from your local network. 53 53 54 For persistence, bans are stored in g_banIPs cvar MAX_CVAR_VALUE_STRING54 TTimo NOTE: for persistence, bans are stored in g_banIPs cvar MAX_CVAR_VALUE_STRING 55 55 The size of the cvar string buffer is limiting the banning to around 20 masks 56 56 this could be improved by putting some g_banIPs2 g_banIps3 etc. maybe … … 541 541 Q_strncpyz( layouts, s, sizeof( layouts ) ); 542 542 trap_Cvar_Set( "g_layouts", layouts ); 543 trap_SendConsoleCommand( EXEC_APPEND, " restartmap\n" );543 trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" ); 544 544 level.restarted = qtrue; 545 545 } … … 732 732 return qtrue; 733 733 } 734 else if( !Q_stricmp( cmd, "a" ) || !Q_stricmp( cmd, "say_admins" )) 735 { 736 G_Say( NULL, NULL, SAY_ADMINS, ConcatArgs( 1 ) ); 737 return qtrue; 738 } 734 739 735 G_Printf( "unknown command: %s\n", cmd ); 740 736 return qtrue; -
src/game/g_syscalls.c
r114 r0 111 111 } 112 112 113 float trap_Cvar_VariableValue( const char *var_name )114 {115 int temp;116 temp = syscall( G_CVAR_VARIABLE_VALUE, var_name );117 return (*(float*)&temp);118 }119 120 113 int trap_Cvar_VariableIntegerValue( const char *var_name ) 121 114 { -
src/game/g_team.c
r118 r0 146 146 147 147 Format: 148 clientNum location health armor weapon misc148 clientNum location health armor weapon powerups 149 149 150 150 ================== … … 196 196 197 197 Com_sprintf( entry, sizeof( entry ), 198 " %i %i %i %i %i", 198 " %i %i %i %i %i %i", 199 // level.sortedClients[i], player->client->pers.teamState.location, h, a, 199 200 i, player->client->pers.teamState.location, h, a, 200 player->client->ps.weapon );201 player->client->ps.weapon, player->s.powerups ); 201 202 202 203 j = strlen( entry ); -
src/game/g_trigger.c
r122 r0 1100 1100 1101 1101 BG_FindAmmoForWeapon( other->client->ps.weapon, &maxAmmo, &maxClips ); 1102 BG_UnpackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, &ammo, &clips ); 1102 BG_UnpackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, 1103 &ammo, &clips ); 1103 1104 1104 1105 if( ( ammo + self->damage ) > maxAmmo ) … … 1115 1116 ammo += self->damage; 1116 1117 1117 BG_PackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, ammo, clips ); 1118 BG_PackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, 1119 ammo, clips ); 1118 1120 } 1119 1121 -
src/game/g_utils.c
r122 r0 123 123 } 124 124 125 //TA: added ParticleSystemIndex 125 126 int G_ParticleSystemIndex( char *name ) 126 127 { … … 128 129 } 129 130 131 //TA: added ShaderIndex 130 132 int G_ShaderIndex( char *name ) 131 133 { … … 163 165 if( level.clients[ i ].pers.teamSelection == team || 164 166 ( level.clients[ i ].pers.teamSelection == PTE_NONE && 165 G_admin_permission( &g_entities[ i ], ADMF_SPEC_ALLCHAT ) ) || 166 ( level.clients[ i ].pers.teamSelection == PTE_NONE && 167 level.clients[ i ].sess.spectatorState == SPECTATOR_FOLLOW && 168 level.clients[ i ].sess.spectatorClient >= 0 && 169 level.clients[ level.clients[ i ].sess.spectatorClient ].pers.teamSelection == team ) ) 167 G_admin_permission( &g_entities[ i ], ADMF_SPEC_ALLCHAT ) ) ) 170 168 trap_SendServerCommand( i, cmd ); 171 169 } … … 596 594 continue; 597 595 598 // impossible to telefrag self596 //TA: impossible to telefrag self 599 597 if( ent == hit ) 600 598 continue; … … 740 738 741 739 VectorCopy( origin, ent->r.currentOrigin ); 742 VectorCopy( origin, ent->s.origin ); 743 } 744 745 // from quakestyle.telefragged.com740 VectorCopy( origin, ent->s.origin ); //TA: if shit breaks - blame this line 741 } 742 743 //TA: from quakestyle.telefragged.com 746 744 // (NOBODY): Code helper function 747 745 // -
src/game/g_weapon.c
r122 r1 43 43 ent->client->ps.pm_flags |= PMF_WEAPON_SWITCH; 44 44 45 if( weapon == WP_NONE ||46 !BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ))45 if( weapon == WP_NONE 46 || !BG_InventoryContainsWeapon( weapon, ent->client->ps.stats )) 47 47 { 48 48 //switch to the first non blaster weapon … … 65 65 else 66 66 ent->client->ps.persistant[ PERS_NEWWEAPON ] = weapon; 67 68 // force this here to prevent flamer effect from continuing 67 68 // force this here to prevent flamer effect from continuing 69 69 ent->client->ps.generic1 = WPM_NOTFIRING; 70 70 … … 100 100 if( buyingEnergyAmmo ) 101 101 { 102 ent->client->jetpack_power = g_jetpackLimit.integer;103 104 102 G_AddEvent( ent, EV_RPTUSE_SOUND, 0 ); 105 103 … … 108 106 } 109 107 110 BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, maxAmmo, maxClips ); 108 BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, 109 maxAmmo, maxClips ); 111 110 112 111 restoredAmmo = qtrue; … … 134 133 VectorNormalize(newv); 135 134 VectorMA(impact, 8192, newv, endout); 136 }137 138 /*139 ================140 G_WideTrace141 142 Trace a bounding box against entities, but not the world143 Also check there is a line of sight between the start and end point144 ================145 */146 static void G_WideTrace( trace_t *tr, gentity_t *ent, float range, float width, gentity_t **target )147 {148 vec3_t mins, maxs;149 vec3_t end;150 151 VectorSet( mins, -width, -width, -width );152 VectorSet( maxs, width, width, width );153 154 *target = NULL;155 156 if( !ent->client )157 return;158 159 // Set aiming directions160 AngleVectors( ent->client->ps.viewangles, forward, right, up );161 CalcMuzzlePoint( ent, forward, right, up, muzzle );162 VectorMA( muzzle, range, forward, end );163 164 G_UnlaggedOn( muzzle, range );165 166 // Trace against entities167 trap_Trace( tr, muzzle, mins, maxs, end, ent->s.number, CONTENTS_BODY );168 if( tr->entityNum != ENTITYNUM_NONE )169 {170 *target = &g_entities[ tr->entityNum ];171 172 // Set range to the trace length plus the width, so that the end of the173 // LOS trace is close to the exterior of the target's bounding box174 range = Distance( muzzle, tr->endpos ) + width;175 VectorMA( muzzle, range, forward, end );176 177 // Trace for line of sight against the world178 trap_Trace( tr, muzzle, NULL, NULL, end, 0, CONTENTS_SOLID );179 if( tr->fraction < 1.0f )180 *target = NULL;181 }182 183 G_UnlaggedOff( );184 135 } 185 136 … … 215 166 { 216 167 trace_t tr; 168 vec3_t end; 217 169 gentity_t *tent; 218 170 gentity_t *traceEnt; 219 220 G_WideTrace( &tr, ent, range, width, &traceEnt ); 221 222 if( traceEnt == NULL ) 171 vec3_t mins, maxs; 172 173 VectorSet( mins, -width, -width, -width ); 174 VectorSet( maxs, width, width, width ); 175 176 // set aiming directions 177 AngleVectors( ent->client->ps.viewangles, forward, right, up ); 178 179 CalcMuzzlePoint( ent, forward, right, up, muzzle ); 180 181 VectorMA( muzzle, range, forward, end ); 182 183 G_UnlaggedOn( muzzle, range ); 184 trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); 185 G_UnlaggedOff( ); 186 187 if( tr.surfaceFlags & SURF_NOIMPACT ) 223 188 return; 189 190 traceEnt = &g_entities[ tr.entityNum ]; 224 191 225 192 // send blood impact … … 802 769 BG_FindBuildDelayForWeapon( ent->s.weapon ) * 2; 803 770 } 804 else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && 805 G_IsPowered( muzzle ) == BA_NONE && 806 ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) != BA_H_REPEATER ) //hack 771 else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && !G_IsPowered( muzzle ) && 772 ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) != BA_H_REPEATER ) //hack 807 773 { 808 774 ent->client->ps.stats[ STAT_MISC ] += … … 851 817 { 852 818 trace_t tr; 819 vec3_t end; 853 820 gentity_t *tent; 854 821 gentity_t *traceEnt; 822 vec3_t mins, maxs; 855 823 int damage = LEVEL0_BITE_DMG; 856 824 857 G_WideTrace( &tr, ent, LEVEL0_BITE_RANGE, LEVEL0_BITE_WIDTH, &traceEnt ); 858 859 if( traceEnt == NULL ) 825 VectorSet( mins, -LEVEL0_BITE_WIDTH, -LEVEL0_BITE_WIDTH, -LEVEL0_BITE_WIDTH ); 826 VectorSet( maxs, LEVEL0_BITE_WIDTH, LEVEL0_BITE_WIDTH, LEVEL0_BITE_WIDTH ); 827 828 // set aiming directions 829 AngleVectors( ent->client->ps.viewangles, forward, right, up ); 830 831 CalcMuzzlePoint( ent, forward, right, up, muzzle ); 832 833 VectorMA( muzzle, LEVEL0_BITE_RANGE, forward, end ); 834 835 G_UnlaggedOn( muzzle, LEVEL0_BITE_RANGE ); 836 trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); 837 G_UnlaggedOff( ); 838 839 if( tr.surfaceFlags & SURF_NOIMPACT ) 860 840 return qfalse; 841 842 traceEnt = &g_entities[ tr.entityNum ]; 861 843 862 844 if( !traceEnt->takedamage ) … … 1267 1249 { 1268 1250 trace_t tr; 1251 vec3_t end; 1269 1252 gentity_t *traceEnt; 1270 1271 G_WideTrace( &tr, ent, LEVEL2_AREAZAP_RANGE, LEVEL2_AREAZAP_WIDTH, &traceEnt ); 1272 1273 if( traceEnt == NULL ) 1253 vec3_t mins, maxs; 1254 1255 VectorSet( mins, -LEVEL2_AREAZAP_WIDTH, -LEVEL2_AREAZAP_WIDTH, -LEVEL2_AREAZAP_WIDTH ); 1256 VectorSet( maxs, LEVEL2_AREAZAP_WIDTH, LEVEL2_AREAZAP_WIDTH, LEVEL2_AREAZAP_WIDTH ); 1257 1258 // set aiming directions 1259 AngleVectors( ent->client->ps.viewangles, forward, right, up ); 1260 1261 CalcMuzzlePoint( ent, forward, right, up, muzzle ); 1262 1263 VectorMA( muzzle, LEVEL2_AREAZAP_RANGE, forward, end ); 1264 1265 G_UnlaggedOn( muzzle, LEVEL2_AREAZAP_RANGE ); 1266 trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); 1267 G_UnlaggedOff( ); 1268 1269 if( tr.surfaceFlags & SURF_NOIMPACT ) 1274 1270 return; 1271 1272 traceEnt = &g_entities[ tr.entityNum ]; 1275 1273 1276 1274 if( ( ( traceEnt->client && traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) || … … 1299 1297 { 1300 1298 trace_t tr; 1299 vec3_t end; 1301 1300 gentity_t *tent; 1302 1301 gentity_t *traceEnt; 1303 1302 int damage; 1303 vec3_t mins, maxs; 1304 1305 VectorSet( mins, -LEVEL3_POUNCE_WIDTH, -LEVEL3_POUNCE_WIDTH, -LEVEL3_POUNCE_WIDTH ); 1306 VectorSet( maxs, LEVEL3_POUNCE_WIDTH, LEVEL3_POUNCE_WIDTH, LEVEL3_POUNCE_WIDTH ); 1304 1307 1305 1308 if( ent->client->ps.groundEntityNum != ENTITYNUM_NONE ) … … 1315 1318 return qfalse; 1316 1319 1317 G_WideTrace( &tr, ent, LEVEL3_POUNCE_RANGE, LEVEL3_POUNCE_WIDTH, &traceEnt ); 1318 1319 if( traceEnt == NULL ) 1320 // set aiming directions 1321 AngleVectors( ent->client->ps.viewangles, forward, right, up ); 1322 1323 CalcMuzzlePoint( ent, forward, right, up, muzzle ); 1324 1325 VectorMA( muzzle, LEVEL3_POUNCE_RANGE, forward, end ); 1326 1327 G_UnlaggedOn( muzzle, LEVEL3_POUNCE_RANGE ); 1328 trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT ); 1329 G_UnlaggedOff( ); 1330 1331 //miss 1332 if( tr.fraction >= 1.0 ) 1320 1333 return qfalse; 1334 1335 if( tr.surfaceFlags & SURF_NOIMPACT ) 1336 return qfalse; 1337 1338 traceEnt = &g_entities[ tr.entityNum ]; 1321 1339 1322 1340 // send blood impact … … 1412 1430 void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ) 1413 1431 { 1414 vec3_t normal;1415 1416 1432 VectorCopy( ent->s.pos.trBase, muzzlePoint ); 1417 BG_GetClientNormal( &ent->client->ps, normal ); 1418 VectorMA( muzzlePoint, ent->client->ps.viewheight, normal, muzzlePoint ); 1433 muzzlePoint[ 2 ] += ent->client->ps.viewheight; 1419 1434 VectorMA( muzzlePoint, 1, forward, muzzlePoint ); 1435 VectorMA( muzzlePoint, 1, right, muzzlePoint ); 1420 1436 // snap to integer coordinates for more efficient network bandwidth usage 1421 1437 SnapVector( muzzlePoint ); -
src/qcommon/cmd.c
r63 r0 39 39 byte cmd_text_buf[MAX_CMD_BUFFER]; 40 40 41 42 43 // Delay stuff44 45 #define MAX_DELAYED_COMMANDS 6446 #define CMD_DELAY_FRAME_FIRE 147 #define CMD_DELAY_UNUSED 048 49 typedef enum50 {51 CMD_DELAY_MSEC,52 CMD_DELAY_FRAME53 } cmdDelayType_t;54 55 typedef struct56 {57 char text[MAX_CMD_LINE];58 int delay;59 cmdDelayType_t type;60 } delayed_cmd_s;61 62 delayed_cmd_s delayed_cmd[MAX_DELAYED_COMMANDS];63 41 64 42 //============================================================================= … … 246 224 247 225 248 249 /*250 ==============================================================================251 252 COMMANDS DELAYING253 254 ==============================================================================255 */256 257 258 /*259 ===============260 Cdelay_Frame261 ===============262 */263 264 void Cdelay_Frame( void ) {265 int i;266 int sys_time = Sys_Milliseconds();267 qboolean run_it;268 269 for(i=0; (i<MAX_DELAYED_COMMANDS); i++)270 {271 run_it = qfalse;272 273 if(delayed_cmd[i].delay == CMD_DELAY_UNUSED)274 continue;275 276 //check if we should run the command (both type)277 if(delayed_cmd[i].type == CMD_DELAY_MSEC && delayed_cmd[i].delay < sys_time)278 {279 run_it = qtrue;280 } else if(delayed_cmd[i].type == CMD_DELAY_FRAME)281 {282 delayed_cmd[i].delay --;283 if(delayed_cmd[i].delay == CMD_DELAY_FRAME_FIRE)284 run_it = qtrue;285 }286 287 if(run_it)288 {289 delayed_cmd[i].delay = CMD_DELAY_UNUSED;290 Cbuf_ExecuteText(EXEC_NOW, delayed_cmd[i].text);291 }292 }293 }294 295 296 297 298 226 /* 299 227 ============================================================================== … … 314 242 int len; 315 243 char filename[MAX_QPATH]; 316 int i; 317 318 if (Cmd_Argc () < 2) { 319 Com_Printf ("exec <filename> (args) : execute a script file\n"); 244 245 if (Cmd_Argc () != 2) { 246 Com_Printf ("exec <filename> : execute a script file\n"); 320 247 return; 321 248 } … … 330 257 Com_Printf ("execing %s\n",Cmd_Argv(1)); 331 258 332 Cvar_Get( "arg_all", "", CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED );333 Cvar_Set( "arg_all", Cmd_ArgsFrom( 2 ) );334 Cvar_Get( "arg_count", "", CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED );335 Cvar_Set( "arg_count", va( "%i", Cmd_Argc() - 2 ) );336 337 for (i = Cmd_Argc() - 2; i; i--)338 {339 Cvar_Get( va( "arg_%i", i ), "", CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED );340 Cvar_Set( va( "arg_%i", i ), Cmd_Argv( i + 1 ) );341 }342 343 259 Cbuf_InsertText (f); 344 260 … … 366 282 } 367 283 368 /* 369 =============== 370 Cmd_If_f 371 372 Compares two cvars, if true vstr the third, if false vstr the forth 373 =============== 374 */ 375 void Cmd_If_f( void ) { 376 char *v; 377 int v1; 378 int v2; 379 char *vt; 380 char *vf; 381 char *op; 382 383 if ( (Cmd_Argc () == 6 ) || (Cmd_Argc () == 5) ) { 384 v1 = Cvar_VariableIntegerValue( Cmd_Argv( 1 ) ); 385 op = Cmd_Argv( 2 ); 386 v2 = Cvar_VariableIntegerValue( Cmd_Argv( 3 ) ); 387 vt = Cmd_Argv( 4 ); 388 if ( ( !strcmp( op, "=" ) && v1 == v2 ) || 389 ( !strcmp( op, "!=" ) && v1 != v2 ) || 390 ( !strcmp( op, "<" ) && v1 < v2 ) || 391 ( !strcmp( op, "<=" ) && v1 <= v2 ) || 392 ( !strcmp( op, ">" ) && v1 > v2 ) || 393 ( !strcmp( op, ">=" ) && v1 >= v2 ) ) 394 { 395 v = vt; 396 Com_Printf(va("then\n")); 397 } 398 else if ( ( !strcmp( op, "=" ) && v1 != v2 ) || 399 ( !strcmp( op, "!=" ) && v1 == v2 ) || 400 ( !strcmp( op, "<" ) && v1 >= v2 ) || 401 ( !strcmp( op, "<=" ) && v1 > v2 ) || 402 ( !strcmp( op, ">" ) && v1 <= v2 ) || 403 ( !strcmp( op, ">=" ) && v1 < v2 ) ) 404 { 405 if ( Cmd_Argc () == 6 ) 406 { 407 vf = Cmd_Argv( 5 ); 408 v = vf; 409 } 410 else 411 { 412 return; 413 } 414 } 415 else 416 { 417 Com_Printf ("invalid operator in if command. valid operators are = != < > >= <=\n"); 418 return; 419 } 420 } 421 else { 422 Com_Printf ("if <variable1> <operator> <variable2> <variablethen> (<variableelse>) : compares the first two variables and executes <variablethen> if true, <variableelse> if false\n"); 423 return; 424 } 425 Cbuf_InsertText( va("%s\n", v ) ); 426 } 427 428 /* 429 =============== 430 Cmd_Math_f 431 432 Compares two cvars, if true vstr the third, if false vstr the forth 433 =============== 434 */ 435 void Cmd_Math_f( void ) { 436 char *v; 437 char *v1; 438 char *v2; 439 char *op; 440 if (Cmd_Argc () == 3) 441 { 442 v = Cmd_Argv( 1 ); 443 op = Cmd_Argv( 2 ); 444 if ( !strcmp( op, "++" ) ) 445 { 446 Cvar_SetValue( v, ( Cvar_VariableValue( v ) + 1 ) ); 447 } 448 else if ( !strcmp( op, "--" ) ) 449 { 450 Cvar_SetValue( v, ( Cvar_VariableValue( v ) - 1 ) ); 451 } 452 else 453 { 454 Com_Printf ("math <variableToSet> = <variable1> <operator> <variable2>\nmath <variableToSet> <operator> <variable1>\nmath <variableToSet> ++\nmath <variableToSet> --\nvalid operators are + - * / \n"); 455 return; 456 } 457 } 458 else if (Cmd_Argc () == 4) 459 { 460 v = Cmd_Argv( 1 ); 461 op = Cmd_Argv( 2 ); 462 v1 = Cmd_Argv( 3 ); 463 if ( !strcmp( op, "+" ) ) 464 { 465 Cvar_SetValue( v, ( Cvar_VariableValue( v ) + Cvar_VariableValue( v1 ) ) ); 466 } 467 else if ( !strcmp( op, "-" ) ) 468 { 469 Cvar_SetValue( v, ( Cvar_VariableValue( v ) - Cvar_VariableValue( v1 ) ) ); 470 } 471 else if ( !strcmp( op, "*" ) ) 472 { 473 Cvar_SetValue( v, ( Cvar_VariableValue( v ) * Cvar_VariableValue( v1 ) ) ); 474 } 475 else if ( !strcmp( op, "/" ) ) 476 { 477 if ( ! ( Cvar_VariableValue( v1 ) == 0 ) ) 478 { 479 Cvar_SetValue( v, ( Cvar_VariableValue( v ) / Cvar_VariableValue( v1 ) ) ); 480 } 481 } 482 else 483 { 484 Com_Printf ("math <variableToSet> = <variable1> <operator> <variable2>\nmath <variableToSet> <operator> <variable1>\nmath <variableToSet> ++\nmath <variableToSet> --\nvalid operators are + - * / \n"); 485 return; 486 } 487 } 488 else if (Cmd_Argc () == 6) 489 { 490 v = Cmd_Argv( 1 ); 491 v1 = Cmd_Argv( 3 ); 492 op = Cmd_Argv( 4 ); 493 v2 = Cmd_Argv( 5 ); 494 if ( !strcmp( op, "+" ) ) 495 { 496 Cvar_SetValue( v, ( Cvar_VariableValue( v1 ) + Cvar_VariableValue( v2 ) ) ); 497 } 498 else if ( !strcmp( op, "-" ) ) 499 { 500 Cvar_SetValue( v, ( Cvar_VariableValue( v1 ) - Cvar_VariableValue( v2 ) ) ); 501 } 502 else if ( !strcmp( op, "*" ) ) 503 { 504 Cvar_SetValue( v, ( Cvar_VariableValue( v1 ) * Cvar_VariableValue( v2 ) ) ); 505 } 506 else if ( !strcmp( op, "/" ) ) 507 { 508 if ( ! ( Cvar_VariableValue( v2 ) == 0 ) ) 509 { 510 Cvar_SetValue( v, ( Cvar_VariableValue( v1 ) / Cvar_VariableValue( v2 ) ) ); 511 } 512 } 513 else 514 { 515 Com_Printf ("math <variableToSet> = <variable1> <operator> <variable2>\nmath <variableToSet> <operator> <variable1>\nmath <variableToSet> ++\nmath <variableToSet> --\nvalid operators are + - * / \n"); 516 return; 517 } 518 } 519 else { 520 Com_Printf ("math <variableToSet> = <variable1> <operator> <variable2>\nmath <variableToSet> <operator> <variable1>\nmath <variableToSet> ++\nmath <variableToSet> --\nvalid operators are + - * / \n"); 521 return; 522 } 523 } 524 525 /* 526 =============== 527 Cmd_Concat_f 528 529 concatenates two cvars together 530 =============== 531 */ 532 void Cmd_Concat_f( void ) { 533 char *v; 534 char *v1; 535 char *v2; 536 char vc[MAX_CVAR_VALUE_STRING]; 537 if (Cmd_Argc () != 4) { 538 Com_Printf ("concat <variableToSet> <variable1> <variable2> : concatenates variable1 and variable2 and sets the result to variableToSet\n"); 539 return; 540 } 541 542 v = Cmd_Argv( 1 ); 543 v1 = Cvar_VariableString( Cmd_Argv( 2 ) ); 544 v2 = Cvar_VariableString( Cmd_Argv( 3 ) ); 545 Com_sprintf(vc, sizeof(vc),"%s%s",v1,v2); 546 Cvar_Set( v, vc ); 547 } 548 549 // 284 550 285 /* 551 286 =============== … … 562 297 Com_Printf ("%s ",Cmd_Argv(i)); 563 298 Com_Printf ("\n"); 564 }565 566 567 /*568 ===============569 Cmd_Delay_f570 571 Delays a comand572 ===============573 */574 void Cmd_Delay_f (void)575 {576 int i, delay, type;577 char *raw_delay;578 qboolean availiable_cmd = qfalse;579 580 // Check if the call is valid581 if(Cmd_Argc () < 2)582 {583 Com_Printf ("delay <delay in milliseconds> <command> or delay <delay in frames>f <command>, excutes command after the delay");584 return;585 }586 587 raw_delay = Cmd_Argv(1);588 delay = atoi(raw_delay);589 590 if(delay < 1)591 {592 Com_Printf ("delay: the delay must be a positive integer");593 return;594 }595 596 //search for an unused slot597 for(i=0; (i<MAX_DELAYED_COMMANDS); i++)598 {599 if(delayed_cmd[i].delay == CMD_DELAY_UNUSED)600 {601 availiable_cmd = qtrue;602 break;603 }604 }605 606 if(!availiable_cmd)607 {608 Com_Printf ("WARNING: Maximum amount of delayed commands reached.");609 return;610 }611 612 int lastchar = strlen( raw_delay ) - 1;613 614 if(raw_delay[ lastchar ] == 'f' )615 {616 delay += CMD_DELAY_FRAME_FIRE;617 type = CMD_DELAY_FRAME;618 }else{619 type = CMD_DELAY_MSEC;620 delay += Sys_Milliseconds();621 }622 623 delayed_cmd[i].delay = delay;624 delayed_cmd[i].type = type;625 Q_strncpyz(delayed_cmd[i].text, Cmd_ArgsFrom(2), MAX_CMD_LINE);626 299 } 627 300 … … 805 478 // NOTE TTimo define that to track tokenization issues 806 479 //#define TKN_DBG 807 static void Cmd_TokenizeString2( const char *text_in, qboolean ignoreQuotes , qboolean parseCvar) {808 c har *text;480 static void Cmd_TokenizeString2( const char *text_in, qboolean ignoreQuotes ) { 481 const char *text; 809 482 char *textOut; 810 const char *cvarName;811 char buffer[ BIG_INFO_STRING ];812 483 813 484 #ifdef TKN_DBG … … 824 495 } 825 496 826 // parse for cvar substitution 827 if ( parseCvar ) 828 { 829 Q_strncpyz( buffer, text_in, sizeof( buffer ) ); 830 text = buffer; 831 textOut = cmd.cmd; 832 while ( *text ) 833 { 834 if ( text[0] != '\'' || text[1] != '#' ) 835 { 836 if ( textOut == sizeof(cmd.cmd) + cmd.cmd - 1 ) 837 break; 838 *textOut++ = *text++; 839 continue; 840 } 841 text += 2; 842 cvarName = text; 843 while ( *text && *text != '\'' ) 844 text++; 845 if ( *text == '\'' ) 846 { 847 *text = 0; 848 if ( Cvar_Flags( cvarName ) != CVAR_NONEXISTENT ) 849 { 850 Q_strncpyz( textOut, Cvar_VariableString( cvarName ), sizeof(cmd.cmd) - ( textOut - cmd.cmd ) ); 851 while ( *textOut ) 852 textOut++; 853 if ( textOut == sizeof(cmd.cmd) + cmd.cmd - 1 ) 854 break; 855 } 856 else 857 { 858 cvarName -= 2; 859 while ( *cvarName++ && textOut < sizeof(cmd.cmd) + cmd.cmd - 1 ) 860 *textOut++ = *cvarName; 861 if ( textOut == sizeof(cmd.cmd) + cmd.cmd - 1 ) 862 break; 863 *textOut++ = '\''; 864 } 865 text++; 866 } 867 else 868 { 869 cvarName -= 2; 870 while ( *cvarName && textOut < sizeof(cmd.cmd) + cmd.cmd - 1 ) 871 *textOut++ = *cvarName++; 872 if ( textOut == sizeof(cmd.cmd) + cmd.cmd - 1 ) 873 break; 874 } 875 } 876 *textOut = 0; 877 } 878 else 879 Q_strncpyz( cmd.cmd, text_in, sizeof(cmd.cmd) ); 880 881 text = cmd.cmd; 497 Q_strncpyz( cmd.cmd, text_in, sizeof(cmd.cmd) ); 498 499 text = text_in; 882 500 textOut = cmd.tokenized; 883 501 … … 969 587 */ 970 588 void Cmd_TokenizeString( const char *text_in ) { 971 Cmd_TokenizeString2( text_in, qfalse , qfalse);589 Cmd_TokenizeString2( text_in, qfalse ); 972 590 } 973 591 … … 978 596 */ 979 597 void Cmd_TokenizeStringIgnoreQuotes( const char *text_in ) { 980 Cmd_TokenizeString2( text_in, qtrue, qfalse ); 981 } 982 983 /* 984 ============ 985 Cmd_TokenizeStringParseCvar 986 ============ 987 */ 988 void Cmd_TokenizeStringParseCvar( const char *text_in ) { 989 Cmd_TokenizeString2( text_in, qfalse, qtrue ); 598 Cmd_TokenizeString2( text_in, qtrue ); 990 599 } 991 600 … … 1070 679 1071 680 // execute the command line 1072 Cmd_TokenizeString ParseCvar( text );681 Cmd_TokenizeString( text ); 1073 682 if ( !Cmd_Argc() ) { 1074 683 return; // no tokens … … 1157 766 Cmd_AddCommand ("exec",Cmd_Exec_f); 1158 767 Cmd_AddCommand ("vstr",Cmd_Vstr_f); 1159 Cmd_AddCommand ("if",Cmd_If_f);1160 Cmd_AddCommand ("concat",Cmd_Concat_f);1161 Cmd_AddCommand ("math",Cmd_Math_f);1162 768 Cmd_AddCommand ("echo",Cmd_Echo_f); 1163 769 Cmd_AddCommand ("wait", Cmd_Wait_f); 1164 Cmd_AddCommand ("delay", Cmd_Delay_f); 1165 } 1166 770 } 771 -
src/qcommon/common.c
r62 r1 2372 2372 */ 2373 2373 void Com_Init( char *commandLine ) { 2374 char *s; 2374 2375 2375 2376 Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ ); … … 2478 2479 Cmd_AddCommand ("writeconfig", Com_WriteConfig_f ); 2479 2480 2480 com_version = Cvar_Get ("version", FULL_VERSION, CVAR_ROM | CVAR_SERVERINFO ); 2481 s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ ); 2482 com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO ); 2481 2483 2482 2484 Sys_Init(); … … 2694 2696 } while ( msec < minMsec ); 2695 2697 Cbuf_Execute (); 2696 Cdelay_Frame ();2697 2698 2698 2699 if (com_altivec->modified) -
src/qcommon/files.c
r40 r0 98 98 e.g. the qpath "sound/newstuff/test.wav" would be searched for in the following places: 99 99 100 home path + current game's zip files 100 101 home path + current game's directory 101 home path + current game's zip files102 base path + current game's zip files 102 103 base path + current game's directory 103 basepath + current game's zip files104 cd path + current game's zip files 104 105 cd path + current game's directory 105 cd path + current game's zip files 106 106 107 home path + base game's zip file 107 108 home path + base game's directory 108 home path + base game's zip file109 base path + base game's zip file 109 110 base path + base game's directory 110 basepath + base game's zip file111 cd path + base game's zip file 111 112 cd path + base game's directory 112 cd path + base game's zip file 113 113 114 home path + BASEGAME's zip file 114 115 home path + BASEGAME's directory 115 home path + BASEGAME's zip file116 base path + BASEGAME's zip file 116 117 base path + BASEGAME's directory 117 basepath + BASEGAME's zip file118 cd path + BASEGAME's zip file 118 119 cd path + BASEGAME's directory 119 cd path + BASEGAME's zip file120 120 121 121 server download, to be written to home path + current game's directory … … 2405 2405 Q_strncpyz( fs_gamedir, dir, sizeof( fs_gamedir ) ); 2406 2406 2407 // 2408 // add the directory to the search path 2409 // 2410 search = Z_Malloc (sizeof(searchpath_t)); 2411 search->dir = Z_Malloc( sizeof( *search->dir ) ); 2412 2413 Q_strncpyz( search->dir->path, path, sizeof( search->dir->path ) ); 2414 Q_strncpyz( search->dir->gamedir, dir, sizeof( search->dir->gamedir ) ); 2415 search->next = fs_searchpaths; 2416 fs_searchpaths = search; 2417 2407 2418 // find all pak files in this directory 2408 2419 pakfile = FS_BuildOSPath( path, dir, "" ); … … 2425 2436 fs_searchpaths = search; 2426 2437 } 2427 2428 //2429 // add the directory to the search path2430 //2431 search = Z_Malloc (sizeof(searchpath_t));2432 search->dir = Z_Malloc( sizeof( *search->dir ) );2433 2434 Q_strncpyz( search->dir->path, path, sizeof( search->dir->path ) );2435 Q_strncpyz( search->dir->gamedir, dir, sizeof( search->dir->gamedir ) );2436 search->next = fs_searchpaths;2437 fs_searchpaths = search;2438 2438 2439 2439 // done -
src/qcommon/q_shared.h
r122 r1 29 29 30 30 #define PRODUCT_NAME "tremulous" 31 32 #ifndef PRODUCT_VERSION 33 #define PRODUCT_VERSION "DnC-Eggy" 34 #endif 31 #define PRODUCT_VERSION "1.1.0" 35 32 36 33 #ifdef SVN_VERSION … … 42 39 #define CLIENT_WINDOW_TITLE "Tremulous " PRODUCT_VERSION 43 40 #define CLIENT_WINDOW_MIN_TITLE "Tremulous" 44 45 #define FULL_VERSION Q3_VERSION " " PLATFORM_STRING " " __DATE__46 41 47 42 #define MAX_TEAMNAME 32 … … 1323 1318 #define MAX_SERVERSTATUSREQUESTS 16 1324 1319 1325 #define SAY_ALL 0 1326 #define SAY_TEAM 1 1327 #define SAY_TELL 2 1328 #define SAY_ACTION 3 1329 #define SAY_ACTION_T 4 1330 #define SAY_ADMINS 5 1320 #define SAY_ALL 0 1321 #define SAY_TEAM 1 1322 #define SAY_TELL 2 1331 1323 1332 1324 #endif // __Q_SHARED_H -
src/qcommon/qcommon.h
r62 r1 365 365 // Do not call inside a command function, or current args will be destroyed. 366 366 367 void Cdelay_Frame (void);368 //Check if a delayed command have to be executed and decreases the remaining369 //delay time for all of them370 371 367 //=========================================================================== 372 368 … … 408 404 void Cmd_TokenizeString( const char *text ); 409 405 void Cmd_TokenizeStringIgnoreQuotes( const char *text_in ); 410 void Cmd_TokenizeStringParseCvar( const char *text_in );411 406 // Takes a null terminated string. Does not need to be /n terminated. 412 407 // breaks the string up into arg tokens. -
src/server/sv_ccmds.c
r54 r1 292 292 293 293 // add the map_restart command 294 SV_AddServerCommand( client, " restartmap\n" );294 SV_AddServerCommand( client, "map_restart\n" ); 295 295 296 296 // connect the client again, without the firstTime flag … … 732 732 Cmd_AddCommand ("systeminfo", SV_Systeminfo_f); 733 733 Cmd_AddCommand ("dumpuser", SV_DumpUser_f); 734 Cmd_AddCommand (" restartmap", SV_MapRestart_f);734 Cmd_AddCommand ("map_restart", SV_MapRestart_f); 735 735 Cmd_AddCommand ("sectorlist", SV_SectorList_f); 736 736 Cmd_AddCommand ("map", SV_Map_f); … … 758 758 Cmd_RemoveCommand ("systeminfo"); 759 759 Cmd_RemoveCommand ("dumpuser"); 760 Cmd_RemoveCommand (" restartmap");760 Cmd_RemoveCommand ("map_restart"); 761 761 Cmd_RemoveCommand ("sectorlist"); 762 762 Cmd_RemoveCommand ("say"); -
src/server/sv_client.c
r37 r0 170 170 svs.challenges[i].connected = qtrue; 171 171 172 // allow admins to override ping restrictions173 172 // never reject a LAN client based on ping 174 if ( !Sys_IsLANAddress( from ) && VM_Call( gvm, GAME_PING_OVERRIDE ) != 1 ) 175 { 176 if ( sv_minPing->value && ping < sv_minPing->value ) 177 { 173 if ( !Sys_IsLANAddress( from ) ) { 174 if ( sv_minPing->value && ping < sv_minPing->value ) { 178 175 // don't let them keep trying until they get a big delay 179 176 NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is for high pings only" ); … … 184 181 return; 185 182 } 186 if ( sv_maxPing->value && ping > sv_maxPing->value ) 187 { 183 if ( sv_maxPing->value && ping > sv_maxPing->value ) { 188 184 NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is for low pings only" ); 189 185 Com_DPrintf ("Client %i rejected on a too high ping\n", i); -
src/server/sv_main.c
r54 r1 295 295 void SV_MasterGameStat( const char *data ) 296 296 { 297 static netadr_t adr[MAX_MASTER_SERVERS]; 298 int i; 297 static netadr_t adr; 299 298 300 299 if( !com_dedicated || com_dedicated->integer != 2 ) 301 300 return; // only dedicated servers send stats 302 301 303 // send to group masters 304 for ( i = 0 ; i < MAX_MASTER_SERVERS ; i++ ) { 305 if ( !sv_master[i]->string[0] ) { 306 continue; 307 } 308 309 // see if we haven't already resolved the name 310 // resolving usually causes hitches on win95, so only 311 // do it when needed 312 if ( sv_master[i]->modified ) { 313 sv_master[i]->modified = qfalse; 314 315 Com_Printf( "Resolving %s\n", sv_master[i]->string ); 316 if ( !NET_StringToAdr( sv_master[i]->string, &adr[i] ) ) { 317 Com_Printf( "Couldn't resolve address: %s\n", sv_master[i]->string ); 318 continue; 319 } 320 if ( !strchr( sv_master[i]->string, ':' ) ) { 321 adr[i].port = BigShort( PORT_MASTER ); 322 } 323 Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", sv_master[i]->string, 324 adr[i].ip[0], adr[i].ip[1], adr[i].ip[2], adr[i].ip[3], 325 BigShort( adr[i].port ) ); 326 } 327 328 329 Com_Printf ("Sending gamestat to %s\n", sv_master[i]->string ); 330 // this command should be changed if the server info / status format 331 // ever incompatably changes 332 NET_OutOfBandPrint( NS_SERVER, adr[i], "gamestat %s\n", data ); 302 Com_Printf( "Resolving %s\n", MASTER_SERVER_NAME ); 303 if( !NET_StringToAdr( MASTER_SERVER_NAME, &adr ) ) 304 { 305 Com_Printf( "Couldn't resolve address: %s\n", MASTER_SERVER_NAME ); 306 return; 333 307 } 308 else 309 { 310 if( !strstr( ":", MASTER_SERVER_NAME ) ) 311 adr.port = BigShort( PORT_MASTER ); 312 313 Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", MASTER_SERVER_NAME, 314 adr.ip[0], adr.ip[1], adr.ip[2], adr.ip[3], 315 BigShort( adr.port ) ); 316 } 317 318 Com_Printf ("Sending gamestat to %s\n", MASTER_SERVER_NAME ); 319 NET_OutOfBandPrint( NS_SERVER, adr, "gamestat %s", data ); 334 320 } 335 321 … … 852 838 if( sv.restartTime && sv.time >= sv.restartTime ) { 853 839 sv.restartTime = 0; 854 Cbuf_AddText( " restartmap0\n" );840 Cbuf_AddText( "map_restart 0\n" ); 855 841 return; 856 842 } -
src/ui/ui_local.h
r118 r0 128 128 extern vmCvar_t ui_smallFont; 129 129 extern vmCvar_t ui_bigFont; 130 extern vmCvar_t ui_serverStatusTimeOut; 131 130 extern vmCvar_t ui_serverStatusTimeOut; 131 132 //TA: bank values 133 extern vmCvar_t ui_bank; 132 134 133 135 … … 745 747 } modInfo_t; 746 748 749 //TA: tremulous menus 750 #define MAX_INFOPANE_TEXT 4096 751 #define MAX_INFOPANE_GRAPHICS 16 752 #define MAX_INFOPANES 128 753 747 754 typedef enum 748 755 { 749 INFOTYPE_TEXT, 750 INFOTYPE_BUILDABLE, 751 INFOTYPE_CLASS, 752 INFOTYPE_WEAPON, 753 INFOTYPE_UPGRADE 754 } infoType_t; 756 INFOPANE_TOP, 757 INFOPANE_BOTTOM, 758 INFOPANE_LEFT, 759 INFOPANE_RIGHT 760 } tremIPSide_t; 755 761 756 762 typedef struct 757 763 { 758 const char *text; 759 const char *cmd; 760 infoType_t type; 761 union 762 { 763 const char *text; 764 buildable_t buildable; 765 pClass_t pclass; 766 weapon_t weapon; 767 upgrade_t upgrade; 768 } v; 769 } menuItem_t; 764 qhandle_t graphic; 765 766 tremIPSide_t side; 767 int offset; 768 769 int width, height; 770 } tremIPGraphic_t; 771 772 typedef struct 773 { 774 const char *name; 775 char text[ MAX_INFOPANE_TEXT ]; 776 int align; 777 778 tremIPGraphic_t graphics[ MAX_INFOPANE_GRAPHICS ]; 779 int numGraphics; 780 } tremInfoPane_t; 781 782 typedef struct 783 { 784 const char *text; 785 const char *cmd; 786 tremInfoPane_t *infopane; 787 } tremMenuItem_t; 788 //TA: tremulous menus 770 789 771 790 typedef struct { … … 834 853 int previewMovie; 835 854 836 menuItem_t tremTeamList[ 4 ]; 837 int tremTeamCount; 838 int tremTeamIndex; 839 840 menuItem_t alienClassList[ 3 ]; 841 int alienClassCount; 842 int alienClassIndex; 843 844 menuItem_t humanItemList[ 3 ]; 845 int humanItemCount; 846 int humanItemIndex; 847 848 menuItem_t humanArmouryBuyList[ 32 ]; 849 int humanArmouryBuyCount; 850 int humanArmouryBuyIndex; 851 852 menuItem_t humanArmourySellList[ 32 ]; 853 int humanArmourySellCount; 854 int humanArmourySellIndex; 855 856 menuItem_t alienUpgradeList[ 16 ]; 857 int alienUpgradeCount; 858 int alienUpgradeIndex; 859 860 menuItem_t alienBuildList[ 32 ]; 861 int alienBuildCount; 862 int alienBuildIndex; 863 864 menuItem_t humanBuildList[ 32 ]; 865 int humanBuildCount; 866 int humanBuildIndex; 855 tremInfoPane_t tremInfoPanes[ MAX_INFOPANES ]; 856 int tremInfoPaneCount; 857 858 //TA: tremulous menus 859 tremMenuItem_t tremTeamList[ 4 ]; 860 int tremTeamCount; 861 int tremTeamIndex; 862 863 tremMenuItem_t tremAlienClassList[ 3 ]; 864 int tremAlienClassCount; 865 int tremAlienClassIndex; 866 867 tremMenuItem_t tremHumanItemList[ 3 ]; 868 int tremHumanItemCount; 869 int tremHumanItemIndex; 870 871 tremMenuItem_t tremHumanArmouryBuyList[ 32 ]; 872 int tremHumanArmouryBuyCount; 873 int tremHumanArmouryBuyIndex; 874 875 tremMenuItem_t tremHumanArmourySellList[ 32 ]; 876 int tremHumanArmourySellCount; 877 int tremHumanArmourySellIndex; 878 879 tremMenuItem_t tremAlienUpgradeList[ 16 ]; 880 int tremAlienUpgradeCount; 881 int tremAlienUpgradeIndex; 882 883 tremMenuItem_t tremAlienBuildList[ 32 ]; 884 int tremAlienBuildCount; 885 int tremAlienBuildIndex; 886 887 tremMenuItem_t tremHumanBuildList[ 32 ]; 888 int tremHumanBuildCount; 889 int tremHumanBuildIndex; 890 //TA: tremulous menus 867 891 868 892 serverStatus_t serverStatus; -
src/ui/ui_main.c
r122 r1 291 291 glyphInfo_t *glyph; 292 292 float useScale; 293 const char *s = text; 293 const char *s = text; // bk001206 - unsigned 294 294 fontInfo_t *font = &uiInfo.uiDC.Assets.textFont; 295 295 if (scale <= ui_smallFont.value) { … … 344 344 useScale = scale * font->glyphScale; 345 345 if (text) { 346 const char *s = text; 346 const char *s = text; // bk001206 - unsigned 347 347 trap_R_SetColor( color ); 348 348 memcpy(&newColor[0], &color[0], sizeof(vec4_t)); … … 470 470 useScale = scale * font->glyphScale; 471 471 if (text) { 472 const char *s = text; 472 const char *s = text; // bk001206 - unsigned 473 473 trap_R_SetColor( color ); 474 474 memcpy(&newColor[0], &color[0], sizeof(vec4_t)); … … 478 478 } 479 479 count = 0; 480 glyph2 = &font->glyphs[ (int) cursor]; 480 glyph2 = &font->glyphs[ (int) cursor]; // bk001206 - possible signed char 481 481 while (s && *s && count < len) { 482 482 glyph = &font->glyphs[(int)*s]; … … 617 617 glyphInfo_t *glyph; 618 618 if (text) { 619 const char *s = text; 619 const char *s = text; // bk001206 - unsigned 620 620 float max = *maxX; 621 621 float useScale; … … 737 737 UI_SetColor( NULL ); 738 738 739 // don't draw the cursor whilst loading739 //TA: don't draw the cursor whilst loading 740 740 if( Menu_Count( ) > 0 && !trap_Cvar_VariableValue( "ui_loading" ) ) 741 741 UI_DrawHandlePic( uiInfo.uiDC.cursorx-16, uiInfo.uiDC.cursory-16, 32, 32, uiInfo.uiDC.Assets.cursor); … … 998 998 } 999 999 trap_Parse_FreeSource(handle); 1000 } 1001 1002 /* 1003 =============== 1004 UI_FindInfoPaneByName 1005 =============== 1006 */ 1007 tremInfoPane_t *UI_FindInfoPaneByName( const char *name ) 1008 { 1009 int i; 1010 1011 for( i = 0; i < uiInfo.tremInfoPaneCount; i++ ) 1012 { 1013 if( !Q_stricmp( uiInfo.tremInfoPanes[ i ].name, name ) ) 1014 return &uiInfo.tremInfoPanes[ i ]; 1015 } 1016 1017 //create a dummy infopane demanding the user write the infopane 1018 uiInfo.tremInfoPanes[ i ].name = String_Alloc( name ); 1019 strncpy( uiInfo.tremInfoPanes[ i ].text, "Not implemented.\n\nui/infopanes.def\n", MAX_INFOPANE_TEXT ); 1020 Q_strcat( uiInfo.tremInfoPanes[ i ].text, MAX_INFOPANE_TEXT, String_Alloc( name ) ); 1021 1022 uiInfo.tremInfoPaneCount++; 1023 1024 return &uiInfo.tremInfoPanes[ i ]; 1025 } 1026 1027 /* 1028 =============== 1029 UI_LoadInfoPane 1030 =============== 1031 */ 1032 qboolean UI_LoadInfoPane( int handle ) 1033 { 1034 pc_token_t token; 1035 qboolean valid = qfalse; 1036 1037 while( 1 ) 1038 { 1039 memset( &token, 0, sizeof( pc_token_t ) ); 1040 1041 if( !trap_Parse_ReadToken( handle, &token ) ) 1042 break; 1043 1044 if( !Q_stricmp( token.string, "name" ) ) 1045 { 1046 memset( &token, 0, sizeof( pc_token_t ) ); 1047 1048 if( !trap_Parse_ReadToken( handle, &token ) ) 1049 break; 1050 1051 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].name = String_Alloc( token.string ); 1052 valid = qtrue; 1053 } 1054 else if( !Q_stricmp( token.string, "graphic" ) ) 1055 { 1056 int *graphic; 1057 1058 memset( &token, 0, sizeof( pc_token_t ) ); 1059 1060 if( !trap_Parse_ReadToken( handle, &token ) ) 1061 break; 1062 1063 graphic = &uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].numGraphics; 1064 1065 if( !Q_stricmp( token.string, "top" ) ) 1066 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].side = INFOPANE_TOP; 1067 else if( !Q_stricmp( token.string, "bottom" ) ) 1068 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].side = INFOPANE_BOTTOM; 1069 else if( !Q_stricmp( token.string, "left" ) ) 1070 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].side = INFOPANE_LEFT; 1071 else if( !Q_stricmp( token.string, "right" ) ) 1072 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].side = INFOPANE_RIGHT; 1073 else 1074 break; 1075 1076 memset( &token, 0, sizeof( pc_token_t ) ); 1077 1078 if( !trap_Parse_ReadToken( handle, &token ) ) 1079 break; 1080 1081 if( !Q_stricmp( token.string, "center" ) ) 1082 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].offset = -1; 1083 else 1084 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].offset = token.intvalue; 1085 1086 memset( &token, 0, sizeof( pc_token_t ) ); 1087 1088 if( !trap_Parse_ReadToken( handle, &token ) ) 1089 break; 1090 1091 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].graphic = 1092 trap_R_RegisterShaderNoMip( token.string ); 1093 1094 memset( &token, 0, sizeof( pc_token_t ) ); 1095 1096 if( !trap_Parse_ReadToken( handle, &token ) ) 1097 break; 1098 1099 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].width = token.intvalue; 1100 1101 memset( &token, 0, sizeof( pc_token_t ) ); 1102 1103 if( !trap_Parse_ReadToken( handle, &token ) ) 1104 break; 1105 1106 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].height = token.intvalue; 1107 1108 //increment graphics 1109 (*graphic)++; 1110 1111 if( *graphic == MAX_INFOPANE_GRAPHICS ) 1112 break; 1113 } 1114 else if( !Q_stricmp( token.string, "text" ) ) 1115 { 1116 memset( &token, 0, sizeof( pc_token_t ) ); 1117 1118 if( !trap_Parse_ReadToken( handle, &token ) ) 1119 break; 1120 1121 Q_strcat( uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].text, MAX_INFOPANE_TEXT, token.string ); 1122 } 1123 else if( !Q_stricmp( token.string, "align" ) ) 1124 { 1125 memset( &token, 0, sizeof( pc_token_t ) ); 1126 1127 if( !trap_Parse_ReadToken( handle, &token ) ) 1128 break; 1129 1130 if( !Q_stricmp( token.string, "left" ) ) 1131 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].align = ITEM_ALIGN_LEFT; 1132 else if( !Q_stricmp( token.string, "right" ) ) 1133 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].align = ITEM_ALIGN_RIGHT; 1134 else if( !Q_stricmp( token.string, "center" ) ) 1135 uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].align = ITEM_ALIGN_CENTER; 1136 } 1137 else if( token.string[ 0 ] == '}' ) 1138 { 1139 //reached the end, break 1140 break; 1141 } 1142 else 1143 break; 1144 } 1145 1146 if( valid ) 1147 { 1148 uiInfo.tremInfoPaneCount++; 1149 return qtrue; 1150 } 1151 else 1152 { 1153 return qfalse; 1154 } 1155 } 1156 1157 /* 1158 =============== 1159 UI_LoadInfoPanes 1160 =============== 1161 */ 1162 void UI_LoadInfoPanes( const char *file ) 1163 { 1164 pc_token_t token; 1165 int handle; 1166 int count; 1167 1168 uiInfo.tremInfoPaneCount = count = 0; 1169 1170 handle = trap_Parse_LoadSource( file ); 1171 1172 if( !handle ) 1173 { 1174 trap_Error( va( S_COLOR_YELLOW "infopane file not found: %s\n", file ) ); 1175 return; 1176 } 1177 1178 while( 1 ) 1179 { 1180 if( !trap_Parse_ReadToken( handle, &token ) ) 1181 break; 1182 1183 if( token.string[ 0 ] == 0 ) 1184 break; 1185 1186 if( token.string[ 0 ] == '{' ) 1187 { 1188 if( UI_LoadInfoPane( handle ) ) 1189 count++; 1190 1191 if( count == MAX_INFOPANES ) 1192 break; 1193 } 1194 } 1195 1196 trap_Parse_FreeSource( handle ); 1000 1197 } 1001 1198 … … 1209 1406 1210 1407 1408 #define GRAPHIC_BWIDTH 8.0f 1211 1409 /* 1212 1410 =============== … … 1214 1412 =============== 1215 1413 */ 1216 static void UI_DrawInfoPane( menuItem_t *item, rectDef_t *rect, float text_x, float text_y,1414 static void UI_DrawInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float text_x, float text_y, 1217 1415 float scale, vec4_t color, int textStyle ) 1218 1416 { 1417 int i; 1219 1418 float maxLeft = 0, maxTop = 0; 1220 1419 float maxRight = 0, maxBottom = 0; 1221 1420 float x = rect->x - text_x, y = rect->y - text_y, w, h; 1421 float xoffset = 0, yoffset = 0; 1222 1422 menuDef_t dummyParent; 1223 1423 itemDef_t textItem; 1224 int value = 0; 1225 char *string = ""; 1226 int class, credits; 1227 char ui_currentClass[ MAX_STRING_CHARS ]; 1228 1229 trap_Cvar_VariableStringBuffer( "ui_currentClass", ui_currentClass, MAX_STRING_CHARS ); 1230 sscanf( ui_currentClass, "%d %d", &class, &credits ); 1424 1425 //iterate through graphics 1426 for( i = 0; i < pane->numGraphics; i++ ) 1427 { 1428 float width = pane->graphics[ i ].width; 1429 float height = pane->graphics[ i ].height; 1430 qhandle_t graphic = pane->graphics[ i ].graphic; 1431 1432 if( pane->graphics[ i ].side == INFOPANE_TOP || pane->graphics[ i ].side == INFOPANE_BOTTOM ) 1433 { 1434 //set horizontal offset of graphic 1435 if( pane->graphics[ i ].offset < 0 ) 1436 xoffset = ( rect->w / 2 ) - ( pane->graphics[ i ].width / 2 ); 1437 else 1438 xoffset = pane->graphics[ i ].offset + GRAPHIC_BWIDTH; 1439 } 1440 else if( pane->graphics[ i ].side == INFOPANE_LEFT || pane->graphics[ i ].side == INFOPANE_RIGHT ) 1441 { 1442 //set vertical offset of graphic 1443 if( pane->graphics[ i ].offset < 0 ) 1444 yoffset = ( rect->h / 2 ) - ( pane->graphics[ i ].height / 2 ); 1445 else 1446 yoffset = pane->graphics[ i ].offset + GRAPHIC_BWIDTH; 1447 } 1448 1449 if( pane->graphics[ i ].side == INFOPANE_LEFT ) 1450 { 1451 //set the horizontal offset of the text 1452 if( pane->graphics[ i ].width > maxLeft ) 1453 maxLeft = pane->graphics[ i ].width + GRAPHIC_BWIDTH; 1454 1455 xoffset = GRAPHIC_BWIDTH; 1456 } 1457 else if( pane->graphics[ i ].side == INFOPANE_RIGHT ) 1458 { 1459 if( pane->graphics[ i ].width > maxRight ) 1460 maxRight = pane->graphics[ i ].width + GRAPHIC_BWIDTH; 1461 1462 xoffset = rect->w - width - GRAPHIC_BWIDTH; 1463 } 1464 else if( pane->graphics[ i ].side == INFOPANE_TOP ) 1465 { 1466 //set the vertical offset of the text 1467 if( pane->graphics[ i ].height > maxTop ) 1468 maxTop = pane->graphics[ i ].height + GRAPHIC_BWIDTH; 1469 1470 yoffset = GRAPHIC_BWIDTH; 1471 } 1472 else if( pane->graphics[ i ].side == INFOPANE_BOTTOM ) 1473 { 1474 if( pane->graphics[ i ].height > maxBottom ) 1475 maxBottom = pane->graphics[ i ].height + GRAPHIC_BWIDTH; 1476 1477 yoffset = rect->h - height - GRAPHIC_BWIDTH; 1478 } 1479 1480 //draw the graphic 1481 UI_DrawHandlePic( x + xoffset, y + yoffset, width, height, graphic ); 1482 } 1231 1483 1232 1484 //offset the text … … 1236 1488 h = rect->h - ( maxTop + maxBottom ); 1237 1489 1238 switch( item->type ) 1239 { 1240 case INFOTYPE_TEXT: 1241 textItem.text = item->v.text; 1242 break; 1243 1244 case INFOTYPE_CLASS: 1245 value = BG_ClassCanEvolveFromTo( class, item->v.pclass, credits, 0 ); 1246 if( value < 1 ) 1247 { 1248 textItem.text = va( "%s\n\n%s", 1249 BG_FindHumanNameForClassNum( item->v.pclass ), 1250 BG_FindInfoForClassNum( item->v.pclass ) ); 1251 } 1252 else 1253 { 1254 textItem.text = va( "%s\n\n%s\n\nKills: %d", 1255 BG_FindHumanNameForClassNum( item->v.pclass ), 1256 BG_FindInfoForClassNum( item->v.pclass ), 1257 value ); 1258 } 1259 break; 1260 1261 case INFOTYPE_WEAPON: 1262 value = BG_FindPriceForWeapon( item->v.weapon ); 1263 if( value == 0 ) 1264 { 1265 textItem.text = va( "%s\n\n%s\n\nCredits: Free", 1266 BG_FindHumanNameForWeapon( item->v.weapon ), 1267 BG_FindInfoForWeapon( item->v.weapon ) ); 1268 } 1269 else 1270 { 1271 textItem.text = va( "%s\n\n%s\n\nCredits: %d", 1272 BG_FindHumanNameForWeapon( item->v.weapon ), 1273 BG_FindInfoForWeapon( item->v.weapon ), 1274 value ); 1275 } 1276 break; 1277 1278 case INFOTYPE_UPGRADE: 1279 value = BG_FindPriceForUpgrade( item->v.upgrade ); 1280 if( value == 0 ) 1281 { 1282 textItem.text = va( "%s\n\n%s\n\nCredits: Free", 1283 BG_FindHumanNameForUpgrade( item->v.upgrade ), 1284 BG_FindInfoForUpgrade( item->v.upgrade ) ); 1285 } 1286 else 1287 { 1288 textItem.text = va( "%s\n\n%s\n\nCredits: %d", 1289 BG_FindHumanNameForUpgrade( item->v.upgrade ), 1290 BG_FindInfoForUpgrade( item->v.upgrade ), 1291 value ); 1292 } 1293 break; 1294 1295 case INFOTYPE_BUILDABLE: 1296 value = BG_FindBuildPointsForBuildable( item->v.buildable ); 1297 switch( BG_FindTeamForBuildable( item->v.buildable ) ) 1298 { 1299 case BIT_ALIENS: string = "Sentience"; break; 1300 case BIT_HUMANS: string = "Power"; break; 1301 default: break; 1302 } 1303 1304 if( value == 0 ) 1305 { 1306 textItem.text = va( "%s\n\n%s", 1307 BG_FindHumanNameForBuildable( item->v.buildable ), 1308 BG_FindInfoForBuildable( item->v.buildable ) ); 1309 } 1310 else 1311 { 1312 textItem.text = va( "%s\n\n%s\n\n%s: %d", 1313 BG_FindHumanNameForBuildable( item->v.buildable ), 1314 BG_FindInfoForBuildable( item->v.buildable ), 1315 string, value ); 1316 } 1317 break; 1318 } 1490 textItem.text = pane->text; 1319 1491 1320 1492 textItem.parent = &dummyParent; … … 1322 1494 textItem.window.flags = 0; 1323 1495 1324 textItem.window.rect.x = x; 1496 switch( pane->align ) 1497 { 1498 case ITEM_ALIGN_LEFT: 1499 textItem.window.rect.x = x; 1500 break; 1501 1502 case ITEM_ALIGN_RIGHT: 1503 textItem.window.rect.x = x + w; 1504 break; 1505 1506 case ITEM_ALIGN_CENTER: 1507 textItem.window.rect.x = x + ( w / 2 ); 1508 break; 1509 1510 default: 1511 textItem.window.rect.x = x; 1512 break; 1513 } 1514 1325 1515 textItem.window.rect.y = y; 1326 1516 textItem.window.rect.w = w; … … 1331 1521 textItem.textRect.w = 0; 1332 1522 textItem.textRect.h = 0; 1333 textItem.textalignment = ITEM_ALIGN_LEFT;1523 textItem.textalignment = pane->align; 1334 1524 textItem.textalignx = text_x; 1335 1525 textItem.textaligny = text_y; … … 2096 2286 2097 2287 static void UI_DrawKeyBindStatus(rectDef_t *rect, float scale, vec4_t color, int textStyle) { 2288 // int ofs = 0; TTimo: unused 2098 2289 if (Display_KeyBindPending()) { 2099 2290 Text_Paint(rect->x, rect->y, scale, color, "Waiting for new key... Press ESCAPE to cancel", 0, 0, textStyle); … … 2114 2305 2115 2306 // build null terminated extension strings 2307 // TTimo: https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=399 2116 2308 // in TA this was not directly crashing, but displaying a nasty broken shader right in the middle 2117 2309 // brought down the string size to 1024, there's not much that can be shown on the screen anyway … … 2157 2349 { 2158 2350 rectDef_t rect; 2351 tremInfoPane_t *pane = NULL; 2159 2352 2160 2353 rect.x = x + text_x; … … 2166 2359 { 2167 2360 case UI_TEAMINFOPANE: 2168 UI_DrawInfoPane( &uiInfo.tremTeamList[ uiInfo.tremTeamIndex ],2169 &rect, text_x, text_y, scale, color, textStyle );2361 if( ( pane = uiInfo.tremTeamList[ uiInfo.tremTeamIndex ].infopane ) ) 2362 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2170 2363 break; 2171 2364 2172 2365 case UI_ACLASSINFOPANE: 2173 UI_DrawInfoPane( &uiInfo.alienClassList[ uiInfo.alienClassIndex ],2174 &rect, text_x, text_y, scale, color, textStyle );2366 if( ( pane = uiInfo.tremAlienClassList[ uiInfo.tremAlienClassIndex ].infopane ) ) 2367 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2175 2368 break; 2176 2369 2177 2370 case UI_AUPGRADEINFOPANE: 2178 UI_DrawInfoPane( &uiInfo.alienUpgradeList[ uiInfo.alienUpgradeIndex ],2179 &rect, text_x, text_y, scale, color, textStyle );2371 if( ( pane = uiInfo.tremAlienUpgradeList[ uiInfo.tremAlienUpgradeIndex ].infopane ) ) 2372 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2180 2373 break; 2181 2374 2182 2375 case UI_HITEMINFOPANE: 2183 UI_DrawInfoPane( &uiInfo.humanItemList[ uiInfo.humanItemIndex ],2184 &rect, text_x, text_y, scale, color, textStyle );2376 if( ( pane = uiInfo.tremHumanItemList[ uiInfo.tremHumanItemIndex ].infopane ) ) 2377 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2185 2378 break; 2186 2379 2187 2380 case UI_HBUYINFOPANE: 2188 UI_DrawInfoPane( &uiInfo.humanArmouryBuyList[ uiInfo.humanArmouryBuyIndex ],2189 &rect, text_x, text_y, scale, color, textStyle );2381 if( ( pane = uiInfo.tremHumanArmouryBuyList[ uiInfo.tremHumanArmouryBuyIndex ].infopane ) ) 2382 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2190 2383 break; 2191 2384 2192 2385 case UI_HSELLINFOPANE: 2193 UI_DrawInfoPane( &uiInfo.humanArmourySellList[ uiInfo.humanArmourySellIndex ],2194 &rect, text_x, text_y, scale, color, textStyle );2386 if( ( pane = uiInfo.tremHumanArmourySellList[ uiInfo.tremHumanArmourySellIndex ].infopane ) ) 2387 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2195 2388 break; 2196 2389 2197 2390 case UI_ABUILDINFOPANE: 2198 UI_DrawInfoPane( &uiInfo.alienBuildList[ uiInfo.alienBuildIndex ],2199 &rect, text_x, text_y, scale, color, textStyle );2391 if( ( pane = uiInfo.tremAlienBuildList[ uiInfo.tremAlienBuildIndex ].infopane ) ) 2392 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2200 2393 break; 2201 2394 2202 2395 case UI_HBUILDINFOPANE: 2203 UI_DrawInfoPane( &uiInfo.humanBuildList[ uiInfo.humanBuildIndex ],2204 &rect, text_x, text_y, scale, color, textStyle );2396 if( ( pane = uiInfo.tremHumanBuildList[ uiInfo.tremHumanBuildIndex ].infopane ) ) 2397 UI_DrawInfoPane( pane, &rect, text_x, text_y, scale, color, textStyle ); 2205 2398 break; 2206 2399 … … 2981 3174 /* 2982 3175 =============== 2983 UI_LoadT eams3176 UI_LoadTremTeams 2984 3177 =============== 2985 3178 */ 2986 static void UI_LoadT eams( void )3179 static void UI_LoadTremTeams( void ) 2987 3180 { 2988 3181 uiInfo.tremTeamCount = 4; … … 2990 3183 uiInfo.tremTeamList[ 0 ].text = String_Alloc( "Aliens" ); 2991 3184 uiInfo.tremTeamList[ 0 ].cmd = String_Alloc( "cmd team aliens\n" ); 2992 uiInfo.tremTeamList[ 0 ].type = INFOTYPE_TEXT; 2993 uiInfo.tremTeamList[ 0 ].v.text = 2994 "The Alien Team\n\n" 2995 "The Aliens' strengths are in movement and the ability to " 2996 "quickly construct new bases quickly. They possess a range " 2997 "of abilities including basic melee attacks, movement-" 2998 "crippling poisons and more."; 3185 uiInfo.tremTeamList[ 0 ].infopane = UI_FindInfoPaneByName( "alienteam" ); 2999 3186 3000 3187 uiInfo.tremTeamList[ 1 ].text = String_Alloc( "Humans" ); 3001 3188 uiInfo.tremTeamList[ 1 ].cmd = String_Alloc( "cmd team humans\n" ); 3002 uiInfo.tremTeamList[ 1 ].type = INFOTYPE_TEXT; 3003 uiInfo.tremTeamList[ 1 ].v.text = 3004 "The Human Team\n\n" 3005 "The humans are the masters of technology. Although their " 3006 "bases take long to construct, their automated defense " 3007 "ensures they stay built. A wide range of upgrades and " 3008 "weapons are available to the humans, each contributing " 3009 "to eradicate the alien threat."; 3189 uiInfo.tremTeamList[ 1 ].infopane = UI_FindInfoPaneByName( "humanteam" ); 3010 3190 3011 3191 uiInfo.tremTeamList[ 2 ].text = String_Alloc( "Spectate" ); 3012 3192 uiInfo.tremTeamList[ 2 ].cmd = String_Alloc( "cmd team spectate\n" ); 3013 uiInfo.tremTeamList[ 2 ].type = INFOTYPE_TEXT; 3014 uiInfo.tremTeamList[ 2 ].v.text = "Watch the game without playing."; 3193 uiInfo.tremTeamList[ 2 ].infopane = UI_FindInfoPaneByName( "spectateteam" ); 3015 3194 3016 3195 uiInfo.tremTeamList[ 3 ].text = String_Alloc( "Auto select" ); 3017 3196 uiInfo.tremTeamList[ 3 ].cmd = String_Alloc( "cmd team auto\n" ); 3018 uiInfo.tremTeamList[ 3 ].type = INFOTYPE_TEXT; 3019 uiInfo.tremTeamList[ 3 ].v.text = "Join the team with the least players."; 3197 uiInfo.tremTeamList[ 3 ].infopane = UI_FindInfoPaneByName( "autoteam" ); 3020 3198 } 3021 3199 … … 3027 3205 static void UI_AddClass( pClass_t class ) 3028 3206 { 3029 uiInfo. alienClassList[ uiInfo.alienClassCount ].text =3207 uiInfo.tremAlienClassList[ uiInfo.tremAlienClassCount ].text = 3030 3208 String_Alloc( BG_FindHumanNameForClassNum( class ) ); 3031 uiInfo. alienClassList[ uiInfo.alienClassCount ].cmd =3209 uiInfo.tremAlienClassList[ uiInfo.tremAlienClassCount ].cmd = 3032 3210 String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( class ) ) ); 3033 uiInfo. alienClassList[ uiInfo.alienClassCount ].type = INFOTYPE_CLASS;3034 uiInfo.alienClassList[ uiInfo.alienClassCount ].v.pclass = class;3035 3036 uiInfo. alienClassCount++;3211 uiInfo.tremAlienClassList[ uiInfo.tremAlienClassCount ].infopane = 3212 UI_FindInfoPaneByName( va( "%sclass", BG_FindNameForClassNum( class ) ) ); 3213 3214 uiInfo.tremAlienClassCount++; 3037 3215 } 3038 3216 3039 3217 /* 3040 3218 =============== 3041 UI_Load AlienClasses3219 UI_LoadTremAlienClasses 3042 3220 =============== 3043 3221 */ 3044 static void UI_Load AlienClasses( void )3222 static void UI_LoadTremAlienClasses( void ) 3045 3223 { 3046 uiInfo. alienClassCount = 0;3224 uiInfo.tremAlienClassCount = 0; 3047 3225 3048 3226 if( BG_ClassIsAllowed( PCL_ALIEN_LEVEL0 ) ) … … 3063 3241 static void UI_AddItem( weapon_t weapon ) 3064 3242 { 3065 uiInfo. humanItemList[ uiInfo.humanItemCount ].text =3243 uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].text = 3066 3244 String_Alloc( BG_FindHumanNameForWeapon( weapon ) ); 3067 uiInfo. humanItemList[ uiInfo.humanItemCount ].cmd =3245 uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].cmd = 3068 3246 String_Alloc( va( "cmd class %s\n", BG_FindNameForWeapon( weapon ) ) ); 3069 uiInfo. humanItemList[ uiInfo.humanItemCount ].type = INFOTYPE_WEAPON;3070 uiInfo.humanItemList[ uiInfo.humanItemCount ].v.weapon = weapon;3071 3072 uiInfo. humanItemCount++;3247 uiInfo.tremHumanItemList[ uiInfo.tremHumanItemCount ].infopane = 3248 UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( weapon ) ) ); 3249 3250 uiInfo.tremHumanItemCount++; 3073 3251 } 3074 3252 3075 3253 /* 3076 3254 =============== 3077 UI_Load HumanItems3255 UI_LoadTremHumanItems 3078 3256 =============== 3079 3257 */ 3080 static void UI_Load HumanItems( void )3258 static void UI_LoadTremHumanItems( void ) 3081 3259 { 3082 uiInfo. humanItemCount = 0;3260 uiInfo.tremHumanItemCount = 0; 3083 3261 3084 3262 if( BG_WeaponIsAllowed( WP_MACHINEGUN ) ) … … 3154 3332 /* 3155 3333 =============== 3156 UI_Load HumanArmouryBuys3334 UI_LoadTremHumanArmouryBuys 3157 3335 =============== 3158 3336 */ 3159 static void UI_Load HumanArmouryBuys( void )3337 static void UI_LoadTremHumanArmouryBuys( void ) 3160 3338 { 3161 3339 int i, j = 0; … … 3178 3356 } 3179 3357 3180 uiInfo. humanArmouryBuyCount = 0;3358 uiInfo.tremHumanArmouryBuyCount = 0; 3181 3359 3182 3360 for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) … … 3189 3367 !( weapons & ( 1 << i ) ) ) 3190 3368 { 3191 uiInfo. humanArmouryBuyList[ j ].text =3369 uiInfo.tremHumanArmouryBuyList[ j ].text = 3192 3370 String_Alloc( BG_FindHumanNameForWeapon( i ) ); 3193 uiInfo. humanArmouryBuyList[ j ].cmd =3371 uiInfo.tremHumanArmouryBuyList[ j ].cmd = 3194 3372 String_Alloc( va( "cmd buy %s retrigger\n", BG_FindNameForWeapon( i ) ) ); 3195 uiInfo. humanArmouryBuyList[ j ].type = INFOTYPE_WEAPON;3196 uiInfo.humanArmouryBuyList[ j ].v.weapon = i;3373 uiInfo.tremHumanArmouryBuyList[ j ].infopane = 3374 UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( i ) ) ); 3197 3375 3198 3376 j++; 3199 3377 3200 uiInfo. humanArmouryBuyCount++;3378 uiInfo.tremHumanArmouryBuyCount++; 3201 3379 } 3202 3380 } … … 3211 3389 !( upgrades & ( 1 << i ) ) ) 3212 3390 { 3213 uiInfo. humanArmouryBuyList[ j ].text =3391 uiInfo.tremHumanArmouryBuyList[ j ].text = 3214 3392 String_Alloc( BG_FindHumanNameForUpgrade( i ) ); 3215 uiInfo. humanArmouryBuyList[ j ].cmd =3393 uiInfo.tremHumanArmouryBuyList[ j ].cmd = 3216 3394 String_Alloc( va( "cmd buy %s retrigger\n", BG_FindNameForUpgrade( i ) ) ); 3217 uiInfo. humanArmouryBuyList[ j ].type = INFOTYPE_UPGRADE;3218 uiInfo.humanArmouryBuyList[ j ].v.upgrade = i;3395 uiInfo.tremHumanArmouryBuyList[ j ].infopane = 3396 UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForUpgrade( i ) ) ); 3219 3397 3220 3398 j++; 3221 3399 3222 uiInfo. humanArmouryBuyCount++;3400 uiInfo.tremHumanArmouryBuyCount++; 3223 3401 } 3224 3402 } … … 3227 3405 /* 3228 3406 =============== 3229 UI_Load HumanArmourySells3407 UI_LoadTremHumanArmourySells 3230 3408 =============== 3231 3409 */ 3232 static void UI_Load HumanArmourySells( void )3410 static void UI_LoadTremHumanArmourySells( void ) 3233 3411 { 3234 3412 int weapons, upgrades; 3235 3413 int i, j = 0; 3236 3414 3237 uiInfo. humanArmourySellCount = 0;3415 uiInfo.tremHumanArmourySellCount = 0; 3238 3416 UI_ParseCarriageList( &weapons, &upgrades ); 3239 3417 … … 3242 3420 if( weapons & ( 1 << i ) ) 3243 3421 { 3244 uiInfo. humanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForWeapon( i ) );3245 uiInfo. humanArmourySellList[ j ].cmd =3422 uiInfo.tremHumanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForWeapon( i ) ); 3423 uiInfo.tremHumanArmourySellList[ j ].cmd = 3246 3424 String_Alloc( va( "cmd sell %s retrigger\n", BG_FindNameForWeapon( i ) ) ); 3247 uiInfo. humanArmourySellList[ j ].type = INFOTYPE_WEAPON;3248 uiInfo.humanArmourySellList[ j ].v.weapon = i;3425 uiInfo.tremHumanArmourySellList[ j ].infopane = 3426 UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForWeapon( i ) ) ); 3249 3427 3250 3428 j++; 3251 3429 3252 uiInfo. humanArmourySellCount++;3430 uiInfo.tremHumanArmourySellCount++; 3253 3431 } 3254 3432 } … … 3258 3436 if( upgrades & ( 1 << i ) ) 3259 3437 { 3260 uiInfo. humanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForUpgrade( i ) );3261 uiInfo. humanArmourySellList[ j ].cmd =3438 uiInfo.tremHumanArmourySellList[ j ].text = String_Alloc( BG_FindHumanNameForUpgrade( i ) ); 3439 uiInfo.tremHumanArmourySellList[ j ].cmd = 3262 3440 String_Alloc( va( "cmd sell %s retrigger\n", BG_FindNameForUpgrade( i ) ) ); 3263 uiInfo. humanArmourySellList[ j ].type = INFOTYPE_UPGRADE;3264 uiInfo.humanArmourySellList[ j ].v.upgrade = i;3441 uiInfo.tremHumanArmourySellList[ j ].infopane = 3442 UI_FindInfoPaneByName( va( "%sitem", BG_FindNameForUpgrade( i ) ) ); 3265 3443 3266 3444 j++; 3267 3445 3268 uiInfo. humanArmourySellCount++;3446 uiInfo.tremHumanArmourySellCount++; 3269 3447 } 3270 3448 } … … 3273 3451 /* 3274 3452 =============== 3275 UI_Load AlienUpgrades3453 UI_LoadTremAlienUpgrades 3276 3454 =============== 3277 3455 */ 3278 static void UI_Load AlienUpgrades( void )3456 static void UI_LoadTremAlienUpgrades( void ) 3279 3457 { 3280 3458 int i, j = 0; … … 3286 3464 sscanf( ui_currentClass, "%d %d", &class, &credits ); 3287 3465 3288 uiInfo. alienUpgradeCount = 0;3466 uiInfo.tremAlienUpgradeCount = 0; 3289 3467 3290 3468 for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ ) … … 3294 3472 BG_ClassIsAllowed( i ) ) 3295 3473 { 3296 uiInfo. alienUpgradeList[ j ].text = String_Alloc( BG_FindHumanNameForClassNum( i ) );3297 uiInfo. alienUpgradeList[ j ].cmd =3474 uiInfo.tremAlienUpgradeList[ j ].text = String_Alloc( BG_FindHumanNameForClassNum( i ) ); 3475 uiInfo.tremAlienUpgradeList[ j ].cmd = 3298 3476 String_Alloc( va( "cmd class %s\n", BG_FindNameForClassNum( i ) ) ); 3299 uiInfo. alienUpgradeList[ j ].type = INFOTYPE_CLASS;3300 uiInfo.alienUpgradeList[ j ].v.pclass = i;3477 uiInfo.tremAlienUpgradeList[ j ].infopane = 3478 UI_FindInfoPaneByName( va( "%sclass", BG_FindNameForClassNum( i ) ) ); 3301 3479 3302 3480 j++; 3303 3481 3304 uiInfo. alienUpgradeCount++;3482 uiInfo.tremAlienUpgradeCount++; 3305 3483 } 3306 3484 } … … 3309 3487 /* 3310 3488 =============== 3311 UI_Load AlienBuilds3489 UI_LoadTremAlienBuilds 3312 3490 =============== 3313 3491 */ 3314 static void UI_Load AlienBuilds( void )3492 static void UI_LoadTremAlienBuilds( void ) 3315 3493 { 3316 3494 int weapons; … … 3321 3499 stage = UI_GetCurrentAlienStage( ); 3322 3500 3323 uiInfo. alienBuildCount = 0;3501 uiInfo.tremAlienBuildCount = 0; 3324 3502 3325 3503 for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ ) … … 3330 3508 BG_BuildableIsAllowed( i ) ) 3331 3509 { 3332 uiInfo. alienBuildList[ j ].text =3510 uiInfo.tremAlienBuildList[ j ].text = 3333 3511 String_Alloc( BG_FindHumanNameForBuildable( i ) ); 3334 uiInfo. alienBuildList[ j ].cmd =3512 uiInfo.tremAlienBuildList[ j ].cmd = 3335 3513 String_Alloc( va( "cmd build %s\n", BG_FindNameForBuildable( i ) ) ); 3336 uiInfo. alienBuildList[ j ].type = INFOTYPE_BUILDABLE;3337 uiInfo.alienBuildList[ j ].v.buildable = i;3514 uiInfo.tremAlienBuildList[ j ].infopane = 3515 UI_FindInfoPaneByName( va( "%sbuild", BG_FindNameForBuildable( i ) ) ); 3338 3516 3339 3517 j++; 3340 3518 3341 uiInfo. alienBuildCount++;3519 uiInfo.tremAlienBuildCount++; 3342 3520 } 3343 3521 } … … 3346 3524 /* 3347 3525 =============== 3348 UI_Load HumanBuilds3526 UI_LoadTremHumanBuilds 3349 3527 =============== 3350 3528 */ 3351 static void UI_Load HumanBuilds( void )3529 static void UI_LoadTremHumanBuilds( void ) 3352 3530 { 3353 3531 int weapons; … … 3358 3536 stage = UI_GetCurrentHumanStage( ); 3359 3537 3360 uiInfo. humanBuildCount = 0;3538 uiInfo.tremHumanBuildCount = 0; 3361 3539 3362 3540 for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ ) … … 3367 3545 BG_BuildableIsAllowed( i ) ) 3368 3546 { 3369 uiInfo. humanBuildList[ j ].text =3547 uiInfo.tremHumanBuildList[ j ].text = 3370 3548 String_Alloc( BG_FindHumanNameForBuildable( i ) ); 3371 uiInfo. humanBuildList[ j ].cmd =3549 uiInfo.tremHumanBuildList[ j ].cmd = 3372 3550 String_Alloc( va( "cmd build %s\n", BG_FindNameForBuildable( i ) ) ); 3373 uiInfo. humanBuildList[ j ].type = INFOTYPE_BUILDABLE;3374 uiInfo.humanBuildList[ j ].v.buildable = i;3551 uiInfo.tremHumanBuildList[ j ].infopane = 3552 UI_FindInfoPaneByName( va( "%sbuild", BG_FindNameForBuildable( i ) ) ); 3375 3553 3376 3554 j++; 3377 3555 3378 uiInfo. humanBuildCount++;3556 uiInfo.tremHumanBuildCount++; 3379 3557 } 3380 3558 } … … 3822 4000 UI_LoadMods(); 3823 4001 } 4002 4003 //TA: tremulous menus 3824 4004 else if( Q_stricmp( name, "LoadTeams" ) == 0 ) 3825 UI_LoadT eams( );4005 UI_LoadTremTeams( ); 3826 4006 else if( Q_stricmp( name, "JoinTeam" ) == 0 ) 3827 4007 { … … 3830 4010 } 3831 4011 else if( Q_stricmp( name, "LoadHumanItems" ) == 0 ) 3832 UI_Load HumanItems( );4012 UI_LoadTremHumanItems( ); 3833 4013 else if( Q_stricmp( name, "SpawnWithHumanItem" ) == 0 ) 3834 4014 { 3835 if( ( cmd = uiInfo. humanItemList[ uiInfo.humanItemIndex ].cmd ) )4015 if( ( cmd = uiInfo.tremHumanItemList[ uiInfo.tremHumanItemIndex ].cmd ) ) 3836 4016 trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); 3837 4017 } 3838 4018 else if( Q_stricmp( name, "LoadAlienClasses" ) == 0 ) 3839 UI_Load AlienClasses( );4019 UI_LoadTremAlienClasses( ); 3840 4020 else if( Q_stricmp( name, "SpawnAsAlienClass" ) == 0 ) 3841 4021 { 3842 if( ( cmd = uiInfo. alienClassList[ uiInfo.alienClassIndex ].cmd ) )4022 if( ( cmd = uiInfo.tremAlienClassList[ uiInfo.tremAlienClassIndex ].cmd ) ) 3843 4023 trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); 3844 4024 } 3845 4025 else if( Q_stricmp( name, "LoadHumanArmouryBuys" ) == 0 ) 3846 UI_Load HumanArmouryBuys( );4026 UI_LoadTremHumanArmouryBuys( ); 3847 4027 else if( Q_stricmp( name, "BuyFromArmoury" ) == 0 ) 3848 4028 { 3849 if( ( cmd = uiInfo. humanArmouryBuyList[ uiInfo.humanArmouryBuyIndex ].cmd ) )4029 if( ( cmd = uiInfo.tremHumanArmouryBuyList[ uiInfo.tremHumanArmouryBuyIndex ].cmd ) ) 3850 4030 trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); 3851 4031 } 3852 4032 else if( Q_stricmp( name, "LoadHumanArmourySells" ) == 0 ) 3853 UI_Load HumanArmourySells( );4033 UI_LoadTremHumanArmourySells( ); 3854 4034 else if( Q_stricmp( name, "SellToArmoury" ) == 0 ) 3855 4035 { 3856 if( ( cmd = uiInfo. humanArmourySellList[ uiInfo.humanArmourySellIndex ].cmd ) )4036 if( ( cmd = uiInfo.tremHumanArmourySellList[ uiInfo.tremHumanArmourySellIndex ].cmd ) ) 3857 4037 trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); 3858 4038 } 3859 4039 else if( Q_stricmp( name, "LoadAlienUpgrades" ) == 0 ) 3860 4040 { 3861 UI_Load AlienUpgrades( );4041 UI_LoadTremAlienUpgrades( ); 3862 4042 3863 4043 //disallow the menu if it would be empty 3864 if( uiInfo. alienUpgradeCount <= 0 )4044 if( uiInfo.tremAlienUpgradeCount <= 0 ) 3865 4045 Menus_CloseAll( ); 3866 4046 } 3867 4047 else if( Q_stricmp( name, "UpgradeToNewClass" ) == 0 ) 3868 4048 { 3869 if( ( cmd = uiInfo. alienUpgradeList[ uiInfo.alienUpgradeIndex ].cmd ) )4049 if( ( cmd = uiInfo.tremAlienUpgradeList[ uiInfo.tremAlienUpgradeIndex ].cmd ) ) 3870 4050 trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); 3871 4051 } 3872 4052 else if( Q_stricmp( name, "LoadAlienBuilds" ) == 0 ) 3873 UI_Load AlienBuilds( );4053 UI_LoadTremAlienBuilds( ); 3874 4054 else if( Q_stricmp( name, "BuildAlienBuildable" ) == 0 ) 3875 4055 { 3876 if( ( cmd = uiInfo. alienBuildList[ uiInfo.alienBuildIndex ].cmd ) )4056 if( ( cmd = uiInfo.tremAlienBuildList[ uiInfo.tremAlienBuildIndex ].cmd ) ) 3877 4057 trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); 3878 4058 } 3879 4059 else if( Q_stricmp( name, "LoadHumanBuilds" ) == 0 ) 3880 UI_Load HumanBuilds( );4060 UI_LoadTremHumanBuilds( ); 3881 4061 else if( Q_stricmp( name, "BuildHumanBuildable" ) == 0 ) 3882 4062 { 3883 if( ( cmd = uiInfo. humanBuildList[ uiInfo.humanBuildIndex ].cmd ) )4063 if( ( cmd = uiInfo.tremHumanBuildList[ uiInfo.tremHumanBuildIndex ].cmd ) ) 3884 4064 trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); 3885 4065 } … … 3905 4085 } 3906 4086 } 4087 //TA: tremulous menus 4088 3907 4089 else if (Q_stricmp(name, "playMovie") == 0) { 3908 4090 if (uiInfo.previewMovie >= 0) { … … 4412 4594 int i, count, clients, maxClients, ping, game, len, visible; 4413 4595 char info[MAX_STRING_CHARS]; 4596 // qboolean startRefresh = qtrue; TTimo: unused 4414 4597 static int numinvisible; 4415 4598 … … 4892 5075 return uiInfo.demoCount; 4893 5076 } 5077 5078 //TA: tremulous menus 4894 5079 else if( feederID == FEEDER_TREMTEAMS ) 4895 5080 return uiInfo.tremTeamCount; 4896 5081 else if( feederID == FEEDER_TREMHUMANITEMS ) 4897 return uiInfo. humanItemCount;5082 return uiInfo.tremHumanItemCount; 4898 5083 else if( feederID == FEEDER_TREMALIENCLASSES ) 4899 return uiInfo. alienClassCount;5084 return uiInfo.tremAlienClassCount; 4900 5085 else if( feederID == FEEDER_TREMHUMANARMOURYBUY ) 4901 return uiInfo. humanArmouryBuyCount;5086 return uiInfo.tremHumanArmouryBuyCount; 4902 5087 else if( feederID == FEEDER_TREMHUMANARMOURYSELL ) 4903 return uiInfo. humanArmourySellCount;5088 return uiInfo.tremHumanArmourySellCount; 4904 5089 else if( feederID == FEEDER_TREMALIENUPGRADE ) 4905 return uiInfo. alienUpgradeCount;5090 return uiInfo.tremAlienUpgradeCount; 4906 5091 else if( feederID == FEEDER_TREMALIENBUILD ) 4907 return uiInfo. alienBuildCount;5092 return uiInfo.tremAlienBuildCount; 4908 5093 else if( feederID == FEEDER_TREMHUMANBUILD ) 4909 return uiInfo.humanBuildCount; 5094 return uiInfo.tremHumanBuildCount; 5095 //TA: tremulous menus 4910 5096 4911 5097 return 0; … … 5088 5274 } 5089 5275 } 5276 5277 //TA: tremulous menus 5090 5278 else if( feederID == FEEDER_TREMTEAMS ) 5091 5279 { … … 5095 5283 else if( feederID == FEEDER_TREMHUMANITEMS ) 5096 5284 { 5097 if( index >= 0 && index < uiInfo. humanItemCount )5098 return uiInfo. humanItemList[ index ].text;5285 if( index >= 0 && index < uiInfo.tremHumanItemCount ) 5286 return uiInfo.tremHumanItemList[ index ].text; 5099 5287 } 5100 5288 else if( feederID == FEEDER_TREMALIENCLASSES ) 5101 5289 { 5102 if( index >= 0 && index < uiInfo. alienClassCount )5103 return uiInfo. alienClassList[ index ].text;5290 if( index >= 0 && index < uiInfo.tremAlienClassCount ) 5291 return uiInfo.tremAlienClassList[ index ].text; 5104 5292 } 5105 5293 else if( feederID == FEEDER_TREMHUMANARMOURYBUY ) 5106 5294 { 5107 if( index >= 0 && index < uiInfo. humanArmouryBuyCount )5108 return uiInfo. humanArmouryBuyList[ index ].text;5295 if( index >= 0 && index < uiInfo.tremHumanArmouryBuyCount ) 5296 return uiInfo.tremHumanArmouryBuyList[ index ].text; 5109 5297 } 5110 5298 else if( feederID == FEEDER_TREMHUMANARMOURYSELL ) 5111 5299 { 5112 if( index >= 0 && index < uiInfo. humanArmourySellCount )5113 return uiInfo. humanArmourySellList[ index ].text;5300 if( index >= 0 && index < uiInfo.tremHumanArmourySellCount ) 5301 return uiInfo.tremHumanArmourySellList[ index ].text; 5114 5302 } 5115 5303 else if( feederID == FEEDER_TREMALIENUPGRADE ) 5116 5304 { 5117 if( index >= 0 && index < uiInfo. alienUpgradeCount )5118 return uiInfo. alienUpgradeList[ index ].text;5305 if( index >= 0 && index < uiInfo.tremAlienUpgradeCount ) 5306 return uiInfo.tremAlienUpgradeList[ index ].text; 5119 5307 } 5120 5308 else if( feederID == FEEDER_TREMALIENBUILD ) 5121 5309 { 5122 if( index >= 0 && index < uiInfo. alienBuildCount )5123 return uiInfo. alienBuildList[ index ].text;5310 if( index >= 0 && index < uiInfo.tremAlienBuildCount ) 5311 return uiInfo.tremAlienBuildList[ index ].text; 5124 5312 } 5125 5313 else if( feederID == FEEDER_TREMHUMANBUILD ) 5126 5314 { 5127 if( index >= 0 && index < uiInfo.humanBuildCount ) 5128 return uiInfo.humanBuildList[ index ].text; 5129 } 5315 if( index >= 0 && index < uiInfo.tremHumanBuildCount ) 5316 return uiInfo.tremHumanBuildList[ index ].text; 5317 } 5318 //TA: tremulous menus 5130 5319 5131 5320 return ""; … … 5244 5433 uiInfo.demoIndex = index; 5245 5434 } 5435 5436 //TA: tremulous menus 5246 5437 else if( feederID == FEEDER_TREMTEAMS ) 5247 5438 uiInfo.tremTeamIndex = index; 5248 5439 else if( feederID == FEEDER_TREMHUMANITEMS ) 5249 uiInfo. humanItemIndex = index;5440 uiInfo.tremHumanItemIndex = index; 5250 5441 else if( feederID == FEEDER_TREMALIENCLASSES ) 5251 uiInfo. alienClassIndex = index;5442 uiInfo.tremAlienClassIndex = index; 5252 5443 else if( feederID == FEEDER_TREMHUMANARMOURYBUY ) 5253 uiInfo. humanArmouryBuyIndex = index;5444 uiInfo.tremHumanArmouryBuyIndex = index; 5254 5445 else if( feederID == FEEDER_TREMHUMANARMOURYSELL ) 5255 uiInfo. humanArmourySellIndex = index;5446 uiInfo.tremHumanArmourySellIndex = index; 5256 5447 else if( feederID == FEEDER_TREMALIENUPGRADE ) 5257 uiInfo. alienUpgradeIndex = index;5448 uiInfo.tremAlienUpgradeIndex = index; 5258 5449 else if( feederID == FEEDER_TREMALIENBUILD ) 5259 uiInfo. alienBuildIndex = index;5450 uiInfo.tremAlienBuildIndex = index; 5260 5451 else if( feederID == FEEDER_TREMHUMANBUILD ) 5261 uiInfo.humanBuildIndex = index; 5452 uiInfo.tremHumanBuildIndex = index; 5453 //TA: tremulous menus 5262 5454 } 5263 5455 … … 5417 5609 UI_LoadMenus("ui/ingame.txt", qfalse); 5418 5610 UI_LoadMenus("ui/tremulous.txt", qfalse); 5611 5612 UI_LoadInfoPanes( "ui/infopanes.def" ); 5613 5614 if( uiInfo.uiDC.debug ) 5615 { 5616 int i, j; 5617 5618 for( i = 0; i < uiInfo.tremInfoPaneCount; i++ ) 5619 { 5620 Com_Printf( "name: %s\n", uiInfo.tremInfoPanes[ i ].name ); 5621 5622 Com_Printf( "text: %s\n", uiInfo.tremInfoPanes[ i ].text ); 5623 5624 for( j = 0; j < uiInfo.tremInfoPanes[ i ].numGraphics; j++ ) 5625 Com_Printf( "graphic %d: %d %d %d %d\n", j, uiInfo.tremInfoPanes[ i ].graphics[ j ].side, 5626 uiInfo.tremInfoPanes[ i ].graphics[ j ].offset, 5627 uiInfo.tremInfoPanes[ i ].graphics[ j ].width, 5628 uiInfo.tremInfoPanes[ i ].graphics[ j ].height ); 5629 } 5630 } 5419 5631 5420 5632 Menus_CloseAll(); … … 5965 6177 vmCvar_t ui_serverStatusTimeOut; 5966 6178 6179 //TA: bank values 6180 vmCvar_t ui_bank; 5967 6181 vmCvar_t ui_winner; 5968 6182 6183 6184 // bk001129 - made static to avoid aliasing 5969 6185 static cvarTable_t cvarTable[] = { 5970 6186 { &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE }, … … 6090 6306 { &ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART}, 6091 6307 { &ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE}, 6308 6309 { &ui_bank, "ui_bank", "0", 0 }, 6310 6092 6311 }; 6093 6312 6313 // bk001129 - made static to avoid aliasing 6094 6314 static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]); 6095 6315 -
src/ui/ui_players.c
r122 r0 55 55 static void UI_PlayerInfo_SetWeapon( playerInfo_t *pi, weapon_t weaponNum ) 56 56 { 57 //TA: FIXME: this is probably useless for trem 58 /* gitem_t * item; 59 char path[MAX_QPATH]; 60 61 pi->currentWeapon = weaponNum; 62 tryagain: 63 pi->realWeapon = weaponNum; 64 pi->weaponModel = 0; 65 pi->barrelModel = 0; 66 pi->flashModel = 0; 67 68 if ( weaponNum == WP_NONE ) { 69 return; 70 } 71 72 if ( item->classname ) { 73 pi->weaponModel = trap_R_RegisterModel( item->world_model[0] ); 74 } 75 76 if( pi->weaponModel == 0 ) { 77 if( weaponNum == WP_MACHINEGUN ) { 78 weaponNum = WP_NONE; 79 goto tryagain; 80 } 81 weaponNum = WP_MACHINEGUN; 82 goto tryagain; 83 } 84 85 if ( weaponNum == WP_MACHINEGUN ) { 86 strcpy( path, item->world_model[0] ); 87 COM_StripExtension( path, path ); 88 strcat( path, "_barrel.md3" ); 89 pi->barrelModel = trap_R_RegisterModel( path ); 90 } 91 92 strcpy( path, item->world_model[0] ); 93 COM_StripExtension( path, path ); 94 strcat( path, "_flash.md3" ); 95 pi->flashModel = trap_R_RegisterModel( path ); 96 97 switch( weaponNum ) { 98 case WP_GAUNTLET: 99 MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 ); 100 break; 101 102 case WP_MACHINEGUN: 103 MAKERGB( pi->flashDlightColor, 1, 1, 0 ); 104 break; 105 106 case WP_SHOTGUN: 107 MAKERGB( pi->flashDlightColor, 1, 1, 0 ); 108 break; 109 110 case WP_GRENADE_LAUNCHER: 111 MAKERGB( pi->flashDlightColor, 1, 0.7f, 0.5f ); 112 break; 113 114 case WP_ROCKET_LAUNCHER: 115 MAKERGB( pi->flashDlightColor, 1, 0.75f, 0 ); 116 break; 117 118 case WP_TESLAGEN: 119 MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 ); 120 break; 121 122 case WP_RAILGUN: 123 MAKERGB( pi->flashDlightColor, 1, 0.5f, 0 ); 124 break; 125 126 case WP_BFG: 127 MAKERGB( pi->flashDlightColor, 1, 0.7f, 1 ); 128 break; 129 130 case WP_GRAPPLING_HOOK: 131 MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 ); 132 break; 133 134 default: 135 MAKERGB( pi->flashDlightColor, 1, 1, 1 ); 136 break; 137 }*/ 57 138 } 58 139 … … 1114 1195 } 1115 1196 1116 if (headModelName [0] == '*' ) {1197 if (headModelName && headModelName[0] == '*' ) { 1117 1198 Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headModelName[1], &headModelName[1] ); 1118 1199 } -
src/ui/ui_shared.c
r118 r0 42 42 static scrollInfo_t scrollInfo; 43 43 44 // prevent compiler warnings44 //TA: hack to prevent compiler warnings 45 45 void voidFunction( void *var ) { return; } 46 46 qboolean voidFunction2( itemDef_t *var1, int var2 ) { return qfalse; } … … 84 84 #endif 85 85 86 //TA: hacked variable name to avoid conflict with new cgame Alloc 86 87 static char UI_memoryPool[MEM_POOL_SIZE]; 87 88 static int allocPoint, outOfMemory; … … 542 543 Q_strcat(script, 1024, " "); 543 544 } 544 return qfalse; 545 return qfalse; // bk001105 - LCC missing return value 545 546 } 546 547 … … 1352 1353 sfxHandle_t *sfx = &DC->Assets.itemFocusSound; 1353 1354 qboolean playSound = qfalse; 1354 menuDef_t *parent; 1355 menuDef_t *parent; // bk001206: = (menuDef_t*)item->parent; 1355 1356 // sanity check, non-null, not a decoration and does not already have the focus 1356 1357 if (item == NULL || item->window.flags & WINDOW_DECORATION || item->window.flags & WINDOW_HASFOCUS || !(item->window.flags & WINDOW_VISIBLE)) { … … 1358 1359 } 1359 1360 1361 // bk001206 - this can be NULL. 1360 1362 parent = (menuDef_t*)item->parent; 1361 1363 … … 2405 2407 captureData = NULL; 2406 2408 } else { 2409 // bk001206 - parentheses 2407 2410 if ( down && ( key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3 ) ) { 2408 2411 Item_StartCapture(item, key); … … 2659 2662 if (down && !(menu->window.flags & WINDOW_POPUP) && !Rect_ContainsPoint(&menu->window.rect, DC->cursorx, DC->cursory)) { 2660 2663 static qboolean inHandleKey = qfalse; 2664 // bk001206 - parentheses 2661 2665 if (!inHandleKey && ( key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3 ) ) { 2662 2666 inHandleKey = qtrue; … … 2838 2842 2839 2843 if (item->window.flags & WINDOW_HASFOCUS) { 2844 /* lowLight[0] = 0.8 * parent->focusColor[0]; 2845 lowLight[1] = 0.8 * parent->focusColor[1]; 2846 lowLight[2] = 0.8 * parent->focusColor[2]; 2847 lowLight[3] = 0.8 * parent->focusColor[3]; 2848 LerpColor(parent->focusColor,lowLight,*newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ 2849 //TA: 2840 2850 memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); 2841 2851 } else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime/BLINK_DIVISOR) & 1)) { … … 2899 2909 } 2900 2910 2901 // forceably split lines that are too long (where normal splitage has failed)2911 //TA: forceably split lines that are too long (where normal splitage has failed) 2902 2912 if( textWidth > item->window.rect.w && newLine == 0 && *p != '\n' ) 2903 2913 { … … 3076 3086 } 3077 3087 3078 // forceably split lines that are too long (where normal splitage has failed)3088 //TA: forceably split lines that are too long (where normal splitage has failed) 3079 3089 if( textWidth > item->window.rect.w && newLine == 0 && *p != '\n' ) 3080 3090 { … … 3290 3300 3291 3301 if (item->window.flags & WINDOW_HASFOCUS) { 3302 /* lowLight[0] = 0.8 * parent->focusColor[0]; 3303 lowLight[1] = 0.8 * parent->focusColor[1]; 3304 lowLight[2] = 0.8 * parent->focusColor[2]; 3305 lowLight[3] = 0.8 * parent->focusColor[3]; 3306 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ 3307 //TA: 3292 3308 memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); 3293 3309 } else { … … 3313 3329 3314 3330 if (item->window.flags & WINDOW_HASFOCUS) { 3331 /* lowLight[0] = 0.8 * parent->focusColor[0]; 3332 lowLight[1] = 0.8 * parent->focusColor[1]; 3333 lowLight[2] = 0.8 * parent->focusColor[2]; 3334 lowLight[3] = 0.8 * parent->focusColor[3]; 3335 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ 3336 //TA: 3315 3337 memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); 3316 3338 } else { … … 3332 3354 3333 3355 if (item->window.flags & WINDOW_HASFOCUS) { 3356 /* lowLight[0] = 0.8 * parent->focusColor[0]; 3357 lowLight[1] = 0.8 * parent->focusColor[1]; 3358 lowLight[2] = 0.8 * parent->focusColor[2]; 3359 lowLight[3] = 0.8 * parent->focusColor[3]; 3360 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ 3361 //TA: 3334 3362 memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); 3335 3363 } else { … … 3370 3398 { "+button2", K_ENTER, -1, -1, -1 }, 3371 3399 { "+speed", K_SHIFT, -1, -1, -1 }, 3372 { "boost", 'x', -1, -1, -1 }, // human sprinting3400 { "boost", 'x', -1, -1, -1 }, //TA: human sprinting 3373 3401 { "+forward", K_UPARROW, -1, -1, -1 }, 3374 3402 { "+back", K_DOWNARROW, -1, -1, -1 }, … … 3399 3427 { "weapon 13", -1, -1, -1, -1 }, 3400 3428 { "+attack", K_MOUSE1, -1, -1, -1 }, 3401 { "+button5", K_MOUSE2, -1, -1, -1 }, // secondary attack3402 { "reload", 'r', -1, -1, -1 }, // reload3403 { "buy ammo", 'b', -1, -1, -1 }, // buy ammo3404 { "itemact medkit", 'm', -1, -1, -1 }, // use medkit3405 { "+button7", 'q', -1, -1, -1 }, // buildable use3406 { "deconstruct", 'e', -1, -1, -1 }, // buildable destroy3429 { "+button5", K_MOUSE2, -1, -1, -1 }, //TA: secondary attack 3430 { "reload", 'r', -1, -1, -1 }, //TA: reload 3431 { "buy ammo", 'b', -1, -1, -1 }, //TA: buy ammo 3432 { "itemact medkit", 'm', -1, -1, -1 }, //TA: use medkit 3433 { "+button7", 'q', -1, -1, -1 }, //TA: buildable use 3434 { "deconstruct", 'e', -1, -1, -1 }, //TA: buildable destroy 3407 3435 { "weapprev", '[', -1, -1, -1 }, 3408 3436 { "weapnext", ']', -1, -1, -1 }, … … 3415 3443 { "scoresUp", K_KP_PGUP, -1, -1, -1 }, 3416 3444 { "scoresDown", K_KP_PGDN, -1, -1, -1 }, 3445 // bk001205 - this one below was: '-1' 3417 3446 { "messagemode", -1, -1, -1, -1 }, 3418 3447 { "messagemode2", -1, -1, -1, -1 }, … … 3597 3626 3598 3627 if (item->window.flags & WINDOW_HASFOCUS) { 3628 /* lowLight[0] = 0.8 * parent->focusColor[0]; 3629 lowLight[1] = 0.8 * parent->focusColor[1]; 3630 lowLight[2] = 0.8 * parent->focusColor[2]; 3631 lowLight[3] = 0.8 * parent->focusColor[3]; 3632 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ 3633 //TA: 3599 3634 memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); 3600 3635 } else { … … 3641 3676 lowLight[3] = 0.8f * parent->focusColor[3]; 3642 3677 } 3643 3678 /*LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ 3679 //TA: 3644 3680 memcpy(newColor, &parent->focusColor, sizeof(vec4_t)); 3645 3681 } else { … … 3980 4016 DC->drawHandlePic(x + 4 + listPtr->columnInfo[j].pos, y - 1 + listPtr->elementHeight / 2, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage); 3981 4017 } else if (text) { 4018 //TA: 3982 4019 int alignOffset = 0.0f, tw; 3983 4020 … … 4032 4069 } 4033 4070 4034 // FIXME: hacky fix to off-by-one bug4071 //TA: FIXME: hacky fix to off-by-one bug 4035 4072 listPtr->endPos--; 4036 4073 } … … 4063 4100 4064 4101 if (item->window.flags & WINDOW_HASFOCUS) { 4102 /* lowLight[0] = 0.8 * parent->focusColor[0]; 4103 lowLight[1] = 0.8 * parent->focusColor[1]; 4104 lowLight[2] = 0.8 * parent->focusColor[2]; 4105 lowLight[3] = 0.8 * parent->focusColor[3]; 4106 LerpColor(parent->focusColor,lowLight,color,0.5+0.5*sin(DC->realTime / PULSE_DIVISOR));*/ 4107 //TA: 4065 4108 memcpy(color, &parent->focusColor, sizeof(vec4_t)); 4066 4109 } else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime/BLINK_DIVISOR) & 1)) { … … 4073 4116 4074 4117 if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) { 4075 Com_Memcpy(color, parent->disableColor, sizeof(vec4_t));4118 memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy 4076 4119 } 4077 4120 … … 4375 4418 m = &Menus[i]; 4376 4419 Menus_Activate(m); 4377 Menu_HandleMouseMove( m, DC->cursorx, DC->cursory ); // force the item under the cursor to focus4378 4379 for( j = 0; j < m->itemCount; j++ ) // reset selection in listboxes when opened4420 Menu_HandleMouseMove( m, DC->cursorx, DC->cursory ); //TA: force the item under the cursor to focus 4421 4422 for( j = 0; j < m->itemCount; j++ ) //TA: reset selection in listboxes when opened 4380 4423 { 4381 4424 if( m->items[ j ]->type == ITEM_TYPE_LISTBOX ) … … 5214 5257 5215 5258 } 5216 return qfalse; 5259 return qfalse; // bk001205 - LCC missing return value 5217 5260 } 5218 5261 … … 5259 5302 5260 5303 } 5261 return qfalse; 5304 return qfalse; // bk001205 - LCC missing return value 5262 5305 } 5263 5306 … … 5439 5482 } 5440 5483 } 5441 return qfalse; 5484 return qfalse; // bk001205 - LCC missing return value 5442 5485 } 5443 5486 … … 5493 5536 qboolean MenuParse_fullscreen( itemDef_t *item, int handle ) { 5494 5537 menuDef_t *menu = (menuDef_t*)item; 5495 if (!PC_Int_Parse(handle, (int*) &menu->fullScreen)) { 5538 if (!PC_Int_Parse(handle, (int*) &menu->fullScreen)) { // bk001206 - cast qboolean 5496 5539 return qfalse; 5497 5540 } … … 5843 5886 } 5844 5887 } 5845 return qfalse; 5888 return qfalse; // bk001205 - LCC missing return value 5846 5889 } 5847 5890 -
ui/infopanes.def.h
r7 r0 1 #include " ../src/game/tremulous.h"1 #include "/home/tma/tremulous/src/game/tremulous.h" 2 2 3 3 #define CREDITS(X) text "Credits: " text X -
ui/menudef.h
r118 r0 69 69 #define FEEDER_CINEMATICS 0x0f // cinematics 70 70 71 //TA: tremulous menus 71 72 #define FEEDER_TREMTEAMS 0x10 //teams 72 73 #define FEEDER_TREMALIENCLASSES 0x11 //alien classes … … 77 78 #define FEEDER_TREMALIENBUILD 0x16 //alien buildables 78 79 #define FEEDER_TREMHUMANBUILD 0x17 //human buildables 80 //TA: tremulous menus 79 81 #define FEEDER_IGNORE_LIST 0x18 //ignored players 80 82 … … 228 230 #define CG_CAPTURES 69 229 231 230 // loading screen232 //TA: loading screen 231 233 #define CG_LOAD_LEVELSHOT 76 232 234 #define CG_LOAD_MEDIA 77 … … 316 318 #define UI_MAPS_SELECTION 256 317 319 320 //TA: 318 321 //#define UI_DIALOG 257 319 322 #define UI_TEAMINFOPANE 258
