Minor cleanups and initial research into the Threewave CTF entities that are referenced in some versions of DMC

This commit is contained in:
Marco Cawthorne 2023-04-22 01:03:54 -07:00
parent deac6b59b2
commit f3bdb3d3e7
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
5 changed files with 233 additions and 31 deletions

View File

@ -56,51 +56,43 @@ HLSingleplayerRules::PlayerDeath(NSClientPlayer pl)
void
HLSingleplayerRules::PlayerSpawn(NSClientPlayer pl)
{
string playerModel = "models/player.mdl";
pl.classname = "player";
pl.health = pl.max_health = 100;
pl.takedamage = DAMAGE_YES;
pl.SetHealth(100);
pl.SetMaxHealth(100);
pl.SetTakedamage(DAMAGE_YES);
pl.SetSolid(SOLID_SLIDEBOX);
pl.SetMovetype(MOVETYPE_WALK);
pl.flags = FL_CLIENT;
pl.AddFlags(FL_CLIENT);
pl.viewzoom = 1.0;
pl.model = "models/player.mdl";
/* if in cooperative mode, we want to respect the player model */
if (cvar("coop") == 1) {
string mymodel = infokey(pl, "model");
if (mymodel) {
mymodel = sprintf("models/player/%s/%s.mdl", mymodel, mymodel);
if (whichpack(mymodel)) {
pl.model = mymodel;
string testModel = infokey(pl, "model");
if (testModel) {
testModel = sprintf("models/player/%s/%s.mdl", testModel, testModel);
if (whichpack(testModel)) {
playerModel = testModel;
}
}
}
setmodel(pl, pl.model);
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
pl.velocity = [0,0,0];
pl.gravity = __NULL__;
pl.frame = 1;
//pl.SendEntity = Player_SendEntity;
pl.SendFlags = UPDATE_ALL;
pl.customphysics = Empty;
pl.iBleeds = TRUE;
forceinfokey(pl, "*spec", "0");
forceinfokey(pl, "*deaths", ftos(pl.deaths));
/* this is where the mods want to deviate */
entity spot;
pl.SetModel(playerModel);
pl.SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
pl.ClearVelocity();
pl.SetInfoKey("*spec", "0");
pl.SetInfoKey("*deaths", ftos(pl.deaths));
pl.SetCanBleed(true);
if (startspot != "") {
dprint(sprintf("^3Gamerules_Spawn^7: Startspot is %s\n", startspot));
LevelDecodeParms(pl);
setorigin(pl, Landmark_GetSpot());
pl.SetOrigin(Landmark_GetSpot());
} else {
entity spawnPoint;
LevelNewParms();
spot = find(world, ::classname, "info_player_start");
setorigin(pl, spot.origin);
pl.angles = spot.angles;
spawnPoint = find(world, ::classname, "info_player_start");
pl.Transport(spawnPoint.origin, spawnPoint.angles);
}
Weapons_RefreshAmmo(pl);

View File

@ -97,4 +97,5 @@ gamerules_multiplayer.qc
../../../src/server/include.src
../../../src/shared/include.src
maphacks.qc
threewave.qc
#endlist

209
src/server/threewave.qc Normal file
View File

@ -0,0 +1,209 @@
/*
* Copyright (c) 2023 Marco Cawthorne <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.
*/
/* This file adds support for Threewave CTF items and rules */
/** Flag abstract superclass */
class
DMC3WaveFlag:NSRenderableEntity
{
float m_teamAlliance;
void DMC3WaveFlag(void);
virtual void Respawn(void);
virtual void Touch(entity);
virtual void ReturnTakenFlag(player);
virtual void CaptureFlag(player);
virtual void StealFlag(player);
};
void
DMC3WaveFlag::DMC3WaveFlag(void)
{
m_teamAlliance = 0;
}
void
DMC3WaveFlag::ReturnTakenFlag(player flagCarrier)
{
NSEntity theFlag;
if (flagCarrier.GetTeam() == 1) {
theFlag = (NSEntity)find(world, ::classname, "item_flag_team2");
} else {
theFlag = (NSEntity)find(world, ::classname, "item_flag_team1");
}
theFlag.Respawn();
theFlag.Show();
}
void
DMC3WaveFlag::Respawn(void)
{
SetOrigin(GetSpawnOrigin());
SetModel("models/flag.mdl");
SetSolid(SOLID_TRIGGER);
SetSize([-16, -16, 0], [16, 16, 74]);
DropToFloor();
}
void
DMC3WaveFlag::CaptureFlag(player capturingClient)
{
ReturnTakenFlag(capturingClient);
capturingClient.RemoveFlags(FL_GOALITEM);
capturingClient.frags += 10;
NSLog("%s of team %d has captured a flag!", capturingClient.netname, capturingClient.GetTeam());
}
void
DMC3WaveFlag::StealFlag(player stealingClient)
{
Disappear();
stealingClient.AddFlags(FL_GOALITEM);
NSLog("%s of team %d has stolen a flag!", stealingClient.netname, stealingClient.GetTeam());
}
void
DMC3WaveFlag::Touch(entity eToucher)
{
player theToucher;
if (eToucher.classname != "player")
return;
theToucher = (player)eToucher;
/* ignore your own flag */
if (theToucher.GetTeam() == m_teamAlliance) {
if (theToucher.HasFlags(FL_GOALITEM) == false)
return;
CaptureFlag(theToucher);
return;
}
StealFlag(theToucher);
}
/*!QUAKED item_flag_team1 (1.0 0.0 0.0) (-16 -16 0) (16 16 74)
# OVERVIEW
Flag for the team 1 in Threewave CTF (RED)
# TRIVIA
This entity was introduced in Threewave CTF (1996).
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
model="models/flag.mdl"
skin="1"
*/
class
item_flag_team1:DMC3WaveFlag
{
void item_flag_team1(void);
virtual void Respawn(void);
};
void
item_flag_team1::item_flag_team1(void)
{
}
void
item_flag_team1::Respawn(void)
{
super::Respawn();
SetSkin(1);
m_teamAlliance = 1;
SetRenderFX(RFX_GLOWSHELL);
SetRenderColor([1.0, 0.0, 0.0]);
SetRenderAmt(1.0f);
}
/*!QUAKED item_flag_team2 (0.0 0.0 1.0) (-16 -16 0) (16 16 74)
# OVERVIEW
Flag for the team 2 in Threewave CTF (BLUE)
# TRIVIA
This entity was introduced in Threewave CTF (1996).
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
model="models/flag.mdl"
skin="2"
*/
class
item_flag_team2:DMC3WaveFlag
{
void item_flag_team2(void);
virtual void Respawn(void);
};
void
item_flag_team2::item_flag_team2(void)
{
}
void
item_flag_team2::Respawn(void)
{
super::Respawn();
SetSkin(2);
m_teamAlliance = 2;
SetRenderFX(RFX_GLOWSHELL);
SetRenderColor([0.0, 0.0, 1.0]);
SetRenderAmt(1.0f);
}
/*!QUAKED info_player_team1 (1.0 0.0 0.0) (-16 -16 -36) (16 16 36)
# OVERVIEW
Spawn point for players of team 1 (RED)
# TRIVIA
This entity was introduced in Threewave CTF (1996).
*/
class
info_player_team1:NSRenderableEntity
{
void info_player_team1(void);
};
void
info_player_team1::info_player_team1(void)
{
}
/*!QUAKED info_player_team2 (0.0 0.0 1.0) (-16 -16 -36) (16 16 36)
# OVERVIEW
Spawn point for players of team 2 (BLUE)
# TRIVIA
This entity was introduced in Threewave CTF (1996).
*/
class
info_player_team2:NSRenderableEntity
{
void info_player_team2(void);
};
void
info_player_team2::info_player_team2(void)
{
}

View File

@ -144,6 +144,7 @@ class player:NSClientPlayer
#endif
virtual void Physics_Jump(void);
virtual float Physics_MaxSpeed(void);
virtual void UpdatePlayerAnimation(float);
#ifdef CLIENT

View File

@ -185,7 +185,6 @@ void
w_rocketlauncher_hud(player pl)
{
#ifdef CLIENT
vector laser_pos;
vector aicon_pos;
HUD_DrawQuakeCrosshair();