Fixed env_sprite functionality.
Moved some things around.
This commit is contained in:
parent
c4eb753f63
commit
0e7fcf8012
17 changed files with 231 additions and 101 deletions
|
@ -551,6 +551,8 @@ void CSQC_Parse_Event(void) {
|
|||
Sound_PlayVOX(readstring());
|
||||
} else if (fHeader == EV_FADE) {
|
||||
Fade_Parse();
|
||||
} else if (fHeader == EV_SPRITE) {
|
||||
Sprite_ParseEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ Defs.h
|
|||
|
||||
../Shared/pmove.c
|
||||
|
||||
../gs-entbase/client/fade.cpp
|
||||
../gs-entbase/client.src
|
||||
|
||||
../Shared/spraylogo.cpp
|
||||
Overview.c
|
||||
|
|
|
@ -253,6 +253,7 @@ enum {
|
|||
EV_FLASH,
|
||||
EV_SHAKE,
|
||||
EV_FADE,
|
||||
EV_SPRITE,
|
||||
EV_MODELGIB,
|
||||
EV_CAMERATRIGGER,
|
||||
EV_RADIOMSG,
|
||||
|
|
|
@ -154,7 +154,6 @@ void armoury_entity( void ) {
|
|||
self.touch = armoury_entity_touch;
|
||||
droptofloor();
|
||||
}
|
||||
|
||||
if ( autocvar_fcs_nopickups == TRUE ) {
|
||||
remove( self );
|
||||
return;
|
||||
|
@ -163,7 +162,7 @@ void armoury_entity( void ) {
|
|||
precache_model( sArmouryModels[ self.item ] );
|
||||
setmodel( self, sArmouryModels[ self.item ] );
|
||||
setsize( self, '-16 -16 0', '16 16 16' );
|
||||
|
||||
|
||||
armoury_entity_respawn();
|
||||
Entities_InitRespawnable( armoury_entity_respawn );
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ void func_pushable( void ) {
|
|||
self.iBleeds = FALSE;
|
||||
self.iUsable = TRUE;
|
||||
}
|
||||
|
||||
|
||||
func_wall();
|
||||
func_pushable_respawn();
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
../Math.h
|
||||
Defs.h
|
||||
DefsFields.h
|
||||
../gs-entbase/server/defs.h
|
||||
|
||||
../gs-entbase/server.src
|
||||
|
||||
Money.c
|
||||
../Shared/Animations.c
|
||||
|
@ -46,6 +47,7 @@ Money.c
|
|||
../Shared/Equipment.c
|
||||
../Shared/spraylogo.cpp
|
||||
../Shared/pmove.c
|
||||
|
||||
Vox.c
|
||||
Ammo.c
|
||||
Damage.c
|
||||
|
@ -55,56 +57,6 @@ Timer.c
|
|||
|
||||
EntHostage.c
|
||||
|
||||
../gs-entbase/server/baseentity.cpp
|
||||
../gs-entbase/server/basetrigger.cpp
|
||||
../gs-entbase/server/ambient_generic.cpp
|
||||
../gs-entbase/server/env_beam.cpp
|
||||
../gs-entbase/server/env_fade.cpp
|
||||
../gs-entbase/server/env_sprite.cpp
|
||||
../gs-entbase/server/env_spark.cpp
|
||||
../gs-entbase/server/env_explosion.cpp
|
||||
../gs-entbase/server/env_render.cpp
|
||||
../gs-entbase/server/env_glow.cpp
|
||||
../gs-entbase/server/env_shake.cpp
|
||||
../gs-entbase/server/func_recharge.cpp
|
||||
../gs-entbase/server/func_healthcharger.cpp
|
||||
../gs-entbase/server/func_breakable.cpp
|
||||
../gs-entbase/server/func_button.cpp
|
||||
../gs-entbase/server/func_door.cpp
|
||||
../gs-entbase/server/func_door_rotating.cpp
|
||||
../gs-entbase/server/func_illusionary.cpp
|
||||
//../gs-entbase/server/func_ladder.cpp
|
||||
FuncLadder.c
|
||||
../gs-entbase/server/func_train.cpp
|
||||
../gs-entbase/server/func_wall.cpp
|
||||
../gs-entbase/server/func_wall_toggle.cpp
|
||||
../gs-entbase/server/func_conveyor.cpp
|
||||
../gs-entbase/server/func_rotating.cpp
|
||||
../gs-entbase/server/light.cpp
|
||||
../gs-entbase/server/stubs.cpp
|
||||
../gs-entbase/server/trigger_auto.cpp
|
||||
../gs-entbase/server/trigger_cdaudio.cpp
|
||||
../gs-entbase/server/trigger_camera.cpp
|
||||
../gs-entbase/server/trigger_hurt.cpp
|
||||
../gs-entbase/server/trigger_changelevel.cpp
|
||||
../gs-entbase/server/trigger_once.cpp
|
||||
../gs-entbase/server/trigger_multiple.cpp
|
||||
../gs-entbase/server/trigger_push.cpp
|
||||
../gs-entbase/server/trigger_teleport.cpp
|
||||
../gs-entbase/server/trigger_transition.cpp
|
||||
../gs-entbase/server/trigger_relay.cpp
|
||||
../gs-entbase/server/env_shooter.cpp
|
||||
../gs-entbase/server/env_beverage.cpp
|
||||
../gs-entbase/server/env_global.cpp
|
||||
../gs-entbase/server/item_food.cpp
|
||||
../gs-entbase/server/item_suit.cpp
|
||||
../gs-entbase/server/multi_manager.cpp
|
||||
../gs-entbase/server/monster_furniture.cpp
|
||||
../gs-entbase/server/monster_generic.cpp
|
||||
../gs-entbase/server/multisource.cpp
|
||||
../gs-entbase/server/scripted_sequence.cpp
|
||||
//../gs-entbase/server/info_player_start.cpp
|
||||
//../gs-entbase/server/info_player_deathmatch.cpp
|
||||
Entities.c
|
||||
FuncHostageRescue.c
|
||||
FuncEscapeZone.c
|
||||
|
@ -112,8 +64,6 @@ FuncBombTarget.c
|
|||
FuncBuyZone.c
|
||||
FuncVIPSafetyZone.c
|
||||
|
||||
|
||||
InfoDecal.c
|
||||
ArmouryEntity.c
|
||||
|
||||
Bot/Bot.h
|
||||
|
|
|
@ -79,7 +79,7 @@ void PMove_Categorize(void)
|
|||
tracebox( self.origin, self.mins, self.maxs, self.origin, FALSE, self );
|
||||
self.hitcontentsmaski = oldhitcontents;
|
||||
|
||||
print(sprintf( "Contents: %i\n", trace_endcontentsi));
|
||||
//print(sprintf( "Contents: %i\n", trace_endcontentsi));
|
||||
|
||||
if (trace_endcontentsi & CONTENTBIT_WATER) {
|
||||
contents = CONTENT_WATER;
|
||||
|
|
4
Source/gs-entbase/client.src
Normal file
4
Source/gs-entbase/client.src
Normal file
|
@ -0,0 +1,4 @@
|
|||
#includelist
|
||||
../gs-entbase/client/fade.cpp
|
||||
../gs-entbase/client/sprite.cpp
|
||||
#endlist
|
55
Source/gs-entbase/client/sprite.cpp
Normal file
55
Source/gs-entbase/client/sprite.cpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
.float framerate;
|
||||
|
||||
void Sprite_AnimateThink( void ) {
|
||||
if( self.frame >= self.maxframe ) {
|
||||
if (self.health == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
self.frame = 0;
|
||||
}
|
||||
} else {
|
||||
self.frame += 1;
|
||||
}
|
||||
|
||||
self.nextthink = time + ( 1 / self.framerate );
|
||||
}
|
||||
|
||||
void Sprite_Animated( vector vPos, float fIndex, float fFPS, float fScale, float fAlpha, float fEffects ) {
|
||||
self.modelindex = fIndex;
|
||||
setorigin( self, vPos );
|
||||
self.scale = fScale;
|
||||
self.alpha = fAlpha;
|
||||
self.effects = fEffects;
|
||||
self.framerate = fFPS;
|
||||
self.think = Sprite_AnimateThink;
|
||||
self.drawmask = MASK_ENGINE;
|
||||
self.nextthink = time + ( 1 / self.framerate );
|
||||
self.maxframe = modelframecount( self.modelindex );
|
||||
self.health = 0; /* repeats */
|
||||
}
|
||||
|
||||
void Sprite_ParseEvent(void)
|
||||
{
|
||||
entity sprite = spawn();
|
||||
sprite.origin_x = readcoord();
|
||||
sprite.origin_y = readcoord();
|
||||
sprite.origin_z = readcoord();
|
||||
sprite.modelindex = readfloat();
|
||||
sprite.framerate = readfloat();
|
||||
sprite.scale = readfloat();
|
||||
sprite.alpha = readfloat();
|
||||
sprite.effects = readfloat();
|
||||
sprite.think = Sprite_AnimateThink;
|
||||
sprite.drawmask = MASK_ENGINE;
|
||||
sprite.nextthink = time + ( 1 / self.framerate );
|
||||
sprite.maxframe = modelframecount( self.modelindex );
|
||||
sprite.health = 1; /* does not repeat */
|
||||
}
|
51
Source/gs-entbase/server.src
Normal file
51
Source/gs-entbase/server.src
Normal file
|
@ -0,0 +1,51 @@
|
|||
#includelist
|
||||
../gs-entbase/server/defs.h
|
||||
../gs-entbase/server/baseentity.cpp
|
||||
../gs-entbase/server/basetrigger.cpp
|
||||
../gs-entbase/server/ambient_generic.cpp
|
||||
../gs-entbase/server/env_beam.cpp
|
||||
../gs-entbase/server/env_fade.cpp
|
||||
../gs-entbase/server/env_sprite.cpp
|
||||
../gs-entbase/server/env_spark.cpp
|
||||
../gs-entbase/server/env_explosion.cpp
|
||||
../gs-entbase/server/env_render.cpp
|
||||
../gs-entbase/server/env_glow.cpp
|
||||
../gs-entbase/server/env_shake.cpp
|
||||
../gs-entbase/server/func_recharge.cpp
|
||||
../gs-entbase/server/func_healthcharger.cpp
|
||||
../gs-entbase/server/func_breakable.cpp
|
||||
../gs-entbase/server/func_button.cpp
|
||||
../gs-entbase/server/func_door.cpp
|
||||
../gs-entbase/server/func_door_rotating.cpp
|
||||
../gs-entbase/server/func_illusionary.cpp
|
||||
../gs-entbase/server/func_ladder.cpp
|
||||
../gs-entbase/server/func_train.cpp
|
||||
../gs-entbase/server/func_wall.cpp
|
||||
../gs-entbase/server/func_wall_toggle.cpp
|
||||
../gs-entbase/server/func_conveyor.cpp
|
||||
../gs-entbase/server/func_rotating.cpp
|
||||
../gs-entbase/server/light.cpp
|
||||
../gs-entbase/server/stubs.cpp
|
||||
../gs-entbase/server/infodecal.cpp
|
||||
../gs-entbase/server/trigger_auto.cpp
|
||||
../gs-entbase/server/trigger_cdaudio.cpp
|
||||
../gs-entbase/server/trigger_camera.cpp
|
||||
../gs-entbase/server/trigger_hurt.cpp
|
||||
../gs-entbase/server/trigger_changelevel.cpp
|
||||
../gs-entbase/server/trigger_once.cpp
|
||||
../gs-entbase/server/trigger_multiple.cpp
|
||||
../gs-entbase/server/trigger_push.cpp
|
||||
../gs-entbase/server/trigger_teleport.cpp
|
||||
../gs-entbase/server/trigger_transition.cpp
|
||||
../gs-entbase/server/trigger_relay.cpp
|
||||
../gs-entbase/server/env_shooter.cpp
|
||||
../gs-entbase/server/env_beverage.cpp
|
||||
../gs-entbase/server/env_global.cpp
|
||||
../gs-entbase/server/item_food.cpp
|
||||
../gs-entbase/server/item_suit.cpp
|
||||
../gs-entbase/server/multi_manager.cpp
|
||||
../gs-entbase/server/monster_furniture.cpp
|
||||
../gs-entbase/server/monster_generic.cpp
|
||||
../gs-entbase/server/multisource.cpp
|
||||
../gs-entbase/server/scripted_sequence.cpp
|
||||
#endlist
|
|
@ -28,3 +28,6 @@ enumflags
|
|||
GF_BLOCKING,
|
||||
GF_BOT_POI
|
||||
};
|
||||
|
||||
void Effect_CreateSpark(vector pos, vector ang);
|
||||
void Effect_BreakModel(vector mins, vector maxs,vector vel, float mat);
|
||||
|
|
|
@ -14,17 +14,52 @@ enumflags
|
|||
ENVS_PLAYONCE
|
||||
};
|
||||
|
||||
class env_sprite : CBaseTrigger
|
||||
class env_sprite:CBaseTrigger
|
||||
{
|
||||
int m_iToggled;
|
||||
void() env_sprite;
|
||||
virtual void() Trigger;
|
||||
virtual float(entity, float) Network;
|
||||
};
|
||||
|
||||
float env_sprite::Network(entity pvsent, float flags)
|
||||
{
|
||||
/* Delete it on the client. */
|
||||
if (m_iToggled == FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
WriteByte(MSG_ENTITY, ENT_SPRITE);
|
||||
WriteCoord(MSG_ENTITY, origin_x);
|
||||
WriteCoord(MSG_ENTITY, origin_y);
|
||||
WriteCoord(MSG_ENTITY, origin_z);
|
||||
WriteFloat(MSG_ENTITY, modelindex);
|
||||
WriteFloat(MSG_ENTITY, framerate);
|
||||
WriteFloat(MSG_ENTITY, scale);
|
||||
WriteFloat(MSG_ENTITY, alpha);
|
||||
WriteFloat(MSG_ENTITY, effects);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void env_sprite::NetworkOnce(void)
|
||||
{
|
||||
WriteByte(MSG_ENTITY, EV_SPRITE);
|
||||
WriteCoord(MSG_ENTITY, origin_x);
|
||||
WriteCoord(MSG_ENTITY, origin_y);
|
||||
WriteCoord(MSG_ENTITY, origin_z);
|
||||
WriteFloat(MSG_ENTITY, modelindex);
|
||||
WriteFloat(MSG_ENTITY, framerate);
|
||||
WriteFloat(MSG_ENTITY, scale);
|
||||
WriteFloat(MSG_ENTITY, alpha);
|
||||
WriteFloat(MSG_ENTITY, effects);
|
||||
}
|
||||
|
||||
void env_sprite::Trigger(void)
|
||||
{
|
||||
Respawn();
|
||||
if (spawnflags & ENVS_PLAYONCE) {
|
||||
|
||||
NetworkOnce();
|
||||
} else {
|
||||
m_iToggled = 1 - m_iToggled;
|
||||
SendFlags = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +68,11 @@ void env_sprite::env_sprite(void)
|
|||
CBaseTrigger::CBaseTrigger();
|
||||
precache_model(m_oldModel);
|
||||
Respawn();
|
||||
|
||||
if (!(spawnflags & ENVS_STARTON)) {
|
||||
Hide();
|
||||
|
||||
m_iToggled = ((spawnflags & ENVS_STARTON) > 0);
|
||||
|
||||
if (!(spawnflags & ENVS_PLAYONCE)) {
|
||||
SendEntity = Network;
|
||||
SendFlags = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ void func_button :: func_button( void )
|
|||
|
||||
m_vecPos1 = origin;
|
||||
|
||||
if ( spawnflags & SF_BTT_NOMOVE ) {
|
||||
if (spawnflags & SF_BTT_NOMOVE) {
|
||||
m_vecPos2 = m_vecPos1;
|
||||
} else {
|
||||
m_vecPos2 = ( m_vecPos1 + movedir * ( fabs( movedir * size ) - m_flLip ) );
|
||||
|
|
|
@ -109,7 +109,7 @@ void func_door :: Returned (void)
|
|||
if (!(spawnflags & SF_MOV_USE)) {
|
||||
touch = Touch;
|
||||
}
|
||||
|
||||
|
||||
m_iState = STATE_LOWERED;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ void func_door :: MoveBack (void)
|
|||
if (!(spawnflags & SF_MOV_USE)) {
|
||||
touch = __NULL__;
|
||||
}
|
||||
|
||||
|
||||
m_iState = STATE_DOWN;
|
||||
MoveToDestination(m_vecPos1, Returned);
|
||||
}
|
||||
|
@ -287,7 +287,8 @@ void func_door :: MoveToDestination (vector vDestination, void() func)
|
|||
float fTravelTime;
|
||||
|
||||
if (!m_flSpeed) {
|
||||
objerror("No speed defined for moving entity! Will not divide by zero.");
|
||||
objerror("func_door: No speed defined!");
|
||||
return;
|
||||
}
|
||||
|
||||
m_pMove = func;
|
||||
|
|
|
@ -6,22 +6,66 @@
|
|||
*
|
||||
****/
|
||||
|
||||
class func_ladder : CBaseEntity {
|
||||
void() func_ladder;
|
||||
string g_laddersnd[] = {
|
||||
"player/pl_ladder1.wav",
|
||||
"player/pl_ladder2.wav",
|
||||
"player/pl_ladder3.wav",
|
||||
"player/pl_ladder4.wav"
|
||||
};
|
||||
|
||||
class func_ladder:CBaseEntity
|
||||
{
|
||||
void() func_ladder;
|
||||
virtual void() touch;
|
||||
virtual void(entity) Sound;
|
||||
};
|
||||
|
||||
void func_ladder::Sound(entity target)
|
||||
{
|
||||
int r;
|
||||
if ((target.velocity_z == 0) || (target.fStepTime > time)) {
|
||||
return;
|
||||
}
|
||||
r = floor(random() * g_laddersnd.length);
|
||||
sound(target, CHAN_BODY, g_laddersnd[r], 0.5, ATTN_IDLE);
|
||||
target.fStepTime = time + 0.4;
|
||||
}
|
||||
|
||||
void func_ladder::touch(void)
|
||||
{
|
||||
if (other.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
vector vPlayerVector;
|
||||
makevectors(other.v_angle);
|
||||
vPlayerVector = v_forward;
|
||||
vPlayerVector = (vPlayerVector * 240);
|
||||
|
||||
if (other.movement_x > 0) {
|
||||
other.velocity = vPlayerVector;
|
||||
} else {
|
||||
other.velocity = [0,0,0];
|
||||
}
|
||||
|
||||
Sound(other);
|
||||
}
|
||||
|
||||
void func_ladder :: func_ladder ( void )
|
||||
{
|
||||
setmodel( this, model );
|
||||
for (int i = 0; i < g_laddersnd.length; i++) {
|
||||
precache_sound(g_laddersnd[i]);
|
||||
}
|
||||
|
||||
angles = [0,0,0];
|
||||
movetype = MOVETYPE_NONE;
|
||||
skin = CONTENT_LADDER;
|
||||
solid = SOLID_BSP;
|
||||
|
||||
solid = SOLID_TRIGGER;
|
||||
setmodel(this, model);
|
||||
|
||||
#ifdef GS_DEVELOPER
|
||||
alpha = 0.5f;
|
||||
effects = EF_ADDITIVE;
|
||||
#else
|
||||
effects = EF_NODRAW;
|
||||
alpha = 0.0001f;
|
||||
model = 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,28 +1,10 @@
|
|||
/*
|
||||
Copyright 2016-2018 Marco "eukara" Hladik
|
||||
|
||||
MIT LICENSE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/* We need to save trace infos temporarily in order to figure out what to
|
||||
* project the decal against. Half-Life's infodecal entity only stores origin,
|
Loading…
Reference in a new issue