From dfd8dea02e3f9b5cfed1c8fb58504454a716c6e5 Mon Sep 17 00:00:00 2001 From: Walter Julius Hennecke Date: Sun, 21 Jul 2013 01:34:09 +0200 Subject: [PATCH] Added multiple things ... --- code/cgame/cg_local.h | 4 +- code/cgame/cg_servercmds.c | 20 +++++++ code/game/g_active.c | 1 - code/game/g_breakable.c | 8 +++ code/game/g_cinematic.c | 1 + code/game/g_client.c | 6 +- code/game/g_fx.c | 51 ++++++++++++++++- code/game/g_local.h | 114 +++++++++++++++++++++++++++++++++++++ code/game/g_misc.c | 13 +++++ code/game/g_mover.c | 43 +++++++++++++- code/game/g_spawn.h | 4 -- code/game/g_target.c | 54 ++++++++++++++++++ code/game/g_trigger.c | 19 +++++++ code/game/g_turrets.c | 3 + code/game/g_ui.c | 4 ++ code/game/g_usable.c | 2 + code/game/g_utils.c | 1 + code/game/q_shared.h | 8 +-- 18 files changed, 342 insertions(+), 14 deletions(-) diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index 9f5beed..1b7600c 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -1408,7 +1408,6 @@ typedef struct { } cgMedia_t; - // The client game static (cgs) structure hold everything // loaded or calculated from the gamestate. It will NOT // be cleared when a tournement restart is done, allowing @@ -1502,6 +1501,9 @@ typedef struct { char scannableStrings[MAX_SCANNABLES][36]; qboolean scannablePanels; + + // sound zones + uint8_t clientSoundZone; } cgs_t; //============================================================================== diff --git a/code/cgame/cg_servercmds.c b/code/cgame/cg_servercmds.c index 8b8857a..97be0ee 100644 --- a/code/cgame/cg_servercmds.c +++ b/code/cgame/cg_servercmds.c @@ -931,6 +931,26 @@ static void CG_ServerCommand( void ) { return; } + /* update the sound sone information */ + if(strcmp(cmd, "slup") == 0) { + char key[8]; + const char* sinfo = CG_Argv(1); + const char* value = NULL; + + if(sinfo == NULL) { + return; + } + + Com_sprintf(key, sizeof(char) * 8, "c%d", cg.snap->ps.clientNum); + value = Info_ValueForKey(sinfo, key); + + if(strcmp(value, "") == 0) { + cgs.clientSoundZone = 0; + } else { + cgs.clientSoundZone = atoi(value); + } + } + CG_Printf( "Unknown client game command: %s\n", cmd ); } diff --git a/code/game/g_active.c b/code/game/g_active.c index f1d61fe..618f030 100644 --- a/code/game/g_active.c +++ b/code/game/g_active.c @@ -7,7 +7,6 @@ #include "g_cmds.h" #include "g_items.h" -extern void SP_misc_ammo_station( gentity_t *ent ); extern void ammo_station_finish_spawning ( gentity_t *self ); /* diff --git a/code/game/g_breakable.c b/code/game/g_breakable.c index 39d7752..d09dc6a 100644 --- a/code/game/g_breakable.c +++ b/code/game/g_breakable.c @@ -316,6 +316,8 @@ In the unlikely event that we do have an origin brush this is the code: */ void SP_func_breakable( gentity_t *self ) { + self->type = ENT_FUNC_BREAKABLE; + if((self->spawnflags & 1) == 0) { if(self->health == 0) { self->health = 10; @@ -427,6 +429,8 @@ void SP_misc_model_breakable( gentity_t *ent ) entityShared_t* eShared = &ent->r; entityState_t* eState = &ent->s; + ent->type = ENT_MISC_MODEL_BREAKABLE; + //Main model eState->modelindex = ent->sound2to1 = G_ModelIndex( ent->model ); @@ -672,6 +676,8 @@ none */ void SP_misc_ammo_station( gentity_t *ent ) { + ent->type = ENT_MISC_AMMOSTATION; + if (ent->health == 0) { ent->health = 60; } @@ -789,6 +795,8 @@ void target_repair_link(gentity_t *ent) { * Spawn function of target_repair entity */ void SP_target_repair(gentity_t *ent) { + ent->type = ENT_TARGET_REPAIR; + if(ent->target == NULL) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_repair without target at %s\n", vtos(ent->s.origin));); return; diff --git a/code/game/g_cinematic.c b/code/game/g_cinematic.c index 2f3dec6..019b7b1 100644 --- a/code/game/g_cinematic.c +++ b/code/game/g_cinematic.c @@ -19,6 +19,7 @@ none To be written later. */ void SP_cinematic_camera(gentity_t *ent) { + ent->type = ENT_CINEMATIC_CAMMERA; trap_LinkEntity(ent); InitMover(ent); } diff --git a/code/game/g_client.c b/code/game/g_client.c index 81466a7..3a1e525 100644 --- a/code/game/g_client.c +++ b/code/game/g_client.c @@ -59,6 +59,8 @@ potential spawning position for deathmatch games. void SP_info_player_deathmatch( gentity_t *ent ) { int32_t i = 0; + ent->type = ENT_INFO_PLAYER_START; + if(strcmp(ent->classname, "info_player_deathmatch") != 0) { ent->classname = G_NewString("info_player_deathmatch"); } @@ -90,7 +92,9 @@ none /** * Spawn function for intermission entity. */ -void SP_info_player_intermission( gentity_t *ent ) { } +void SP_info_player_intermission( gentity_t *ent ) { + ent->type = ENT_INFO_PLAYER_INTERMISSION; +} /** * Determine whether spot would telefrag. diff --git a/code/game/g_fx.c b/code/game/g_fx.c index 77edebf..7373f93 100644 --- a/code/game/g_fx.c +++ b/code/game/g_fx.c @@ -96,6 +96,8 @@ static void spark_link( gentity_t *ent ) //------------------------------------------ void SP_fx_spark( gentity_t *ent ) { + ent->type = ENT_FX_SPARK; + if (ent->wait <= 0) { ent->wait = 2000.0; @@ -259,6 +261,8 @@ static void steam_link( gentity_t *ent ) //------------------------------------------ void SP_fx_steam( gentity_t *ent ) { + ent->type = ENT_FX_STEAM; + SnapVector(ent->s.origin); VectorCopy( ent->s.origin, ent->s.pos.trBase ); trap_LinkEntity( ent ); @@ -399,6 +403,8 @@ static void bolt_link( gentity_t *ent ) //------------------------------------------ void SP_fx_bolt( gentity_t *ent ) { + ent->type = ENT_FX_BOLT; + G_SpawnInt( "damage", "0", &ent->damage ); G_SpawnFloat( "random", "0.5", &ent->random ); G_SpawnFloat( "speed", "15.0", &ent->speed ); @@ -444,6 +450,8 @@ static void transporter_link( gentity_t *ent ) //------------------------------------------ void SP_fx_transporter(gentity_t *ent) { + ent->type = ENT_FX_TRANSPORTER; + SnapVector(ent->s.origin); VectorCopy( ent->s.origin, ent->s.pos.trBase ); @@ -482,8 +490,9 @@ static void drip_think( gentity_t *ent ) //------------------------------------------ void SP_fx_drip( gentity_t *ent ) { - ent->s.time2 = ent->damage; + ent->type = ENT_FX_DRIP; + ent->s.time2 = ent->damage; ent->s.angles2[0] = ent->random; SnapVector(ent->s.origin); @@ -543,6 +552,8 @@ static void fountain_use( gentity_t *self, /*@unused@*/ gentity_t *other, /*@unu void SP_fx_fountain ( gentity_t *ent ) { gentity_t *target = NULL; + ent->type = ENT_FX_FOUNTAIN; + if ( ent->target != NULL && ent->target[0] != 0 ) { target = G_Find (target, FOFS(targetname), ent->target); } else { @@ -644,6 +655,8 @@ static void surface_explosion_link( gentity_t *ent ) //------------------------------------------ void SP_fx_surface_explosion( gentity_t *ent ) { + ent->type = ENT_FX_SURFACE_EXPLOSION; + if ( (ent->spawnflags & 4) == 0 ){ G_SpawnInt( "damage", "50", &ent->splashDamage ); G_SpawnFloat( "radius", "20", &ent->distance ); // was: ent->radius @@ -728,6 +741,8 @@ static void blow_chunks_link( gentity_t *ent ) //------------------------------------------ void SP_fx_blow_chunks( gentity_t *ent ) { + ent->type = ENT_FX_BLOW_CHUNKS; + G_SpawnFloat( "radius", "65", &ent->distance ); G_SpawnInt( "material", "1", &ent->s.powerups ); @@ -843,6 +858,8 @@ static void smoke_link( gentity_t *ent ) //------------------------------------------ void SP_fx_smoke( gentity_t *ent ) { + ent->type = ENT_FX_SMOKE; + G_SpawnFloat( "radius", "16.0", &ent->distance ); // was: ent->radius VectorCopy( ent->s.origin, ent->s.pos.trBase ); @@ -912,6 +929,8 @@ static void electrical_explosion_link( gentity_t *ent ) //------------------------------------------ void SP_fx_electrical_explosion( gentity_t *ent ) { + ent->type = ENT_FX_ELETRICAL_EXPLOSION; + if ( (ent->spawnflags & 4) == 0 ) { G_SpawnInt( "damage", "20", &ent->splashDamage ); @@ -1004,6 +1023,9 @@ void SP_fx_phaser(gentity_t *ent) { float scale = 0.0f; char *sound = NULL; int impact = 0; + + ent->type = ENT_FX_PHASER; + ent->count = PHASER_FX_UNLINKED; if(ent->target == NULL || ent->target[0] == 0) { @@ -1142,6 +1164,8 @@ static void fx_torpedo_link(gentity_t *ent) { void SP_fx_torpedo(gentity_t *ent) { char *sound; + ent->type = ENT_FX_TORPEDO; + if(ent->target == NULL || ent->target[0] == 0) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] fx_torpedo at %s without target\n", vtos(ent->s.origin));); G_FreeEntity(ent); @@ -1199,6 +1223,9 @@ static void particleFire_use( gentity_t *self, /*@unused@*/ gentity_t *other, /* void SP_fx_particleFire(gentity_t *ent) { int size; + + ent->type = ENT_FX_PARTICLEFIRE; + G_SpawnInt("size", "10", &size); if(size == 0) { ent->count = 10; @@ -1280,6 +1307,8 @@ static void fire_use( gentity_t *self, /*@unused@*/ gentity_t *other, /*@unused@ void SP_fx_fire(gentity_t *ent) { int size; + ent->type = ENT_FX_FIRE; + G_SpawnInt("size", "64", &size); if(size == 0) { ent->s.time = 64; @@ -1360,6 +1389,8 @@ static void cooking_steam_use( gentity_t *self, /*@unused@*/ gentity_t *other, / //------------------------------------------ void SP_fx_cooking_steam( gentity_t *ent ) { + ent->type = ENT_FX_COOKING_STEAM; + if (ent->distance <= 0.0f) { ent->distance = 3.0f; } @@ -1430,6 +1461,8 @@ static void electric_fire_use( gentity_t *self, /*@unused@*/ gentity_t *other, / //------------------------------------------ void SP_fx_electricfire( gentity_t *ent ) { + ent->type = ENT_FX_ELECTRICFIRE; + if (ent->targetname != NULL && ent->targetname[0] != 0) { ent->use = electric_fire_use; } @@ -1589,6 +1622,8 @@ static void forge_bolt_link( gentity_t *ent ) //------------------------------------------ void SP_fx_forge_bolt( gentity_t *ent ) { + ent->type = ENT_FX_FORGE_BOLT; + G_SpawnInt( "damage", "0", &ent->damage ); G_SpawnFloat( "random", "0.4", &ent->random ); G_SpawnFloat( "radius", "3.0", &ent->distance ); @@ -1720,6 +1755,8 @@ void SP_fx_plasma( gentity_t *ent ) { int t; + ent->type = ENT_FX_PLASMA; + G_SpawnVector4("startRGBA", "100 180 255 255", ent->startRGBA); G_SpawnVector4("finalRGBA", "0 0 180 0", ent->finalRGBA); G_SpawnInt( "damage", "0", &ent->damage ); @@ -1844,6 +1881,8 @@ static void stream_link( gentity_t *ent ) //------------------------------------------ void SP_fx_stream( gentity_t *ent ) { + ent->type = ENT_FX_STREAM; + G_SpawnInt( "damage", "0", &ent->damage ); if (ent->targetname != NULL && ent->targetname[0] != 0) { @@ -1944,6 +1983,8 @@ static void transporter_stream_link( gentity_t *ent ) //------------------------------------------ void SP_fx_transporter_stream( gentity_t *ent ) { + ent->type = ENT_FX_TRANSPORTER_STREAM; + VectorCopy( ent->s.origin, ent->s.pos.trBase ); ent->think = transporter_stream_link; @@ -2003,6 +2044,8 @@ static void explosion_trail_link( gentity_t *ent ) //------------------------------------------ void SP_fx_explosion_trail( gentity_t *ent ) { + ent->type = ENT_FX_EXPLOSION_TRAIL; + G_SpawnInt( "damage", "150", &ent->splashDamage ); G_SpawnFloat( "radius", "80", &ent->distance ); @@ -2106,6 +2149,8 @@ void SP_fx_borg_energy_beam( gentity_t *ent ) { int t; + ent->type = ENT_FX_BORG_ENERGY_BEAM; + G_SpawnFloat( "radius", "30", &ent->distance ); G_SpawnFloat( "speed", "100", &ent->speed ); G_SpawnVector4("startRGBA", "0 255 0 128", ent->startRGBA); @@ -2214,6 +2259,8 @@ static void shimmery_thing_link( gentity_t *ent ) //------------------------------------------ void SP_fx_shimmery_thing( gentity_t *ent ) { + ent->type = ENT_FX_SHIMMERY_THING; + G_SpawnFloat( "radius", "10", &ent->s.angles[1] ); if ( ent->wait <= 0.0f ) { ent->wait = 2000.0f; @@ -2333,6 +2380,8 @@ static void borg_bolt_link( gentity_t *ent ) //------------------------------------------ void SP_fx_borg_bolt( gentity_t *ent ) { + ent->type = ENT_FX_BORG_BOLT; + ent->think = borg_bolt_link; ent->nextthink = level.time + 1000; diff --git a/code/game/g_local.h b/code/game/g_local.h index 05d39f2..e98a284 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -182,6 +182,119 @@ typedef enum { //============================================================================ +typedef enum { + ENT_FREE = 0, + ENT_UNKNOWN, + ENT_CUSTOM, + ENT_LIGHT, + ENT_PATH_CORNER, + ENT_PATH_POINT, + ENT_LASER_ARM, + ENT_INFO_NULL = 100, + ENT_INFO_NOTNULL, + ENT_INFO_CAMP, + ENT_INFO_PLAYER_START, + ENT_INFO_PLAYER_INTERMISSION, + ENT_INFO_FIRSTPLACE, + ENT_INFO_SECONDPLACE, + ENT_INFO_THIRDPLACE, + ENT_INFO_PODIUM, + ENT_FUNC_PLAT = 200, + ENT_FUNC_FORCEFIELD, + ENT_FUNC_STATIC, + ENT_FUNC_ROTATING, + ENT_FUNC_BOBBING, + ENT_FUNC_PENDULUM, + ENT_FUNC_BUTTON, + ENT_FUNC_DOOR, + ENT_FUNC_DOOR_ROTATING, + ENT_FUNC_TRAIN, + ENT_FUNC_TIMER, + ENT_FUNC_USABLE, + ENT_FUNC_BRUSHMODEL, + ENT_FUNC_LIGHTCHANGE, + ENT_FUNC_TARGETMOVER, + ENT_FUNC_STASIS_DOOR, + ENT_FUNC_MOVER, + ENT_FUNC_BREAKABLE, + ENT_TRIGGER_ALWAYS = 300, + ENT_TRIGGER_MULTIPLE, + ENT_TRIGGER_PUSH, + ENT_TRIGGER_TELEPORT, + ENT_TRIGGER_HURT, + ENT_TRIGGER_TRANSPORTER, + ENT_TRIGGGER_RADIATION, + ENT_TARGET_REMOVE_POWERUPS = 400, + ENT_TARGET_GIVE, + ENT_TARGET_DELAY, + ENT_TARGET_SPEAKER, + ENT_TARGET_PRINT, + ENT_TARGET_LASER, + ENT_TARGET_CHARACTER, + ENT_TARGET_TELEPORTER, + ENT_TARGET_RELAY, + ENT_TARGET_KILL, + ENT_TARGET_LOCATION, + ENT_TARGET_PUSH, + ENT_TARGET_COUNTER, + ENT_TARGET_OBJECTIVE, + ENT_TARGET_BOOLEAN, + ENT_TARGET_GRAVITY, + ENT_TARGET_SHAKE, + ENT_TARGET_EVOSUIT, + ENT_TARGET_TURBOLIFT, + ENT_TARGET_DOORLOCK, + ENT_TARGET_REPAIR, + ENT_TARGET_ALERT, + ENT_TARGET_WARP, + ENT_TARGET_DEACTIVATE, + ENT_TARGET_SERVERCHANGE, + ENT_TARGET_LEVELCHANGE, + ENT_TARGET_SHADERREMAP, + ENT_TARGET_SELFDESTRUCT, + ENT_TARGET_ZONE, + ENT_TARGET_SHIPHEALTH, + ENT_TARGET_HOLODECK, + ENT_MISC_MODEL = 500, + ENT_MISC_MODEL_BREAKABLE, + ENT_MISC_PORTAL_CAMERA, + ENT_MISC_PORTAL_SURFACE, + ENT_MISC_TURRET, + ENT_MISC_AMMOSTATION, + ENT_SHOOTER_ROCKET = 600, + ENT_SHOOTER_PLASMA, + ENT_SHOOTER_GRENADE, + ENT_SHOOTER_TORPEDO, + ENT_FX_SPARK = 700, + ENT_FX_STEAM, + ENT_FX_BOLT, + ENT_FX_TRANSPORTER, + ENT_FX_DRIP, + ENT_FX_FOUNTAIN, + ENT_FX_SURFACE_EXPLOSION, + ENT_FX_BLOW_CHUNKS, + ENT_FX_SMOKE, + ENT_FX_ELETRICAL_EXPLOSION, + ENT_FX_PHASER, + ENT_FX_TORPEDO, + ENT_FX_PARTICLEFIRE, + ENT_FX_FIRE, + ENT_FX_COOKING_STEAM, + ENT_FX_ELECTRICFIRE, + ENT_FX_FORGE_BOLT, + ENT_FX_PLASMA, + ENT_FX_STREAM, + ENT_FX_TRANSPORTER_STREAM, + ENT_FX_EXPLOSION_TRAIL, + ENT_FX_BORG_ENERGY_BEAM, + ENT_FX_SHIMMERY_THING, + ENT_FX_BORG_BOLT, + ENT_UI_TRANSPORTER = 800, + ENT_UI_HOLODECK, + ENT_UI_MSD, + ENT_CINEMATIC_CAMMERA = 900 +} entityTypeNumber_t; + /** \typedef gentity_t * * Type for \link gentity_s \endlink @@ -214,6 +327,7 @@ struct gentity_s { qboolean inuse; + entityTypeNumber_t type; //!< Entity type /*@shared@*/ /*@null@*/ char* classname; //!< set in QuakeEd int spawnflags; //!< set in QuakeEd diff --git a/code/game/g_misc.c b/code/game/g_misc.c index 599da42..1a04451 100644 --- a/code/game/g_misc.c +++ b/code/game/g_misc.c @@ -33,6 +33,7 @@ none */ // Lol, this is contradictory, should free but instead sets origin... Description sais removed so maybe merge with info_null. void SP_info_camp( gentity_t *self ) { + self->type = ENT_INFO_CAMP; G_SetOrigin( self, self->s.origin ); } @@ -88,9 +89,12 @@ none "targetname" - have whatever is required point at this. */ void SP_info_notnull( gentity_t *self ){ + if(!Q_stricmp(self->classname, "ref_tag") && !rpg_allowspmaps.integer) G_FreeEntity(self); + self->type = ENT_INFO_NOTNULL; + if(strcmp(self->classname, "info_notnull")) { self->classname = G_NewString("info_notnull"); } @@ -338,6 +342,8 @@ q3map2: void SP_misc_model( gentity_t *ent ) { #if 0 + ent->type = ENT_MISC_MODEL; + ent->s.modelindex = G_ModelIndex( ent->model ); VectorSet (ent->mins, -16, -16, -16); VectorSet (ent->maxs, 16, 16, 16); @@ -494,6 +500,7 @@ Autocycle or manual Cycle usually only makes sence for a survaliance-station or For a viewscreen or a communications channel make the brush having the portal-texture a func_usable and treat is as described on that entity for VFX-Entities. */ void SP_misc_portal_surface(gentity_t *ent) { + ent->type = ENT_MISC_PORTAL_SURFACE; VectorClear( ent->r.mins ); VectorClear( ent->r.maxs ); @@ -535,6 +542,8 @@ You can set either angles or target another entity (NOT an info_null or similar) void SP_misc_portal_camera(gentity_t *ent) { float roll; + ent->type = ENT_MISC_PORTAL_CAMERA; + VectorClear( ent->r.mins ); VectorClear( ent->r.maxs ); trap_LinkEntity( ent ); @@ -639,6 +648,7 @@ none "random" - the number of degrees of deviance from the taget. (1.0 default) */ void SP_shooter_rocket( gentity_t *ent ) { + ent->type = ENT_SHOOTER_ROCKET; InitShooter( ent, WP_10 ); } @@ -654,6 +664,7 @@ none "random" - the number of degrees of deviance from the taget. (1.0 default) */ void SP_shooter_plasma( gentity_t *ent ) { + ent->type = ENT_SHOOTER_PLASMA; InitShooter( ent, WP_6 ); //TiM : WP_4 } @@ -669,6 +680,7 @@ none "random" - the number of degrees of deviance from the taget. (1.0 default) */ void SP_shooter_grenade( gentity_t *ent ) { + ent->type = ENT_SHOOTER_GRENADE; InitShooter( ent, WP_8); } @@ -684,5 +696,6 @@ none "random" - the number of degrees of deviance from the taget. (1.0 default) */ void SP_shooter_torpedo( gentity_t *ent ) { + ent->type = ENT_SHOOTER_TORPEDO; InitShooter( ent, WP_9 ); } diff --git a/code/game/g_mover.c b/code/game/g_mover.c index e291f33..36b82f6 100644 --- a/code/game/g_mover.c +++ b/code/game/g_mover.c @@ -1491,6 +1491,8 @@ void SP_func_door (gentity_t *ent) { float lip; char *sound; + ent->type = ENT_FUNC_DOOR; + if(!ent->tmpEntity) { // not modified by spawnfile G_SpawnString("soundstart", "sound/movers/doors/largedoorstart.wav", &sound); ent->sound1to2 = ent->sound2to1 = G_SoundIndex(sound); @@ -1705,6 +1707,8 @@ void SP_func_plat (gentity_t *ent) { float lip, height; char *sound; + ent->type = ENT_FUNC_PLAT; + G_SpawnString("soundstart", "sound/movers/plats/largeplatstart.wav", &sound); ent->sound1to2 = ent->sound2to1 = G_SoundIndex(sound); G_SpawnString("soundstop", "sound/movers/plats/largeplatstop.wav", &sound); @@ -1818,6 +1822,8 @@ void SP_func_button( gentity_t *ent ) { float lip; char *sound; + ent->type = ENT_FUNC_BUTTON; + if(!ent->tmpEntity) { // not modified by spawn file G_SpawnString("sounduse", "sound/movers/switches/forgepos.wav", &sound); ent->sound1to2 = G_SoundIndex(sound); @@ -2024,6 +2030,8 @@ none "wait" - seconds to wait before behining move to next corner */ void SP_path_corner( gentity_t *self ) { + self->type = ENT_PATH_CORNER; + if ( !self->targetname ) { DEVELOPER(G_Printf (S_COLOR_YELLOW "[Entity-Error] path_corner with no targetname at %s\n", vtos(self->s.origin));); G_FreeEntity( self ); @@ -2064,6 +2072,8 @@ q3map2: "_receiveShadows" OR "_rs" - sets whether the entity receives shadows */ void SP_func_train (gentity_t *self) { + self->type = ENT_FUNC_TRAIN; + VectorClear (self->s.angles); if (self->spawnflags & TRAIN_BLOCK_STOPS) { @@ -2137,6 +2147,8 @@ q3map2: "_receiveShadows" OR "_rs" - sets whether the entity receives shadows */ void SP_func_static( gentity_t *ent ) { + ent->type = ENT_FUNC_STATIC; + trap_SetBrushModel( ent, ent->model ); G_SetOrigin(ent, ent->s.origin); G_SetAngles(ent, ent->s.angles); @@ -2391,6 +2403,9 @@ q3map2: void SP_func_forcefield( gentity_t *ent ) { char *activate, *damage, *touch, *deactivate, *temp; + + ent->type = ENT_FUNC_FORCEFIELD; + // timestamp keeps track of whether the field is on or off ent->timestamp = 1; @@ -2527,6 +2542,8 @@ void func_rotating_use (gentity_t *ent, gentity_t *other, gentity_t *activator) void SP_func_rotating (gentity_t *ent) { float speed; + ent->type = ENT_FUNC_ROTATING; + if ( !ent->speed ) { ent->speed = 100; } @@ -2671,6 +2688,9 @@ q3map2: void SP_func_door_rotating ( gentity_t *ent ) { char *sound; + + ent->type = ENT_FUNC_DOOR_ROTATING; + G_SpawnString("soundstart", "sound/movers/doors/largedoorstart.wav", &sound); ent->sound1to2 = ent->sound2to1 = G_SoundIndex(sound); G_SpawnString("soundstop", "sound/movers/doors/largedoorstop.wav", &sound); @@ -2803,6 +2823,8 @@ void SP_func_bobbing (gentity_t *ent) { float height; float phase; + ent->type = ENT_FUNC_BOBBING; + if(!ent->tmpEntity) { // only do this if this is not done by spawn file G_SpawnFloat( "height", "32", &height ); G_SpawnFloat( "phase", "0", &phase ); @@ -2873,6 +2895,8 @@ void SP_func_pendulum(gentity_t *ent) { float phase; float speed; + ent->type = ENT_FUNC_PENDULUM; + G_SpawnFloat( "speed", "30", &speed ); G_SpawnInt( "dmg", "2", &ent->damage ); G_SpawnFloat( "phase", "0", &phase ); @@ -2931,6 +2955,8 @@ q3map2: "_receiveShadows" OR "_rs" - sets whether the entity receives shadows */ void SP_func_brushmodel(gentity_t *ent) { + ent->type = ENT_FUNC_BRUSHMODEL; + trap_SetBrushModel(ent, ent->model); ent->s.eType = ET_MOVER; ent->s.pos.trType = TR_STATIONARY; @@ -2993,6 +3019,8 @@ void func_lightchange_setup(gentity_t *ent) { } void SP_func_lightchange(gentity_t *ent) { + ent->type = ENT_FUNC_LIGHTCHANGE; + if(!ent->target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] func_lightchange without target at %s!\n", vtos(ent->s.origin));); G_FreeEntity(ent); @@ -3084,6 +3112,8 @@ void func_targetmover_link(gentity_t *ent) { void SP_func_targetmover(gentity_t *ent) { char *sound; + ent->type = ENT_FUNC_TARGETMOVER; + if(!ent->target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] func_targetmover without target at %s!\n", vtos(ent->s.origin));); G_FreeEntity(ent); @@ -3291,11 +3321,16 @@ Target position for the discontinued func_mover "angles" - to rotate to */ void SP_path_point(gentity_t *ent) { + ent->type = ENT_PATH_POINT; + // check if angles are set - if(ent->angle) + if(ent->angle) { ent->angle = 0; - if(ent->s.angles[0] || ent->s.angles[1] || ent->s.angles[2]) + } + + if(ent->s.angles[0] || ent->s.angles[1] || ent->s.angles[2]) { ent->angle = 1; + } } /*QUAKED func_mover (0 .5 .8) ? @@ -3321,6 +3356,8 @@ q3map2: void SP_func_mover(gentity_t *ent) { gentity_t *target; float aspeed; + + ent->type = ENT_FUNC_MOVER; if(!ent->target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] func_mover without target at %s!\n", vtos(ent->s.origin));); @@ -3552,6 +3589,8 @@ A bmodel that just sits there and opens when a player gets close to it. */ void SP_func_stasis_door( gentity_t *ent ) { + ent->type = ENT_FUNC_STASIS_DOOR; + /* set the brush model */ trap_SetBrushModel( ent, ent->model ); diff --git a/code/game/g_spawn.h b/code/game/g_spawn.h index 936081a..b52a143 100644 --- a/code/game/g_spawn.h +++ b/code/game/g_spawn.h @@ -29,10 +29,6 @@ typedef struct void SP_info_player_deathmatch(/*@shared@*/ gentity_t *ent); void SP_info_player_intermission(/*@shared@*/ gentity_t *ent); -void SP_info_firstplace(/*@shared@*/ gentity_t *ent); -void SP_info_secondplace(/*@shared@*/ gentity_t *ent); -void SP_info_thirdplace(/*@shared@*/ gentity_t *ent); -void SP_info_podium(/*@shared@*/ gentity_t *ent); void SP_func_plat (/*@shared@*/ gentity_t *ent); void SP_func_forcefield(/*@shared@*/ gentity_t *ent); diff --git a/code/game/g_target.c b/code/game/g_target.c index a010a29..ecca5be 100644 --- a/code/game/g_target.c +++ b/code/game/g_target.c @@ -53,6 +53,8 @@ void SP_target_give( gentity_t *ent ) char* token; unsigned weapon; + ent->type = ENT_TARGET_GIVE; + G_SpawnString( "items", "", &items ); if(strcmp(items, "") == 0 && ent->target != NULL) { // spawnTEnt @@ -127,6 +129,7 @@ static void Use_target_remove_powerups( /*@shared@*/ /*@unused@*/ gentity_t *ent } void SP_target_remove_powerups( gentity_t *ent ) { + ent->type = ENT_TARGET_REMOVE_POWERUPS; ent->use = Use_target_remove_powerups; } @@ -171,6 +174,8 @@ static void Use_Target_Delay( /*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unus } void SP_target_delay( gentity_t *ent ) { + ent->type = ENT_TARGET_DELAY; + if ( ent->wait <= 0.0f ) { G_SpawnFloat("delay", "0", &ent->wait); if(ent->wait <= 0.0f) { @@ -224,6 +229,7 @@ static void Use_Target_Print (/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unuse } void SP_target_print( gentity_t *ent ) { + ent->type = ENT_TARGET_PRINT; ent->use = Use_Target_Print; } @@ -276,6 +282,8 @@ void SP_target_speaker( gentity_t *ent ) { char buffer[MAX_QPATH]; char *s; + ent->type = ENT_TARGET_SPEAKER; + G_SpawnFloat( "wait", "0", &ent->wait ); G_SpawnFloat( "random", "0", &ent->random ); @@ -442,6 +450,8 @@ static void target_laser_start (/*@shared@*/ gentity_t *self) void SP_target_laser (gentity_t *self) { + self->type = ENT_TARGET_LASER; + // let everything else get spawned before we start firing self->think = target_laser_start; self->nextthink = level.time + FRAMETIME; @@ -527,6 +537,8 @@ The activator will be instantly teleported away. "swapname" - Activate/Deactivate (Using entity needs SELF/NOACTIVATOR) */ void SP_target_teleporter( gentity_t *self ) { + self->type = ENT_TARGET_TELEPORTER; + if (self->targetname == NULL) { if(self->classname != NULL) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] untargeted %s at %s\n", self->classname, vtos(self->s.origin));); @@ -608,6 +620,7 @@ static void target_relay_use (/*@shared@*/ gentity_t *self, /*@shared@*/ /*@unus } void SP_target_relay (gentity_t *self) { + self->type = ENT_TARGET_RELAY; self->use = target_relay_use; } @@ -631,6 +644,8 @@ static void target_kill_use( /*@shared@*/ /*@unused@*/ gentity_t *self, /*@share } void SP_target_kill( gentity_t *self ) { + self->type = ENT_TARGET_KILL; + self->use = target_kill_use; // don't need to send this to clients @@ -705,6 +720,8 @@ For Type = 1: /locedit add "" this will close the file. */ void SP_target_location( gentity_t *self ){ + self->type = ENT_TARGET_LOCATION; + self->think = target_location_linkup; self->nextthink = level.time + 200; // Let them all spawn first @@ -748,6 +765,8 @@ static void target_counter_use( /*@shared@*/ gentity_t *self, /*@shared@*/ /*@un void SP_target_counter (gentity_t *self) { + self->type = ENT_TARGET_COUNTER; + self->wait = -1.0f; if (self->count == 0) { self->count = 2; @@ -792,6 +811,8 @@ static void target_objective_use( /*@shared@*/ gentity_t *self, /*@shared@*/ /*@ void SP_target_objective (gentity_t *self) { + self->type = ENT_TARGET_OBJECTIVE; + if ( self->count <= 0 ) { //FIXME: error msg G_FreeEntity( self ); @@ -893,6 +914,8 @@ static void target_boolean_use (/*@shared@*/ gentity_t *self, /*@shared@*/ genti } void SP_target_boolean (gentity_t *self) { + self->type = ENT_TARGET_BOOLEAN; + if (!self->booleanstate && (self->spawnflags & 1) != 0) { self->booleanstate = qtrue; } else if (!self->booleanstate) { @@ -949,13 +972,18 @@ void target_gravity_use (/*@shared@*/ gentity_t *self, /*@shared@*/ /*@unused@*/ void SP_target_gravity (gentity_t *self) { char *temp; + + self->type = ENT_TARGET_GRAVITY; + if(!self->tmpEntity) { // check for spawnTEnt G_SpawnString("gravity", "800", &temp); self->targetname2 = G_NewString(temp); } + if(self->count != 0) { // support for SP self->targetname2 = G_NewString(va("%i", self->count)); } + self->use = target_gravity_use; // don't need to send this to clients @@ -983,6 +1011,7 @@ void target_shake_use (/*@shared@*/ gentity_t *self, /*@shared@*/ /*@unused@*/ g } void SP_target_shake (gentity_t *self) { + self->type = ENT_TARGET_SHAKE; //TiM: Phenix, you're a n00b. You should always put default values in. ;P G_SpawnFloat( "intensity", "5", &self->distance /*was &self->intensity*/ ); @@ -1023,6 +1052,8 @@ void target_evosuit_use (/*@shared@*/ /*@unused@*/ gentity_t *self, /*@shared@*/ } void SP_target_evosuit (gentity_t *self) { + self->type = ENT_TARGET_EVOSUIT; + self->use = target_evosuit_use; // don't need to send this to clients @@ -1751,6 +1782,8 @@ void SP_target_turbolift ( gentity_t *self ) return; } + self->type = ENT_TARGET_TURBOLIFT; + //cache the moving sounds G_SpawnString( "soundLoop", "sound/movers/plats/turbomove.wav", &loopSound ); G_SpawnString( "soundEnd", "sound/movers/plats/turbostop.wav", &endSound ); @@ -1933,6 +1966,8 @@ void target_doorLock_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@*/ void SP_target_doorLock(gentity_t *ent) { char *temp; + ent->type = ENT_TARGET_DOORLOCK; + if(ent->target == NULL) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_doorlock at %s without target!\n", vtos(ent->s.origin));); G_FreeEntity(ent); @@ -2412,6 +2447,8 @@ void target_alert_parseShaders(/*@shared@*/ gentity_t *ent) { void SP_target_alert(gentity_t *ent) { char *temp; + ent->type = ENT_TARGET_ALERT; + G_SpawnString("greenname", "", &temp); ent->swapname = G_NewString(temp); G_SpawnString("yellowname", "", &temp); @@ -2638,6 +2675,8 @@ void target_warp_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@*/ gent void SP_target_warp(gentity_t *ent) { char *temp; + ent->type = ENT_TARGET_WARP; + G_SpawnString("swapWarp", "", &temp); ent->swapname = G_NewString(temp); G_SpawnString("swapCoreState", "", &temp); @@ -2695,6 +2734,7 @@ void target_deactivate_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@* } void SP_target_deactivate(/*@shared@*/ gentity_t *ent) { + ent->type = ENT_TARGET_DEACTIVATE; if(ent->target == NULL) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_deactivate at %s without target!\n", vtos(ent->r.currentOrigin));); @@ -2758,6 +2798,8 @@ void target_serverchange_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused void SP_target_serverchange(/*@shared@*/ gentity_t *ent) { int serverNum = 0; + ent->type = ENT_TARGET_SERVERCHANGE; + G_SpawnInt("serverNum", "1", &serverNum); ent->count = serverNum; @@ -2812,6 +2854,8 @@ void target_levelchange_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@ } void SP_target_levelchange(gentity_t *ent) { + ent->type = ENT_TARGET_LEVELCHANGE; + if(ent->target == NULL) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_levelchange without target at %s!\n", vtos(ent->s.origin));); G_FreeEntity(ent); @@ -2846,6 +2890,8 @@ void SP_target_holodeck(/*@shared@*/ gentity_t *ent) { G_FreeEntity(ent); return; #else + ent->type = ENT_TARGET_HOLODECK; + // don't need to send this to clients ent->r.svFlags &= SVF_NOCLIENT; trap_LinkEntity(ent); @@ -2897,6 +2943,8 @@ void target_shaderremap_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@ void SP_target_shaderremap(gentity_t *ent) { + ent->type = ENT_TARGET_SHADERREMAP; + if(ent->falsename == NULL) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_shaderremap without falsename-shader at %s!\n", vtos(ent->s.origin));); G_FreeEntity(ent); @@ -3015,6 +3063,8 @@ void SP_target_selfdestruct(gentity_t *ent) { double ETAmin, ETAsec; float temp; + ent->type = ENT_TARGET_SELFDESTRUCT; + if(level.time < 1000.0f){ //failsafe in case someone spawned this in the radiant DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_selfdestruct spawned by level. Removing entity.");); G_FreeEntity(ent); @@ -3117,6 +3167,7 @@ Note: Spawnflags will only work with the system they are attached to 0 - none, will free entity 1 - safezone for target_selfdestruct and target_shiphealth 2 - display zone for target_shiphealth (HUD overlay) + 4 - sound zone -----USAGE----- As safezone: @@ -3141,6 +3192,8 @@ void target_safezone_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@*/ void SP_target_zone(gentity_t *ent) { + ent->type = ENT_TARGET_ZONE; + if(ent->targetname == NULL || ent->targetname[0] == 0) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_zone without targetname at %s, removing entity.\n", vtos(ent->s.origin));); G_FreeEntity(ent); @@ -3567,6 +3620,7 @@ void target_shiphealth_think(/*@shared@*/ gentity_t *ent) { void SP_target_shiphealth(gentity_t *ent) { + ent->type = ENT_TARGET_SHIPHEALTH; if(ent->targetname == NULL || ent->health == 0 || ent->splashRadius == 0 || !ent->angle || !ent->speed){ DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_shiphealth at %s is missing one or more parameters, removing entity.\n", vtos(ent->s.origin));); diff --git a/code/game/g_trigger.c b/code/game/g_trigger.c index b341867..1f76fb0 100644 --- a/code/game/g_trigger.c +++ b/code/game/g_trigger.c @@ -159,6 +159,8 @@ so, the basic time between firing is a random time between * @param ent the trigger */ void SP_trigger_multiple( gentity_t *ent ) { + ent->type = ENT_TRIGGER_MULTIPLE; + G_SpawnFloat( "wait", "0.5", &ent->wait ); G_SpawnFloat( "random", "0", &ent->random ); @@ -231,6 +233,8 @@ none * @param ent the trigger */ void SP_trigger_always (gentity_t *ent) { + ent->type = ENT_TRIGGER_ALWAYS; + /* we must have some delay to make sure our use targets are present */ ent->nextthink = level.time + 300; ent->think = trigger_always_think; @@ -334,6 +338,8 @@ None * @param self the trigger */ void SP_trigger_push( gentity_t *self ) { + self->type = ENT_TRIGGER_PUSH; + InitTrigger (self); /* unlike other triggers, we need to send this one to the client */ @@ -403,9 +409,12 @@ This is predicted on the serverside and is triggered by use-function. * @param self the entity */ void SP_target_push( gentity_t *self ) { + self->type = ENT_TARGET_PUSH; + if (!self->speed) { self->speed = 1000; } + G_SetMovedir (self->s.angles, self->s.origin2); VectorScale (self->s.origin2, self->speed, self->s.origin2); @@ -641,6 +650,8 @@ void SP_trigger_teleport( gentity_t *self ) { char *temp; + self->type = ENT_TRIGGER_TELEPORT; + InitTrigger (self); /* @@ -786,6 +797,8 @@ void hurt_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { * @param self the trigger */ void SP_trigger_hurt( gentity_t *self ) { + self->type = ENT_TRIGGER_HURT; + InitTrigger (self); /* TiM - gets very annoying after a while */ @@ -884,6 +897,8 @@ void func_timer_use( gentity_t *self, gentity_t *other, gentity_t *activator ) { * @param self the entity */ void SP_func_timer( gentity_t *self ) { + self->type = ENT_FUNC_TIMER; + G_SpawnFloat( "random", "1", &self->random); G_SpawnFloat( "wait", "1", &self->wait ); @@ -1025,6 +1040,9 @@ void trigger_transporter_delay(gentity_t *ent) { */ void SP_trigger_transporter(gentity_t *ent) { char *temp; + + ent->type = ENT_TRIGGER_TRANSPORTER; + InitTrigger(ent); if(!ent->wait) { @@ -1128,6 +1146,7 @@ void trigger_radiation_use(gentity_t *ent, gentity_t *other, gentity_t *activato * @param ent the trigger */ void SP_trigger_radiation(gentity_t *ent) { + ent->type = ENT_TRIGGGER_RADIATION; if(!ent->damage) ent->damage = 1; diff --git a/code/game/g_turrets.c b/code/game/g_turrets.c index 94fec2d..7791d23 100644 --- a/code/game/g_turrets.c +++ b/code/game/g_turrets.c @@ -730,6 +730,8 @@ void SP_misc_turret (gentity_t *base) gentity_t *head = G_Spawn(); vec3_t fwd; + base->type = ENT_MISC_TURRET; + /* Base */ /* Base does the looking for enemies and pointing the arm and head */ VectorCopy( base->s.angles, base->s.apos.trBase ); @@ -1234,6 +1236,7 @@ void laser_arm_start (gentity_t *base) */ void SP_laser_arm (gentity_t *base) { + base->type = ENT_LASER_ARM; base->think = laser_arm_start; base->nextthink = level.time + FRAMETIME; } diff --git a/code/game/g_ui.c b/code/game/g_ui.c index 60ffb98..92b1b7d 100644 --- a/code/game/g_ui.c +++ b/code/game/g_ui.c @@ -94,6 +94,7 @@ void ui_transporter_setup(gentity_t *ent) { * \author GSIO01 */ void SP_ui_transporter(gentity_t *ent) { + ent->type = ENT_UI_TRANSPORTER; if(!ent->target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] ui_transporter without target at %s!\n", vtos(ent->s.origin));); @@ -237,6 +238,7 @@ void ui_msd_setup(gentity_t *ent) { * \author GSIO01 */ void SP_ui_msd(gentity_t *ent) { + ent->type = ENT_UI_MSD; if(!ent->target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] ui_msd without target at %s! Removing Entity.\n", vtos(ent->s.origin));); @@ -308,6 +310,8 @@ void ui_holodeck_setup(gentity_t *ent) { } void SP_ui_holodeck(gentity_t *ent) { + ent->type = ENT_UI_HOLODECK; + if(!ent->target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] ui_holodeck without target at %s!\n", vtos(ent->s.origin));); G_FreeEntity(ent); diff --git a/code/game/g_usable.c b/code/game/g_usable.c index a65cd25..b28cdfc 100644 --- a/code/game/g_usable.c +++ b/code/game/g_usable.c @@ -270,6 +270,8 @@ Also if you have a (morer or less) generic console that you want to fire generic */ void SP_func_usable( gentity_t *self ) { + self->type = ENT_FUNC_USABLE; + trap_SetBrushModel( self, self->model ); InitMover( self ); VectorCopy( self->s.origin, self->s.pos.trBase ); diff --git a/code/game/g_utils.c b/code/game/g_utils.c index 9451c29..64a4bda 100644 --- a/code/game/g_utils.c +++ b/code/game/g_utils.c @@ -608,6 +608,7 @@ void G_FreeEntity( gentity_t *ed ) { ed->classname = "freed"; ed->freetime = level.time; ed->inuse = qfalse; + ed->type = ENT_FREE; } gentity_t *G_TempEntity( vec3_t origin, int event ) { diff --git a/code/game/q_shared.h b/code/game/q_shared.h index e11ec4b..0cbbc0f 100644 --- a/code/game/q_shared.h +++ b/code/game/q_shared.h @@ -1002,11 +1002,11 @@ typedef struct playerState_s { int32_t pm_flags; // ducked, jump_held, etc int32_t pm_time; - vec3_t origin; - vec3_t velocity; + vec3_t origin; + vec3_t velocity; int32_t weaponTime; int32_t rechargeTime; // for the phaser - int16_t useTime; // use debounce + int16_t useTime; // use debounce int32_t introTime; // for the holodoor @@ -1042,7 +1042,7 @@ typedef struct playerState_s { int32_t weapon; // copied to entityState_t->weapon int32_t weaponstate; - vec3_t viewangles; // for fixed views + vec3_t viewangles; // for fixed views int32_t viewheight; // damage feedback