Made the codebase compile again...

This commit is contained in:
Marco Cawthorne 2020-03-08 10:59:46 +01:00
parent bf0ffd39eb
commit c51da15564
50 changed files with 221 additions and 78 deletions

View file

@ -68,6 +68,8 @@ vector mouse_pos;
/* TODO: Move these into gs-entbase/client/defs.h? */
vector g_vecSunDir;
vector g_vecLensPos;
int g_iWorldInitialized;
/* this actually belongs in builtins.h since its an undocumented global */
float clframetime;

View file

@ -47,6 +47,9 @@ void CSQC_Ent_Update(float new)
case ENT_DECAL:
Decal_Parse();
break;
case ENT_AMBIENTSOUND:
Sound_ParseLoopingEntity(self, new);
break;
default:
if (Game_Entity_Update(t, new) == FALSE) {
error("Unknown entity type update received.\n");

View file

@ -18,6 +18,43 @@ var int g_voxcount;
var int g_voxpos;
var float g_voxtime = 0.0f;
var int g_iSoundStyleCurrent;
class CCSAmbientSound {
float m_flVolume;
float m_flAttn;
float m_flPitch;
string m_strSample;
};
void Sound_ParseLoopingEntity(entity sndent, float isNew)
{
float flFlags;
CCSAmbientSound new = (CCSAmbientSound)sndent;
if (isNew) {
spawnfunc_CCSAmbientSound();
}
flFlags = readfloat();
if (flFlags & 1) {
new.origin[0] = readcoord();
new.origin[1] = readcoord();
new.origin[2] = readcoord();
setorigin( new, new.origin );
new.m_flVolume = readfloat();
new.m_flAttn = readbyte();
new.m_flPitch = readfloat();
}
if (flFlags & 2) {
new.m_strSample = readstring();
}
sound(new, CHAN_VOICE, new.m_strSample, new.m_flVolume, new.m_flAttn, new.m_flPitch);
}
typedef struct {
string sample;
float len;

View file

@ -14,9 +14,18 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* We only want to load this because we're in desperate need for the skyname
* variable. Some maps like crossfire do not supply one because GS assumes
* the default is 'desert'... so once this is done we'll kill it. */
/* High Dynamic Range - Iris Adaption */
var float g_flHDRIrisMinValue = 0.0;
var float g_flHDRIrisMaxValue = 1.75;
var float g_flHDRIrisMultiplier = 1.25;
var float g_flHDRIrisFadeUp = 0.1;
var float g_flHDRIrisFadeDown = 0.5;
#ifdef VALVE
var string g_strSkyName = "desert";
#else
var string g_strSkyName = "";
#endif
class worldspawn:CBaseEntity
{
@ -32,17 +41,43 @@ void worldspawn::Initialized(void)
void worldspawn::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "sun_pos":
g_vecSunDir = stov(strKey);
break;
case "skyname":
Sky_Set(strKey);
break;
case "ambientsound":
g_ambientsound = spawn(env_soundscape);
g_ambientsound.m_iShader = Sound_Precache(strKey);
break;
default:
case "lf_pos":
g_vecLensPos = stov(strKey);
break;
case "sun_pos":
g_vecSunDir = stov(strKey);
break;
case "skyname":
g_strSkyName = strKey;
break;
case "ambientsound":
if (g_ambientsound) {
break;
}
g_ambientsound = spawn(env_soundscape);
g_ambientsound.m_iShader = Sound_Precache(strKey);
break;
case "hdr_iris_minvalue":
g_flHDRIrisMinValue = stof(strKey);
cvar_set("r_hdr_irisadaptation_minvalue", ftos(g_flHDRIrisMinValue));
break;
case "hdr_iris_maxvalue":
g_flHDRIrisMaxValue = stof(strKey);
cvar_set("r_hdr_irisadaptation_maxvalue", ftos(g_flHDRIrisMaxValue));
break;
case "hdr_iris_multiplier":
g_flHDRIrisMultiplier = stof(strKey);
cvar_set("r_hdr_irisadaptation_multiplier", ftos(g_flHDRIrisMultiplier));
break;
case "hdr_iris_fade_up":
g_flHDRIrisFadeUp = stof(strKey);
cvar_set("r_hdr_irisadaptation_fade_up", ftos(g_flHDRIrisFadeUp));
break;
case "hdr_iris_fade_down":
g_flHDRIrisFadeDown = stof(strKey);
cvar_set("r_hdr_irisadaptation_fade_down", ftos(g_flHDRIrisFadeDown));
break;
default:
break;
}
}

View file

@ -37,6 +37,11 @@ enumflags {
AS_NOTTOGGLED
};
enumflags {
AG_INFO,
AG_SAMPLE
};
class ambient_generic:CBaseTrigger
{
string m_strActivePath;
@ -52,8 +57,36 @@ class ambient_generic:CBaseTrigger
virtual void() Respawn;
virtual void() UseNormal;
virtual void() UseLoop;
virtual float(entity, float) SendEntity;
};
float ambient_generic::SendEntity(entity ePEnt, float fChanged)
{
/* only override when we're doing the toggle guff */
if (m_iLoop == FALSE) {
return FALSE;
}
WriteByte(MSG_ENTITY, ENT_AMBIENTSOUND);
WriteFloat(MSG_ENTITY, fChanged);
if (fChanged & AG_INFO) {
WriteCoord(MSG_ENTITY, origin[0]);
WriteCoord(MSG_ENTITY, origin[1]);
WriteCoord(MSG_ENTITY, origin[2]);
WriteFloat(MSG_ENTITY, m_flVolume);
WriteByte(MSG_ENTITY, m_flRadius);
WriteFloat(MSG_ENTITY, m_flPitch);
}
/* TODO: work with soundindices? */
if (fChanged & AG_SAMPLE) {
WriteString(MSG_ENTITY, m_strActivePath);
}
return TRUE;
}
void ambient_generic::UseNormal(void)
{
sound(this, CHAN_VOICE, m_strActivePath, m_flVolume, m_flRadius, m_flPitch);
@ -67,7 +100,7 @@ void ambient_generic::UseLoop(void)
m_strActivePath = m_strSoundPath;
}
m_iToggleSwitch = 1 - m_iToggleSwitch;
UseNormal();
SendFlags |= AG_SAMPLE;
}
void ambient_generic::Respawn(void)
@ -79,17 +112,18 @@ void ambient_generic::Respawn(void)
m_iLoop = FALSE;
} else {
m_iLoop = TRUE;
}
if (spawnflags & AS_SILENT) {
m_iToggleSwitch = FALSE;
} else {
m_iToggleSwitch = TRUE;
UseNormal();
}
/* set our sample up */
if (spawnflags & AS_SILENT) {
m_iToggleSwitch = FALSE;
m_strActivePath = "common/null.wav";
} else {
m_iToggleSwitch = TRUE;
m_strActivePath = m_strSoundPath;
}
if (m_iLoop) {
Trigger = UseLoop;
SendFlags |= AG_SAMPLE;
}
}
@ -140,6 +174,6 @@ void ambient_generic::ambient_generic(void)
m_flRadius = ATTN_STATIC;
}
pvsflags = PVSF_USEPHS;
CBaseTrigger::CBaseTrigger();
ambient_generic::Respawn();
}

View file

@ -204,21 +204,20 @@ void CBaseEntity :: CBaseEntity ( void )
m_rendermode = 0;*/
gflags |= GF_CANRESPAWN;
m_oldModel = Util_FixModel(model);
if (m_oldModel != "") {
precache_model(m_oldModel);
}
m_oldSolid = solid;
m_oldHealth = health;
m_oldOrigin = origin;
m_oldAngle = angles;
effects |= EF_NOSHADOW;
int nfields = tokenize( __fullspawndata );
for ( int i = 1; i < ( nfields - 1 ); i += 2 ) {
switch ( argv( i ) ) {
case "origin":
origin = stov(argv(i+1));
break;
case "angles":
angles = stov(argv(i+1));
break;
case "solid":
solid = stof(argv(i+1));
break;
case "shadows":
if (stof(argv( i + 1 )) == 1) {
effects &= ~EF_NOSHADOW;
@ -244,11 +243,25 @@ void CBaseEntity :: CBaseEntity ( void )
case "parentname":
m_parent = argv(i+1);
break;
case "model":
model = argv(i+1);
break;
default:
break;
}
}
m_oldModel = Util_FixModel(model);
if (m_oldModel != "") {
precache_model(m_oldModel);
}
m_oldSolid = solid;
m_oldHealth = health;
m_oldOrigin = origin;
m_oldAngle = angles;
RendermodeUpdate();
}

View file

@ -105,5 +105,4 @@ void CBaseMonster::CBaseMonster(void)
{
CBaseEntity::CBaseEntity();
precache_model(m_oldModel);
Respawn();
}

View file

@ -128,7 +128,6 @@ void CBasePhysics::CBasePhysics(void)
break;
}
}
CBasePhysics::Respawn();
}
CLASSEXPORT(prop_physics, CBasePhysics)

View file

@ -54,5 +54,4 @@ void cycler::Respawn(void)
void cycler::cycler(void)
{
CBaseEntity::CBaseEntity();
Respawn();
}

View file

@ -26,11 +26,5 @@ Decorative, does nothing yet.
class cycler_sprite:CBaseTrigger
{
void() cycler_sprite;
};
void cycler_sprite::cycler_sprite(void)
{
CBaseEntity::CBaseEntity();
CBaseEntity::Respawn();
}
};

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2016-2019 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* Permission to use, copy, modify, and distribute this software for any+
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
@ -19,7 +19,7 @@
#endif
#ifdef WASTES
#define GS_BULLET_PHYSICS
//#define GS_BULLET_PHYSICS
#endif
void Effect_CreateSpark(vector, vector);

View file

@ -114,5 +114,4 @@ void env_laser::env_laser(void)
}
CBaseTrigger::CBaseTrigger();
env_laser::Respawn();
}

View file

@ -90,7 +90,6 @@ void env_message::env_message(void)
}
}
CBaseTrigger::CBaseTrigger();
env_message::Respawn();
}
void

View file

@ -127,5 +127,4 @@ void env_shooter :: env_shooter ( void )
precache_model( m_strShootModel );
CBaseTrigger::CBaseTrigger();
env_shooter::Respawn();
}

View file

@ -111,5 +111,4 @@ void env_spark::env_spark(void)
precache_sound(spark_snd[i]);
}
CBaseTrigger::CBaseTrigger();
Respawn();
}

View file

@ -123,7 +123,6 @@ void env_sprite::env_sprite(void)
CBaseTrigger::CBaseTrigger();
precache_model(m_oldModel);
Respawn();
m_iToggled = ((spawnflags & ENVS_STARTON) > 0);

View file

@ -195,6 +195,8 @@ void func_breakable::PlayerTouch(void)
void func_breakable::Respawn(void)
{
CBaseEntity::Respawn();
movetype = MOVETYPE_NONE;
if (spawnflags & SF_ISMODEL) {
@ -266,5 +268,4 @@ void func_breakable::func_breakable(void)
}
angles = vvm_angles;
func_breakable::Respawn();
}

View file

@ -405,6 +405,4 @@ void func_button::func_button(void)
break;
}
}
func_button::Respawn();
}

View file

@ -393,7 +393,6 @@ void func_door::func_door(void)
}
func_door::Precache();
func_door::Respawn();
}
void func_water(void)

View file

@ -397,5 +397,4 @@ void func_door_rotating::func_door_rotating(void)
func_door_rotating::Precache();
CBaseEntity::CBaseEntity();
func_door_rotating::Respawn();
}

View file

@ -175,5 +175,4 @@ void func_guntarget::func_guntarget(void)
}
CBaseTrigger::CBaseTrigger();
Respawn();
}

View file

@ -26,7 +26,6 @@ void func_physbox::func_physbox(void)
{
CBaseEntity::CBaseEntity();
precache_model(m_oldModel);
func_physbox::Respawn();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {

View file

@ -22,7 +22,16 @@
STUB!
*/
class func_pushable:func_breakable
class func_pushable : func_breakable
{
virtual void() touch;
};
void func_pushable :: touch ( void )
{
if (other.movetype == MOVETYPE_WALK) {
}
velocity = other.velocity * 0.25;
}

View file

@ -165,5 +165,4 @@ void func_rotating :: func_rotating ( void )
CBaseTrigger::CBaseTrigger();
func_rotating::SetMovementDirection();
func_rotating::Respawn();
}

View file

@ -131,5 +131,4 @@ void func_tracktrain::func_tracktrain(void)
//}
CBaseTrigger::CBaseTrigger();
Respawn();
}

View file

@ -255,5 +255,4 @@ func_train::func_train(void)
}
CBaseTrigger::CBaseTrigger();
Respawn();
}

View file

@ -68,5 +68,4 @@ void func_wall_toggle::func_wall_toggle(void)
{
precache_model(model);
CBaseTrigger::CBaseTrigger();
Respawn();
}

View file

@ -67,5 +67,4 @@ void gibshooter2 :: gibshooter2 ( void )
precache_model( m_strShootModel );
CBaseTrigger::CBaseTrigger();
env_shooter::Respawn();
}

View file

@ -56,6 +56,11 @@ void infodecal(void)
vector endpos = [0,0,0];
vector vpos = self.origin;
#ifdef WASTES
remove(self);
return;
#endif
if (serverkeyfloat("*bspversion") != 30) {
#if 1
remove(self);

View file

@ -105,8 +105,6 @@ void light::light(void)
if (!m_strPattern) {
m_strPattern = "m";
}
light::Respawn();
}
CLASSEXPORT(light_spot, light)

View file

@ -85,5 +85,4 @@ void scripted_sentence::scripted_sentence(void)
}
CBaseTrigger::CBaseTrigger();
scripted_sentence::Respawn();
}

View file

@ -63,5 +63,4 @@ void trigger_auto::trigger_auto(void)
}
}
CBaseTrigger::CBaseTrigger();
Respawn();
}

View file

@ -83,5 +83,4 @@ void trigger_autosave::trigger_autosave(void)
}
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
trigger_autosave::Respawn();
}

View file

@ -124,7 +124,6 @@ void trigger_changelevel::trigger_changelevel(void)
}
CBaseTrigger::CBaseTrigger();
CBaseTrigger::InitBrushTrigger();
trigger_changelevel::Respawn();
}
vector Landmark_GetSpot(void)

View file

@ -47,5 +47,4 @@ void trigger_endsection::trigger_endsection(void)
{
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
trigger_endsection::Respawn();
}

View file

@ -66,7 +66,6 @@ void trigger_gravity::trigger_gravity(void)
}
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
trigger_gravity::Respawn();
#endif
}

View file

@ -147,5 +147,4 @@ void trigger_hurt::trigger_hurt(void)
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
trigger_hurt::Respawn();
}

View file

@ -99,7 +99,6 @@ void trigger_multiple::trigger_multiple(void)
}
}
trigger_multiple::Respawn();
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
}

View file

@ -76,7 +76,7 @@ void trigger_once::trigger_once(void)
break;
}
}
trigger_once::Respawn();
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
}

View file

@ -128,5 +128,4 @@ void trigger_push::trigger_push(void)
CBaseTrigger::CBaseTrigger();
CBaseTrigger::InitBrushTrigger();
trigger_push::Respawn();
}

View file

@ -29,6 +29,7 @@ void Damage_Radius( vector, entity, float, float, int, int);
void Damage_Apply( entity, entity, float, int, int);
void Client_TriggerCamera( entity eTarget, vector vPos, vector vEndPos, float fResetTime );
void Game_Input(void);
int Rules_IsTeamPlay(void);
entity eActivator;

View file

@ -122,6 +122,15 @@ void init(float prevprogs)
Plugin_Init();
}
void init_respawn(void)
{
for (entity a = world; (a = findfloat(a, gflags, GF_CANRESPAWN));) {
CBaseEntity ent = (CBaseEntity)a;
ent.Respawn();
}
remove(self);
}
void initents(void)
{
precache_sound("weapons/explode3.wav");
@ -191,6 +200,10 @@ void initents(void)
Game_Worldspawn();
Decals_Init();
entity respawntimer = spawn();
respawntimer.think = init_respawn;
respawntimer.nextthink = time + 0.1f;
}
void worldspawn(void)

View file

@ -81,6 +81,7 @@
../server.c
../valve/damage.c
../traceattack.c
../valve/rules.c
../footsteps.c
../flashlight.c
input.c

View file

@ -78,6 +78,7 @@
../server.c
../valve/damage.c
../traceattack.c
../valve/rules.c
../footsteps.c
../flashlight.c
input.c

View file

@ -63,6 +63,7 @@ client.c
../server.c
../valve/damage.c
../traceattack.c
../valve/rules.c
../footsteps.c
../flashlight.c
input.c

View file

@ -64,6 +64,7 @@ client.c
../server.c
../valve/damage.c
../traceattack.c
../valve/rules.c
../footsteps.c
../flashlight.c
input.c

View file

@ -82,6 +82,7 @@ server.c
../valve/damage.c
../traceattack.c
../valve/rules.c
../footsteps.c
../flashlight.c

View file

@ -67,6 +67,7 @@ client.c
../server.c
../valve/damage.c
../traceattack.c
../valve/rules.c
../footsteps.c
../flashlight.c
input.c

View file

@ -69,6 +69,7 @@ server.c
../server.c
damage.c
../traceattack.c
../valve/rules.c
../footsteps.c
../flashlight.c
input.c

View file

@ -1 +1,20 @@
// TODO
/*
* Copyright (c) 2016-2019 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
int Rules_IsTeamPlay(void)
{
return cvar("teamplay");
}