build_engine.sh: Support building of HL2/SRC2004 content via the new plugin

that you can enable in build.cfg...
base_player: Add MakeTempSpectator() and MakePlayer(), so gamemodes have it
easier to handle in-game status changes...
NSRenderableEntity: Add support for 'modelscale' key
This commit is contained in:
Marco Cawthorne 2021-11-09 17:33:16 +01:00
parent a48baff2d1
commit b670c994c1
Signed by: eukara
GPG Key ID: C196CD8BA993248A
13 changed files with 154 additions and 84 deletions

View File

@ -1,17 +1,29 @@
unbindall
bind TAB "+showscores"
bind CTRL "+duck"
bind ESCAPE "togglemenu"
bind LSHIFT "+speed"
bind PAUSE "pause"
bind SPACE "+jump"
bind a "+moveleft"
bind d "+moveright"
bind e "+use"
bind f "impulse 100"
bind s "+back"
bind t "messagemode"
bind w "+forward"
bind ~ "toggleconsole"
// Standard Game Bindings
// Feel free to modify them however you like
seta gl_font "gfx/shell/arial.ttf"
// Clear all bindings...
unbindall
// Movement
bind w "+forward"
bind a "+moveleft"
bind s "+back"
bind d "+moveright"
bind SPACE "+jump"
bind CTRL "+duck"
bind LSHIFT "+speed"
// Interact button
bind e "+use"
// Flashlight button
bind f "impulse 100"
// Misc interface buttons
bind t "messagemode"
bind TAB "+showscores"
bind ESCAPE "togglemenu"
bind PAUSE "pause"
// Developer console
bind ~ "toggleconsole"

View File

@ -13,6 +13,9 @@ BUILD_CLEAN=0
# Build any deps the engine requires and statically link them into the binary
BUILD_ENGINE_DEPENDENCIES=1
# Build Source engine format support
BUILD_SOURCE=0
# Build the bullet physics plugin, required for prop_physics and other entities
BUILD_BULLET=0
@ -26,7 +29,7 @@ BUILD_IQMTOOL=1
BUILD_IMGTOOL=1
# Specify which engine revision to build, these are considered 'stable'; 0 = latest
BUILD_ENGINEREVISION=6084
BUILD_ENGINEREVISION=6117
# Whether or not to run 'git pull' or 'svn up' before building a component
BUILD_UPDATE=1

View File

@ -101,7 +101,7 @@ if [ "$BUILD_ENGINE_DEPENDENCIES" -eq 1 ]; then
printf "Built the static dependencies successfully.\n\n"
fi
gmake -j $BUILD_PROC $MAKETARGET FTE_TARGET=$PLATFORM
gmake -j $BUILD_PROC $MAKETARGET CFLAGS=-DMULTITHREAD FTE_TARGET=$PLATFORM
cp -v "$OUTPUT" ../../../bin/fteqw
printf "Built the client engine successfully.\n\n"
@ -119,6 +119,12 @@ if [ "$BUILD_IMGTOOL" -eq 1 ]; then
printf "Built the imgtool successfully.\n\n"
fi
if [ "$BUILD_SOURCE" -eq 1 ]; then
gmake -j $BUILD_PROC plugins-rel CFLAGS=-DGLQUAKE NATIVE_PLUGINS="hl2"
find ./release/ -name 'fteplug_hl2_*.so' -exec cp -prv '{}' '../../../bin/' ';'
printf "Built the Source Engine plugin successfully.\n\n"
fi
if [ "$BUILD_BULLET" -eq 1 ]; then
gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="bullet"
find ./release/ -name 'fteplug_bullet_*.so' -exec cp -prv '{}' '../../../bin/' ';'

View File

@ -34,6 +34,8 @@
varying vec2 tex_c;
varying vec3 lightvector;
#define VERTEXCOLOURS
#if defined(VERTEXCOLOURS)
varying vec4 vc;
#endif
@ -134,9 +136,6 @@ varying vec3 lightvector;
#else
vec4 bases = vec4(0.5, 0.5, 0.5, 1.0);
#endif
#ifdef VERTEXCOLOURS
bases.rgb *= bases.a;
#endif
#endif
#if defined(BUMP) || defined(SPECULAR) || defined(REFLECTCUBEMASK)
@ -188,9 +187,11 @@ varying vec3 lightvector;
diff *= textureCube(s_projectionmap, vtexprojcoord.xyz).rgb;
#endif
#if defined(VERTEXCOLOURS)
diff *= vc.rgb * vc.a;
#endif
if (bases.a < 0.5)
discard;
if (vc.a < 0.5)
discard;
diff *= colorscale * l_lightcolour;
gl_FragColor = vec4(fog3additive(diff), 1.0);

View File

@ -221,13 +221,13 @@ CSQC_UpdateView(float w, float h, float focus)
setproperty(VF_SIZE, video_res);
pSeat->m_ePlayer = self = findfloat(world, entnum, player_localentnum);
pl = (player)self;
if (!self) {
continue;
}
if (self.classname == "player") {
pl = (player)self;
Predict_PlayerPreFrame(pl);
pSeat->m_vecPredictedOrigin = pl.origin;
@ -286,8 +286,7 @@ CSQC_UpdateView(float w, float h, float focus)
setproperty(VF_CL_VIEWANGLES, view_angles);
setproperty(VF_ANGLES, view_angles);
} else {
if (self.classname == "player") {
pl = (player)self;
if (getplayerkeyvalue(pl.entnum-1, "*spec") == "0") {
setproperty(VF_ORIGIN, pSeat->m_vecPredictedOrigin + pl.view_ofs);
if (pl.flags & FL_INVEHICLE) {
@ -314,7 +313,7 @@ CSQC_UpdateView(float w, float h, float focus)
pSeat->m_flShakeDuration -= clframetime;
}
setproperty(VF_ANGLES, view_angles + pl.punchangle);
} else if (self.classname == "spectator") {
} else if (getplayerkeyvalue(pl.entnum-1, "*spec") == "1") {
spec = (spectator)self;
switch (spec.spec_mode) {
case SPECMODE_THIRDPERSON:
@ -344,6 +343,18 @@ CSQC_UpdateView(float w, float h, float focus)
default:
setproperty(VF_ORIGIN, pSeat->m_vecPredictedOrigin);
}
} else if (getplayerkeyvalue(pl.entnum-1, "*spec") == "2") {
setproperty(VF_ORIGIN, pSeat->m_vecPredictedOrigin);
if (pSeat->m_flShakeDuration > 0.0) {
vector vecShake = [0,0,0];
vecShake[0] += random() * 3;
vecShake[1] += random() * 3;
vecShake[2] += random() * 3;
pl.punchangle += (vecShake * pSeat->m_flShakeAmp) * (pSeat->m_flShakeDuration / pSeat->m_flShakeTime);
pSeat->m_flShakeDuration -= clframetime;
}
setproperty(VF_ANGLES, view_angles + pl.punchangle);
}
if (g_iIntermission) {
@ -389,10 +400,10 @@ CSQC_UpdateView(float w, float h, float focus)
GameText_Draw();
PointMessage_Draw();
if (self.classname == "spectator") {
HUD_DrawSpectator();
} else if (self.classname == "player") {
if (getplayerkeyvalue(pl.entnum-1, "*spec") == "0") {
HUD_Draw();
} else if (self.classname == "player") {
HUD_DrawSpectator();
}
Voice_DrawHUD();

View File

@ -63,7 +63,7 @@ infodecal::Restore(string strKey, string strValue)
{
switch (strKey) {
case "child":
m_decChild = edict_num(ReadFloat(strValue));
m_decChild = (decal)edict_num(ReadFloat(strValue));
break;
case "texture":
m_strTexture = ReadString(strValue);

View File

@ -99,8 +99,8 @@ void
multi_manager::Save(float handle)
{
SaveString(handle, "m_strBuffer", m_strBuffer);
SaveString(handle, "m_iBusy", m_iBusy);
SaveString(handle, "m_iValue", m_iValue);
SaveInt(handle, "m_iBusy", m_iBusy);
SaveInt(handle, "m_iValue", m_iValue);
SaveFloat(handle, "m_eTriggers_0", num_for_edict(m_eTriggers[0]));
SaveFloat(handle, "m_eTriggers_1", num_for_edict(m_eTriggers[1]));
SaveFloat(handle, "m_eTriggers_2", num_for_edict(m_eTriggers[2]));
@ -134,52 +134,52 @@ switch (strKey) {
m_iValue = stoi(strValue);
break;
case "m_eTriggers_0":
m_eTriggers[0] = edict_num(stof(strValue));
m_eTriggers[0] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_1":
m_eTriggers[1] = edict_num(stof(strValue));
m_eTriggers[1] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_2":
m_eTriggers[2] = edict_num(stof(strValue));
m_eTriggers[2] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_3":
m_eTriggers[3] = edict_num(stof(strValue));
m_eTriggers[3] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_4":
m_eTriggers[4] = edict_num(stof(strValue));
m_eTriggers[4] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_5":
m_eTriggers[5] = edict_num(stof(strValue));
m_eTriggers[5] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_6":
m_eTriggers[6] = edict_num(stof(strValue));
m_eTriggers[6] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_7":
m_eTriggers[7] = edict_num(stof(strValue));
m_eTriggers[7] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_8":
m_eTriggers[8] = edict_num(stof(strValue));
m_eTriggers[8] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_9":
m_eTriggers[9] = edict_num(stof(strValue));
m_eTriggers[9] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_10":
m_eTriggers[10] = edict_num(stof(strValue));
m_eTriggers[10] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_11":
m_eTriggers[11] = edict_num(stof(strValue));
m_eTriggers[11] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_12":
m_eTriggers[12] = edict_num(stof(strValue));
m_eTriggers[12] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_13":
m_eTriggers[13] = edict_num(stof(strValue));
m_eTriggers[13] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_14":
m_eTriggers[14] = edict_num(stof(strValue));
m_eTriggers[14] = (multi_manager_sub)edict_num(stof(strValue));
break;
case "m_eTriggers_15":
m_eTriggers[15] = edict_num(stof(strValue));
m_eTriggers[15] = (multi_manager_sub)edict_num(stof(strValue));
break;
default:
super::Restore(strKey, strValue);

View File

@ -32,7 +32,6 @@ class prop_dynamic:NSRenderableEntity
void(void) prop_dynamic;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -44,20 +43,8 @@ prop_dynamic::Respawn(void)
takedamage = DAMAGE_MATERIAL;
}
void
prop_dynamic::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "modelscale":
scale = stof(strValue);
break;
default:
super::SpawnKey(strKey, strValue);
}
}
void
prop_dynamic::prop_dynamic(void)
{
super::NSRenderableEntity();
}
}

View File

@ -43,7 +43,6 @@ class prop_static:NSRenderableEntity
void(void) prop_static;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -55,20 +54,8 @@ prop_static::Respawn(void)
takedamage = DAMAGE_MATERIAL;
}
void
prop_static::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "modelscale":
scale = stof(strValue);
break;
default:
super::SpawnKey(strKey, strValue);
}
}
void
prop_static::prop_static(void)
{
super::NSRenderableEntity();
}
}

View File

@ -668,6 +668,7 @@ void
NSRenderableEntity::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "modelscale":
case "scale":
scale = stof(strValue);
break;
@ -722,7 +723,7 @@ void
NSRenderableEntity::NSRenderableEntity(void)
{
effects |= EF_NOSHADOW;
scale = 1.0f;
//scale = 1.0f;
super::NSEntity();
@ -736,5 +737,4 @@ NSRenderableEntity::NSRenderableEntity(void)
m_oldflRenderAmt = m_flRenderAmt;
#endif
#endif
}
}

View File

@ -661,8 +661,7 @@ SV_PerformLoad(float fh)
entity eold;
string l;
float n;
NSEntity loadent;
int braced;
NSEntity loadent = __NULL__;
#ifdef REEDICT
@ -671,7 +670,7 @@ SV_PerformLoad(float fh)
remove(e);
}
#else
entity e = world;
e = world;
#endif
/* read line per line of our file handle */

View File

@ -110,5 +110,8 @@ base_player
virtual void(void) Respawn;
virtual void(void) EvaluateEntity;
virtual float(entity, float) SendEntity;
virtual void(void) MakePlayer;
virtual void(void) MakeTempSpectator;
#endif
};

View File

@ -295,6 +295,67 @@ base_player::Respawn(void)
/* make sure nothing happens here */
}
/*
=================*
base_player::MakeTempSpectator
This is what dead players in round matches become, or when we spawn
for the first time before selecting a loadout or something.
=================
*/
void
base_player::MakeTempSpectator(void)
{
classname = "player";
flags = FL_CLIENT;
max_health = health = 0;
armor = 0;
g_items = 0;
activeweapon = 0;
effects = 0;
alpha = 0.0f;
solid = SOLID_NOT;
movetype = MOVETYPE_NOCLIP;
maxspeed = 250;
takedamage = DAMAGE_NO;
forceinfokey(this, "*spec", "2");
}
/*
=================*
base_player::MakeTempSpectator
This is what dead players in round matches become, or when we spawn
for the first time before selecting a loadout or something.
=================
*/
void
base_player::MakePlayer(void)
{
classname = "player";
flags = FL_CLIENT;
health = max_health = 100;
armor = 0;
g_items = 0;
activeweapon = 0;
effects = 0;
alpha = 1.0f;
takedamage = DAMAGE_YES;
solid = SOLID_SLIDEBOX;
movetype = MOVETYPE_WALK;
takedamage = DAMAGE_YES;
forceinfokey(this, "*spec", "0");
viewzoom = 1.0;
vehicle = __NULL__;
velocity = [0,0,0];
gravity = __NULL__;
SendFlags = UPDATE_ALL;
customphysics = Empty;
iBleeds = TRUE;
forceinfokey(this, "*deaths", ftos(deaths));
setsize(this, VEC_HULL_MIN, VEC_HULL_MAX);
}
/*
=================
base_player::EvaluateEntity