From 45f8c08ceffb62994f4a5fff0c882fde9f2b97c3 Mon Sep 17 00:00:00 2001 From: q3rally Date: Sat, 30 Jul 2011 04:59:56 +0000 Subject: [PATCH] Added target_gravity from EntityPlus --- engine/code/game/bg_public.h | 2 +- engine/code/game/g_spawn.c | 2 ++ engine/code/game/g_target.c | 25 +++++++++++++++++++++++++ q3rallycode.ppr | 15 ++++++++++++--- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/engine/code/game/bg_public.h b/engine/code/game/bg_public.h index db7e177f..74efd411 100644 --- a/engine/code/game/bg_public.h +++ b/engine/code/game/bg_public.h @@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // second version that must match between game and cgame // STONELANCE -#define GAME_VERSION "Q3Rally v0.0.0.2" +#define GAME_VERSION "Q3Rally v0.0.0.3" // END #define DEFAULT_GRAVITY 800 diff --git a/engine/code/game/g_spawn.c b/engine/code/game/g_spawn.c index e15b34e3..97a7693e 100644 --- a/engine/code/game/g_spawn.c +++ b/engine/code/game/g_spawn.c @@ -164,6 +164,7 @@ void SP_target_kill (gentity_t *ent); void SP_target_position (gentity_t *ent); void SP_target_location (gentity_t *ent); void SP_target_push (gentity_t *ent); +void SP_target_gravity (gentity_t *ent); void SP_target_earthquake (gentity_t *ent); void SP_light (gentity_t *self); @@ -263,6 +264,7 @@ spawn_t spawns[] = { {"target_position", SP_target_position}, {"target_location", SP_target_location}, {"target_push", SP_target_push}, + {"target_gravity", SP_target_gravity}, {"target_earthquake", SP_target_earthquake}, {"light", SP_light}, diff --git a/engine/code/game/g_target.c b/engine/code/game/g_target.c index 9615a37c..e44e1fbd 100644 --- a/engine/code/game/g_target.c +++ b/engine/code/game/g_target.c @@ -468,6 +468,31 @@ void SP_target_location( gentity_t *self ){ //========================================================== +/*QUAKED target_gravity (.5 .5 .5) (-8 -8 -8) (8 8 8) GLOBAL +Sets the gravity of the activator. The gravity is set through the "count" key. +If GLOBAL is checked, all players in the game will have their gravity changed. +*/ +void target_gravity_use (gentity_t *self, gentity_t *other, gentity_t *activator) { + int i; + + if ( !self->count ) + self->count = g_gravity.integer; + + if ( (self->spawnflags & 1) ) + { + for (i = 0; i < level.maxclients; i++) + { + level.clients[i].ps.gravity = self->count; + } + } + else + activator->client->ps.gravity = self->count; +} + +void SP_target_gravity (gentity_t *self) { + self->use = target_gravity_use; +} + /*QUAKED target_earthquake (.5 .5 .5) (-8 -8 -8) (8 8 8) starts earthquake "length" - length in seconds (2-32, in steps of 2) diff --git a/q3rallycode.ppr b/q3rallycode.ppr index 064bc667..27badfd9 100644 --- a/q3rallycode.ppr +++ b/q3rallycode.ppr @@ -13,7 +13,7 @@ ProjectFilesOnly=0 [Project tree] q3rallycode +engine - +code + -code -AL engine\code\AL\al.h engine\code\AL\alc.h @@ -483,7 +483,7 @@ q3rallycode engine\code\q3_ui\ui_team.c engine\code\q3_ui\ui_teamorders.c engine\code\q3_ui\ui_video.c - +qcommon + -qcommon engine\code\qcommon\cm_load.c engine\code\qcommon\cm_local.h engine\code\qcommon\cm_patch.c @@ -852,15 +852,24 @@ q3rallycode engine\README engine\TODO engine\voip-readme.txt + engine\resync_svn.sh [Open project files] 0=engine\code\cgame\cg_ents.c 1=engine\code\qcommon\files.c +2=engine\code\game\bg_public.h +3=engine\resync_svn.sh [Selected Project Files] Main= -Selected=engine\code\qcommon\files.c +Selected=engine\code\cgame\cg_ents.c [engine\code\cgame\cg_ents.c] TopLine=121 Caret=1,1 [engine\code\qcommon\files.c] TopLine=177 Caret=34,201 +[engine\code\game\bg_public.h] +TopLine=1 +Caret=50,34 +[engine\resync_svn.sh] +TopLine=386 +Caret=1,1