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 // Standard Game Bindings
bind TAB "+showscores" // Feel free to modify them however you like
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"
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 any deps the engine requires and statically link them into the binary
BUILD_ENGINE_DEPENDENCIES=1 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 the bullet physics plugin, required for prop_physics and other entities
BUILD_BULLET=0 BUILD_BULLET=0
@ -26,7 +29,7 @@ BUILD_IQMTOOL=1
BUILD_IMGTOOL=1 BUILD_IMGTOOL=1
# Specify which engine revision to build, these are considered 'stable'; 0 = latest # 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 # Whether or not to run 'git pull' or 'svn up' before building a component
BUILD_UPDATE=1 BUILD_UPDATE=1

View File

@ -101,7 +101,7 @@ if [ "$BUILD_ENGINE_DEPENDENCIES" -eq 1 ]; then
printf "Built the static dependencies successfully.\n\n" printf "Built the static dependencies successfully.\n\n"
fi fi
gmake -j $BUILD_PROC $MAKETARGET FTE_TARGET=$PLATFORM gmake -j $BUILD_PROC $MAKETARGET CFLAGS=-DMULTITHREAD FTE_TARGET=$PLATFORM
cp -v "$OUTPUT" ../../../bin/fteqw cp -v "$OUTPUT" ../../../bin/fteqw
printf "Built the client engine successfully.\n\n" 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" printf "Built the imgtool successfully.\n\n"
fi 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 if [ "$BUILD_BULLET" -eq 1 ]; then
gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="bullet" gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="bullet"
find ./release/ -name 'fteplug_bullet_*.so' -exec cp -prv '{}' '../../../bin/' ';' find ./release/ -name 'fteplug_bullet_*.so' -exec cp -prv '{}' '../../../bin/' ';'

View File

@ -34,6 +34,8 @@
varying vec2 tex_c; varying vec2 tex_c;
varying vec3 lightvector; varying vec3 lightvector;
#define VERTEXCOLOURS
#if defined(VERTEXCOLOURS) #if defined(VERTEXCOLOURS)
varying vec4 vc; varying vec4 vc;
#endif #endif
@ -134,9 +136,6 @@ varying vec3 lightvector;
#else #else
vec4 bases = vec4(0.5, 0.5, 0.5, 1.0); vec4 bases = vec4(0.5, 0.5, 0.5, 1.0);
#endif #endif
#ifdef VERTEXCOLOURS
bases.rgb *= bases.a;
#endif
#endif #endif
#if defined(BUMP) || defined(SPECULAR) || defined(REFLECTCUBEMASK) #if defined(BUMP) || defined(SPECULAR) || defined(REFLECTCUBEMASK)
@ -188,9 +187,11 @@ varying vec3 lightvector;
diff *= textureCube(s_projectionmap, vtexprojcoord.xyz).rgb; diff *= textureCube(s_projectionmap, vtexprojcoord.xyz).rgb;
#endif #endif
#if defined(VERTEXCOLOURS) if (bases.a < 0.5)
diff *= vc.rgb * vc.a; discard;
#endif
if (vc.a < 0.5)
discard;
diff *= colorscale * l_lightcolour; diff *= colorscale * l_lightcolour;
gl_FragColor = vec4(fog3additive(diff), 1.0); 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); setproperty(VF_SIZE, video_res);
pSeat->m_ePlayer = self = findfloat(world, entnum, player_localentnum); pSeat->m_ePlayer = self = findfloat(world, entnum, player_localentnum);
pl = (player)self;
if (!self) { if (!self) {
continue; continue;
} }
if (self.classname == "player") { if (self.classname == "player") {
pl = (player)self;
Predict_PlayerPreFrame(pl); Predict_PlayerPreFrame(pl);
pSeat->m_vecPredictedOrigin = pl.origin; 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_CL_VIEWANGLES, view_angles);
setproperty(VF_ANGLES, view_angles); setproperty(VF_ANGLES, view_angles);
} else { } else {
if (self.classname == "player") { if (getplayerkeyvalue(pl.entnum-1, "*spec") == "0") {
pl = (player)self;
setproperty(VF_ORIGIN, pSeat->m_vecPredictedOrigin + pl.view_ofs); setproperty(VF_ORIGIN, pSeat->m_vecPredictedOrigin + pl.view_ofs);
if (pl.flags & FL_INVEHICLE) { if (pl.flags & FL_INVEHICLE) {
@ -314,7 +313,7 @@ CSQC_UpdateView(float w, float h, float focus)
pSeat->m_flShakeDuration -= clframetime; pSeat->m_flShakeDuration -= clframetime;
} }
setproperty(VF_ANGLES, view_angles + pl.punchangle); setproperty(VF_ANGLES, view_angles + pl.punchangle);
} else if (self.classname == "spectator") { } else if (getplayerkeyvalue(pl.entnum-1, "*spec") == "1") {
spec = (spectator)self; spec = (spectator)self;
switch (spec.spec_mode) { switch (spec.spec_mode) {
case SPECMODE_THIRDPERSON: case SPECMODE_THIRDPERSON:
@ -344,6 +343,18 @@ CSQC_UpdateView(float w, float h, float focus)
default: default:
setproperty(VF_ORIGIN, pSeat->m_vecPredictedOrigin); 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) { if (g_iIntermission) {
@ -389,10 +400,10 @@ CSQC_UpdateView(float w, float h, float focus)
GameText_Draw(); GameText_Draw();
PointMessage_Draw(); PointMessage_Draw();
if (self.classname == "spectator") { if (getplayerkeyvalue(pl.entnum-1, "*spec") == "0") {
HUD_DrawSpectator();
} else if (self.classname == "player") {
HUD_Draw(); HUD_Draw();
} else if (self.classname == "player") {
HUD_DrawSpectator();
} }
Voice_DrawHUD(); Voice_DrawHUD();

View File

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

View File

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

View File

@ -32,7 +32,6 @@ class prop_dynamic:NSRenderableEntity
void(void) prop_dynamic; void(void) prop_dynamic;
virtual void(void) Respawn; virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
}; };
void void
@ -44,20 +43,8 @@ prop_dynamic::Respawn(void)
takedamage = DAMAGE_MATERIAL; 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 void
prop_dynamic::prop_dynamic(void) prop_dynamic::prop_dynamic(void)
{ {
super::NSRenderableEntity(); super::NSRenderableEntity();
} }

View File

@ -43,7 +43,6 @@ class prop_static:NSRenderableEntity
void(void) prop_static; void(void) prop_static;
virtual void(void) Respawn; virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
}; };
void void
@ -55,20 +54,8 @@ prop_static::Respawn(void)
takedamage = DAMAGE_MATERIAL; 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 void
prop_static::prop_static(void) prop_static::prop_static(void)
{ {
super::NSRenderableEntity(); super::NSRenderableEntity();
} }

View File

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

View File

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

View File

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

View File

@ -295,6 +295,67 @@ base_player::Respawn(void)
/* make sure nothing happens here */ /* 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 base_player::EvaluateEntity