Add BUILD_ODE build.cfg setting. Add stubs for platform specific functions

like achievements, rich presense. Minor GLSL adjustments.
This commit is contained in:
Marco Cawthorne 2021-11-20 17:27:52 +01:00
parent 1e31ab2955
commit eb85121716
Signed by: eukara
GPG Key ID: C196CD8BA993248A
31 changed files with 458 additions and 104 deletions

View File

@ -14,9 +14,12 @@ BUILD_CLEAN=0
BUILD_ENGINE_DEPENDENCIES=1
# Build Source engine format support
BUILD_SOURCE=0
BUILD_SOURCE=1
# Build the bullet physics plugin, required for prop_physics and other entities
# Build the Open Dynamics Engine physics simulator. More feature complete.
BUILD_ODE=0
# Build the Bullet physics simulator, still WiP
BUILD_BULLET=0
# Build ffmpeg, required for video, flac and menu header playback
@ -29,7 +32,7 @@ BUILD_IQMTOOL=1
BUILD_IMGTOOL=1
# Specify which engine revision to build, these are considered 'stable'; 0 = latest
BUILD_ENGINEREVISION=6117
BUILD_ENGINEREVISION=6131
# Whether or not to run 'git pull' or 'svn up' before building a component
BUILD_UPDATE=1

View File

@ -131,6 +131,12 @@ if [ "$BUILD_BULLET" -eq 1 ]; then
printf "Built the bullet plugin successfully.\n\n"
fi
if [ "$BUILD_ODE" -eq 1 ]; then
gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ode"
find ./release/ -name 'fteplug_ode_*.so' -exec cp -prv '{}' '../../../bin/' ';'
printf "Built the ode plugin successfully.\n\n"
fi
if [ "$BUILD_FFMPEG" -eq 1 ]; then
gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ffmpeg"
find ./release/ -name 'fteplug_ffmpeg_*.so' -exec cp -prv '{}' '../../../bin/' ';'

View File

@ -38,9 +38,11 @@ void main ()
tccoord = ( dir.xy + e_time * 0.02 );
vec4 cloud2_f = texture2D( s_cloudB, tccoord );
vec3 dodged = vec3(1.0,1.0,1.0) - (cloud1_f.rgb * vec3(cloud1_f.a, cloud1_f.a, cloud1_f.a));
vec3 dodged1 = vec3(1.0,1.0,1.0) - (cloud1_f.rgb * vec3(cloud1_f.a, cloud1_f.a, cloud1_f.a));
vec3 dodged2 = vec3(1.0,1.0,1.0) - (cloud2_f.rgb * vec3(cloud2_f.a, cloud2_f.a, cloud2_f.a));
gl_FragColor.rgb = skybox.rgb / dodged;
gl_FragColor.rgb = skybox.rgb / dodged1;
gl_FragColor.rgb = gl_FragColor.rgb / dodged2;
gl_FragColor *= e_lmscale;
}
#endif

View File

@ -48,9 +48,12 @@ void main ()
vec4 cloud1_f = texture2D( s_cloudA, tccoord );
tccoord = ( dir.xy + e_time * 0.02 );
vec4 cloud2_f = texture2D( s_cloudB, tccoord );
vec3 dodged = vec3(1.0,1.0,1.0) - (cloud1_f.rgb * vec3(cloud1_f.a, cloud1_f.a, cloud1_f.a));
gl_FragColor.rgb = sky_out / dodged;
vec3 dodged1 = vec3(1.0,1.0,1.0) - (cloud1_f.rgb * vec3(cloud1_f.a, cloud1_f.a, cloud1_f.a));
vec3 dodged2 = vec3(1.0,1.0,1.0) - (cloud2_f.rgb * vec3(cloud2_f.a, cloud2_f.a, cloud2_f.a));
gl_FragColor.rgb = sky_out / dodged1;
gl_FragColor.rgb = gl_FragColor.rgb / dodged2;
//gl_FragColor *= e_lmscale;
}
#endif

View File

@ -38,9 +38,11 @@ void main ()
tccoord = ( dir.xy + e_time * 0.02 ) * 0.75;
vec4 cloud2_f = texture2D( s_cloudB, tccoord );
vec3 dodged = vec3(1.0,1.0,1.0) - (cloud1_f.rgb * vec3(cloud1_f.a, cloud1_f.a, cloud1_f.a));
vec3 dodged1 = vec3(1.0,1.0,1.0) - (cloud1_f.rgb * vec3(cloud1_f.a, cloud1_f.a, cloud1_f.a));
vec3 dodged2 = vec3(1.0,1.0,1.0) - (cloud2_f.rgb * vec3(cloud2_f.a, cloud2_f.a, cloud2_f.a));
gl_FragColor.rgb = skybox.rgb / dodged;
gl_FragColor.rgb = skybox.rgb / dodged1;
gl_FragColor.rgb = gl_FragColor.rgb / dodged2;
gl_FragColor *= e_lmscale;
}
#endif

View File

@ -52,6 +52,8 @@ class NSPhysicsEntity:NSSurfacePropEntity
virtual float(void) GetFriction;
virtual void(float) SetBounceFactor;
virtual float(void) GetBounceFactor;
virtual void(float) SetBounceStop;
virtual float(void) GetBounceStop;
virtual void(void) PhysicsEnable;
virtual void(void) PhysicsDisable;
virtual void(vector) ApplyForceCenter;

View File

@ -14,12 +14,24 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define ODE_MODE 1
.float geomtype;
.float friction;
.float erp;
.float jointtype;
.float mass;
.float bouncefactor;
.float bouncestop;
void
NSPhysicsEntity::PhysicsEnable(void)
{
if (physics_supported() == TRUE)
if (physics_supported() == TRUE) {
SetMovetype(MOVETYPE_PHYSICS);
SetSolid(SOLID_PHYSICS_BOX + m_iShape);
physics_enable(this, TRUE);
else {
} else {
SetMovetype(MOVETYPE_BOUNCE);
SetSolid(SOLID_CORPSE);
}
@ -31,6 +43,7 @@ NSPhysicsEntity::PhysicsDisable(void)
{
if (physics_supported() == TRUE) {
physics_enable(this, FALSE);
SetMovetype(MOVETYPE_NONE);
} else {
SetMovetype(MOVETYPE_BOUNCE);
SetSolid(SOLID_CORPSE);
@ -71,6 +84,17 @@ NSPhysicsEntity::GetBounceFactor(void)
return bouncefactor;
}
void
NSPhysicsEntity::SetBounceStop(float val)
{
bouncestop = val;
}
float
NSPhysicsEntity::GetBounceStop(void)
{
return bouncestop;
}
void
NSPhysicsEntity::SetInertia(float val)
{
@ -100,7 +124,7 @@ NSPhysicsEntity::CalculateImpactDamage(int iDamage, int dmgType)
filter |= (dmgType & DMG_SLOWFREEZE);
if (filter == 0i)
return (float)iDamage * 0.1f;
return (float)iDamage * 100;
else
return 0.0f;
}
@ -140,6 +164,7 @@ NSPhysicsEntity::ApplyTorqueCenter(vector vecTorque)
void
NSPhysicsEntity::TouchThink(void)
{
#if 0
/* let players collide */
dimension_solid = 255;
dimension_hit = 255;
@ -155,6 +180,8 @@ NSPhysicsEntity::TouchThink(void)
}
}
#endif
/* If we barely move, disable the physics simulator */
if (vlen(velocity) <= 1) {
if (m_iEnabled) {
@ -180,9 +207,11 @@ NSPhysicsEntity::TouchThink(void)
}
}
#if 0
/* don't let players collide */
dimension_solid = 1;
dimension_hit = 1;
#endif
/* continue testing next frame */
nextthink = time;
@ -194,7 +223,7 @@ NSPhysicsEntity::touch(void)
{
PhysicsEnable();
makevectors(vectoangles(origin - other.origin));
ApplyForceOffset(v_forward, origin - other.origin);
ApplyForceOffset(v_forward * 100, origin - other.origin);
}
void
@ -206,6 +235,7 @@ NSPhysicsEntity::Pain(void)
return;
PhysicsEnable();
makevectors(vectoangles(origin - trace_endpos));
force = CalculateImpactDamage(g_dmg_iDamage, g_dmg_iFlags);
@ -223,19 +253,29 @@ NSPhysicsEntity::Respawn(void)
SetMovetype(MOVETYPE_PHYSICS);
SetSolid(SOLID_PHYSICS_BOX + m_iShape);
SetModel(GetSpawnModel());
geomtype = GEOMTYPE_BOX;
geomtype = GEOMTYPE_TRIMESH;
takedamage = DAMAGE_YES;
#ifndef ODE_MODE
PhysicsDisable();
SetFriction(2.0f);
SetBounceFactor(0.25f);
#else
PhysicsDisable();
SetMass(1.0f);
SetFriction(1.0f);
SetBounceFactor(0.1f);
#endif
SetOrigin(GetSpawnOrigin());
/* don't let players collide */
dimension_solid = 1;
dimension_hit = 1;
//dimension_solid = 1;
//dimension_hit = 1;
think = TouchThink;
nextthink = time + 0.1f;
effects &= ~EF_NOSHADOW;
if (HasPropData()) {
@ -285,4 +325,6 @@ NSPhysicsEntity::NSPhysicsEntity(void)
mass = 1.0f;
m_flInertiaScale = 1.0f;
super::NSSurfacePropEntity();
cvar_set("physics_ode_iterationsperframe", "1");
}

View File

@ -126,7 +126,7 @@ NSSurfacePropEntity::Restore(string strKey, string strValue)
m_flBurnNext = ReadFloat(strValue);
break;
case "m_strOnBreak":
m_strOnBreak = ReadInt(strValue);
m_strOnBreak = ReadString(strValue);
break;
case "m_oldHealth":
m_oldHealth = ReadFloat(strValue);

View File

@ -3,16 +3,13 @@
../shared/math.h
../shared/math.qc
../shared/platform.h
../platform/defs.h
defs.h
bitmaps.h
strings.h
strings.qc
util.qc
colors.qc
master.qc
servers.qc
modserver.qc
tcp.qc
widgets.qc
w_3dview.qc
@ -65,10 +62,11 @@ m_viewreadme.qc
m_updates.qc
m_intro.qc
m_main.qc
music.qc
menu.qc
background.qc
../platform/includes.src
../client/font.qc
entry.qc
#endlist

View File

@ -0,0 +1,30 @@
typedef struct
{
int m_iID;
string m_strName;
string m_strDescription;
int m_iAchieved;
string m_strMaterial;
} achievement_t;
/* unlock an achievement */
void Achievement_Set(string strName);
/* clea an achievement (development purposes mainly) */
void Achievement_Clear(string strName);
/* returns whether or not an achievement has been achieved */
int Achievement_Get(string strName);
/* get the icon of an achievement */
string Achievement_GetIcon(string strName);
/* STUB, returns how many other users achieved this */
float Achievement_GetPercentage(string strName);
/* called when you want to show a pop-up indicating progress */
void Achievement_IndicateProgress(string strName, int iCurrent, int iMax);
/* updates the achievement_t pointer with what's been achieved and what's not been achieved */
void Achievement_RequestStats(achievement_t *ptr, int count);

View File

@ -0,0 +1,41 @@
/* unlock an achievement */
void
Achievement_Set(string strName)
{
}
/* clea an achievement (development purposes mainly) */
void
Achievement_Clear(string strName)
{
}
/* returns whether or not an achievement has been achieved */
int
Achievement_Get(string strName)
{
}
/* get the icon of an achievement */
string
Achievement_GetIcon(string strName)
{
}
/* STUB, returns how many other users achieved this */
float
Achievement_GetPercentage(string strName)
{
}
/* called when you want to show a pop-up indicating progress */
void
Achievement_IndicateProgress(string strName, int iCurrent, int iMax)
{
}
/* updates the achievement_t pointer with what's been achieved and what's not been achieved */
void
Achievement_RequestStats(achievement_t *ptr, int count)
{
}

8
src/platform/defs.h Normal file
View File

@ -0,0 +1,8 @@
#include "achievements.h"
#include "master.h"
#include "modserver.h"
#include "music.h"
#include "richpresence.h"
#include "servers.h"
#include "tcp.h"
#include "util.h"

10
src/platform/includes.src Normal file
View File

@ -0,0 +1,10 @@
#includelist
achievements.qc
master.qc
modserver.qc
music.qc
richpresence.qc
servers.qc
tcp.qc
util.qc
#endlist

51
src/platform/master.h Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2016-2020 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.
*/
#define MASTER_DNS "master.frag-net.com"
#define MASTER_PORT 27950
float srv_fldAdress;
float srv_fldName;
float srv_fldPing;
float srv_fldPlayers;
float srv_fldMaxplayers;
float srv_fldMap;
float srv_fldGame;
/* returns IP of master server */
string Master_Resolve(void);
/* returns the total amount of games */
int Master_GetTotalServers(void);
/* returns the amount of internet games */
int Master_GetInternetServers(void);
/* get completely new list of servers, hard-reset the cache */
void Master_UpdateCache(void);
/* refresh the current server cache */
void Master_RefreshCache(void);
/* sort the server cache without refreshing */
void Master_ResortCache(void);
/* grab a new internet game list */
void Master_GetInternetList(void);
/* grab a new LAN list */
void Master_GetLANList(void);

View File

@ -14,19 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
int Server_IsLan(string address);
#define MASTER_DNS "master.frag-net.com"
#define MASTER_PORT 27950
float srv_fldAdress;
float srv_fldName;
float srv_fldPing;
float srv_fldPlayers;
float srv_fldMaxplayers;
float srv_fldMap;
float srv_fldGame;
string
Master_Resolve(void)
{

36
src/platform/modserver.h Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2016-2020 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.
*/
#ifndef WEBMENU
#define MODSERVER_REQ_LIST 100
#define MODSERVER_REQ_ITEM 101
#define ModServer_URI_Callback URI_Get_Callback
var int g_iModServerLoading;
var int g_iModServerReqCount;
int game_getpackageid(string pkgname);
void ModServer_Refresh(void);
void ModServer_ParseList(string data);
void ModServer_ParseItem(string data);
/* Called as an eventual result of the uri_get builtin. */
void ModServer_URI_Callback(float id, float code, string data, int resourcebytes);
#endif

View File

@ -15,16 +15,6 @@
*/
#ifndef WEBMENU
#define MODSERVER_REQ_LIST 100
#define MODSERVER_REQ_ITEM 101
#define ModServer_URI_Callback URI_Get_Callback
var int g_iModServerLoading;
var int g_iModServerReqCount;
int game_getpackageid(string pkgname);
void*
memrealloc(__variant *oldptr, int elementsize, int old_num, int new_num)
{

66
src/platform/music.h Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2016-2020 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.
*/
/* we're forced to support a few different paths */
enum
{
MUSIC_AUTO,
MUSIC_FLAC, /* requires fteplug_ffmpeg */
MUSIC_STEAMHL
};
string g_steamhltracks[27] = {
"media/Half-Life01.mp3",
"media/Prospero01.mp3",
"media/Half-Life12.mp3",
"media/Half-Life07.mp3",
"media/Half-Life10.mp3",
"media/Suspense01.mp3",
"media/Suspense03.mp3",
"media/Half-Life09.mp3",
"media/Half-Life02.mp3",
"media/Half-Life13.mp3",
"media/Half-Life04.mp3",
"media/Half-Life15.mp3",
"media/Half-Life14.mp3",
"media/Half-Life16.mp3",
"media/Suspense02.mp3",
"media/Half-Life03.mp3",
"media/Half-Life08.mp3",
"media/Prospero02.mp3",
"media/Half-Life05.mp3",
"media/Prospero04.mp3",
"media/Half-Life11.mp3",
"media/Half-Life06.mp3",
"media/Prospero03.mp3",
"media/Half-Life17.mp3",
"media/Prospero05.mp3",
"media/Suspense05.mp3",
"media/Suspense07.mp3"
};
var int autocvar_cl_musicstyle = MUSIC_AUTO;
/* some installs may have the music in media/, others may be in music/ */
string Music_GetPath(int id);
/* EV_MUSICTRACK */
void Music_ParseTrack(string parm);
/* EV_MUSICLOOP */
void Music_ParseLoop(string parm);
void Music_MenuStart(void);

View File

@ -14,46 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* we're forced to support a few different paths */
enum
{
MUSIC_AUTO,
MUSIC_FLAC, /* requires fteplug_ffmpeg */
MUSIC_STEAMHL
};
string g_steamhltracks[27] = {
"media/Half-Life01.mp3",
"media/Prospero01.mp3",
"media/Half-Life12.mp3",
"media/Half-Life07.mp3",
"media/Half-Life10.mp3",
"media/Suspense01.mp3",
"media/Suspense03.mp3",
"media/Half-Life09.mp3",
"media/Half-Life02.mp3",
"media/Half-Life13.mp3",
"media/Half-Life04.mp3",
"media/Half-Life15.mp3",
"media/Half-Life14.mp3",
"media/Half-Life16.mp3",
"media/Suspense02.mp3",
"media/Half-Life03.mp3",
"media/Half-Life08.mp3",
"media/Prospero02.mp3",
"media/Half-Life05.mp3",
"media/Prospero04.mp3",
"media/Half-Life11.mp3",
"media/Half-Life06.mp3",
"media/Prospero03.mp3",
"media/Half-Life17.mp3",
"media/Prospero05.mp3",
"media/Suspense05.mp3",
"media/Suspense07.mp3"
};
var int autocvar_cl_musicstyle = MUSIC_AUTO;
/* some installs may have the music in media/, others may be in music/ */
string
Music_GetPath(int id)

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2016-2020 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.
*/
void RichPresence_Set(string strKey, string strValue);
//string RichPresence_Get(string strKey);

View File

@ -0,0 +1,8 @@
void
RichPresence_Set(string strKey, string strValue)
{
};

18
src/platform/servers.h Normal file
View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2016-2020 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.
*/
/* returns if a given address is external */
int Server_IsLan(string address);

45
src/platform/tcp.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2016-2020 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.
*/
#define TCP_BUFFER_LENGTH 32
typedef struct
{
filestream m_fSocket;
string m_strBuffer[TCP_BUFFER_LENGTH];
int m_iBufferLines;
int m_iState;
} tcpinfo_t;
enum
{
STATE_DISCONNECTED,
STATE_CONNECTING,
STATE_CONNECTED
};
int TCP_Connect(tcpinfo_t *in, string path);
void TCP_Disconnect(tcpinfo_t *in);
int TCP_Send(tcpinfo_t *in, string msg);
string TCP_Receive(tcpinfo_t *in);
/* you want to run this every frame */
void TCP_Frame(tcpinfo_t *in);
int TCP_GetState(tcpinfo_t *in);

View File

@ -14,23 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define TCP_BUFFER_LENGTH 32
typedef struct
{
filestream m_fSocket;
string m_strBuffer[TCP_BUFFER_LENGTH];
int m_iBufferLines;
int m_iState;
} tcpinfo_t;
enum
{
STATE_DISCONNECTED,
STATE_CONNECTING,
STATE_CONNECTED
};
int
TCP_Connect(tcpinfo_t *in, string path)
{

21
src/platform/util.h Normal file
View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2016-2020 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 Util_CheckMouse(int x, int y, int sx, int sy);
string Util_CmdToKey(string cmd);
float lerp(float fA, float fB, float fPercent);

View File

@ -14,7 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../menu-fn/tcp.qc"
#include "../platform/tcp.h"
#include "../platform/tcp.qc"
entity g_ircbridge;
tcpinfo_t tcp_irc;

View File

@ -50,11 +50,18 @@ TraceAttack_FireSingle(vector vecPos, vector vAngle, int iDamage, int iWeapon)
range = (vAngle * 8196);
self.dimension_solid = 255;
self.dimension_hit = 255;
/* make sure we can gib corpses */
int oldhitcontents = self.hitcontentsmaski;
self.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
traceline(vecPos, vecPos + range, MOVE_LAGGED | MOVE_HITMODEL, self);
self.hitcontentsmaski = oldhitcontents;
self.dimension_solid = 254;
self.dimension_hit = 254;
g_multiDamage_HitBod |= trace_surface_id;
if (trace_fraction >= 1.0f)

View File

@ -175,6 +175,18 @@ setmodel(entity ent, string mname)
return prior(ent, mname);
}
__wrap __variant*
memalloc(int size)
{
#if 0
if (size > 55000)
breakpoint();
print(sprintf("memalloc: %i\n", size));
#endif
return prior(size);
}
void
setorigin_safe(entity target, vector testorg)
{

View File

@ -569,6 +569,9 @@ PMoveCustom_RunPlayerPhysics(entity target)
entity oldself = self;
self = target;
self.dimension_solid = 254;
self.dimension_hit = 254;
/* call accelerate before and after the actual move,
* with half the move each time. this reduces framerate dependence.
* and makes controlling jumps slightly easier */