Skip to content

Commit

Permalink
game: sync g_target.c
Browse files Browse the repository at this point in the history
  • Loading branch information
0lvin committed Nov 6, 2024
1 parent b0516fe commit 34c6a65
Show file tree
Hide file tree
Showing 6 changed files with 1,211 additions and 299 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ endif

# ----------

# Builds everything
# Builds everything but the GLES1 renderer
all: config client server game ref_gl1 ref_gl3 ref_gles3 ref_soft ref_vk ref_gl4 player effects

# ----------
Expand Down Expand Up @@ -1018,6 +1018,7 @@ GAME_OBJS_ = \
src/game/game_utilities.o \
src/game/g_breakable.o \
src/game/g_classstatics.o \
src/game/g_chase.o \
src/game/g_cmds.o \
src/game/g_combat.o \
src/game/g_defaultmessagehandler.o \
Expand Down
94 changes: 0 additions & 94 deletions src/game/g_field.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,100 +71,6 @@ void SP_trigger_fogdensity(edict_t *self)
}


//----------------------------------------------------------------------
// Force Field
//----------------------------------------------------------------------

#define FIELD_FORCE_ONCE 1


void push_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
vec3_t forward,up;

if(other->health > 0)
{
if (other->client) // A player???
{
// don't take falling damage immediately from this
VectorCopy(other->velocity, other->client->playerinfo.oldvelocity);
other->client->playerinfo.flags |= PLAYER_FLAG_USE_ENT_POS;
other->groundentity = NULL;
}

AngleVectors(self->s.angles,forward,NULL,up);

VectorMA(other->velocity,self->speed,forward,other->velocity);
VectorMA(other->velocity,self->speed,up,other->velocity);

}

G_UseTargets(self, self);

if(self->spawnflags & FIELD_FORCE_ONCE)
{
G_FreeEdict (self);
}
}

void push_touch_trigger(edict_t *self, edict_t *activator)
{
push_touch(self,activator,NULL,NULL);
}

void TrigPush_Deactivate(edict_t *self, G_Message_t *msg)
{
self->solid = SOLID_NOT;
self->touch = NULL;
}


void TrigPush_Activate(edict_t *self, G_Message_t *msg)
{
self->solid = SOLID_TRIGGER;
self->touch = push_touch;
gi.linkentity (self);
}


void TrigPushStaticsInit()
{
classStatics[CID_TRIG_PUSH].msgReceivers[G_MSG_SUSPEND] = TrigPush_Deactivate;
classStatics[CID_TRIG_PUSH].msgReceivers[G_MSG_UNSUSPEND] = TrigPush_Activate;
}

/*QUAKED trigger_push (.5 .5 .5) ? FORCE_ONCE
Pushes the player
---------KEYS----------
speed - how fast the player is pushed (default 500)
angle - the angle to push the player along the X,Y
zangle - the up direction to push the player (0 is straight up, 180 is straight down)
------------------------------------
-------FLAGS---------------
FORCE_ONCE - pushes once and then goes away
------------------------------------
*/
void SP_trigger_push(edict_t *self)
{
InitTrigger(self);
self->solid = SOLID_TRIGGER;
self->msgHandler = DefaultMsgHandler;
self->classID = CID_TRIG_PUSH;

if (!self->speed)
{
self->speed = 500;
}

self->s.angles[2] = st.zangle;

// Can't really use the normal trigger setup cause it doesn't update velocity often enough
self->touch = push_touch;
self->TriggerActivated = push_touch_trigger;
}



//----------------------------------------------------------------------
// Damage Field
//----------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 34c6a65

Please sign in to comment.