More fixes against upstream Nuclide

This commit is contained in:
Marco Cawthorne 2025-01-03 04:23:18 -08:00
parent d376999f6c
commit 26383cf05d
62 changed files with 660 additions and 406 deletions

View file

@ -44,14 +44,19 @@ Here's the quick and dirty instructions for those unfamilar:
```
$ git clone https://code.idtech.space/vera/nuclide Nuclide-SDK
$ cd Nuclide-SDK
$ ./build_engine.sh # (only required if you don't have an up-to-date FTEQW & FTEQCC in your PATH)
# (only required if you don't have an up-to-date FTEQW & FTEQCC in your PATH)
$ make update
$ make fteqw
# build the menu (from valve/) then our own game-logic:
$ git clone https://code.idtech.space/fn/valve valve
$ git clone https://code.idtech.space/fn/cstrike cstrike
$ SKIP_UPDATE=1 SKIP_RADIANT=1 ./build_game.sh valve
$ SKIP_UPDATE=1 SKIP_RADIANT=1 ./build_game.sh cstrike
$ make game GAME=valve
$ make game GAME=cstrike
```
You can also issue `make` inside `valve/src/` and `cstrike/src`, but it won't build an `entities.def` file for use in Radiant (level editor family).
You can also issue `make` inside `valve/src/` and `cstrike/src`, but it won't generate some additional helper files.
** !! You need to also provide data-files !! **

View file

@ -59,15 +59,6 @@ switch (fHeader) {
case EV_VIEWMODEL:
View_PlayAnimation(readbyte());
break;
case EV_WEAPON_PICKUP:
int w = readbyte();
if (autocvar_cl_autoweaponswitch == 1) {
sendevent("PlayerSwitchWeapon", "i", w);
}
HUD_WeaponPickupNotify(w);
break;
case EV_RADIOMSG:
Radio_PlayMessage(readbyte());
break;

View file

@ -116,12 +116,12 @@ HUD_DrawNums(float fNumber, vector vecPos, float fAlpha, vector vColor)
/* timer */
void
HUD_DrawTimer(int NSClientSpectator)
HUD_DrawTimer(int ncSpectator)
{
int iMinutes, iSeconds, iTens, iUnits;
vector time_pos;
if (NSClientSpectator) {
if (ncSpectator) {
time_pos = g_hudmins + [(g_hudres[0] / 2) - 62, 16];
} else {
time_pos = g_hudmins + [(g_hudres[0] / 2) - 62, g_hudres[1] - 42];

View file

@ -99,7 +99,7 @@ HUD_AmmoNotify_Insert(int type, int count)
/* called whenever we should check for pickup updates */
void
HUD_AmmoNotify_Check(NSClientPlayer pl)
HUD_AmmoNotify_Check(ncPlayer pl)
{
#if 0
HUD_AmmoNotify_Insert(0, pl.ammo_50ae - pl.ammo_50ae_net);
@ -119,6 +119,6 @@ HUD_AmmoNotify_Check(NSClientPlayer pl)
}
void
HUD_ItemNotify_Check(NSClientPlayer pl)
HUD_ItemNotify_Check(ncPlayer pl)
{
}

View file

@ -1,6 +1,7 @@
#pragma target fte_5768
//#pragma flag enable assumeint
#pragma progs_dat "../../csprogs.dat"
#pragma forcecrc 54730
#define CSQC
#define CLIENT

View file

@ -17,14 +17,14 @@
#define CSRADAR_DISTANCE 1024
var string g_cs_radar;
var NSRadar g_csRadar;
var ncRadar g_csRadar;
void
Radar_Init(void)
{
g_cs_radar = spriteframe("sprites/radar640.spr", 0, 0.0f);
g_csRadar = NSRadar::InitEmpty();
g_csRadar = ncRadar::InitEmpty();
}
void

View file

@ -14,10 +14,10 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
static VGUIWindow winBuyMenu;
static VGUILabel lblCategoryDescr;
static vguiWindow winBuyMenu;
static vguiLabel lblCategoryDescr;
class CSBuyMenuButton:VGUIButton
class CSBuyMenuButton:vguiButton
{
void CSBuyMenuButton(void);
@ -110,9 +110,9 @@ VGUI_BuyMenu(void)
static CSBuyMenuButton btnPrimAmmo;
static CSBuyMenuButton btnSecAmmo;
static CSBuyMenuButton btnEquipment;
static VGUIButton btnCancel;
static VGUILabel lblSelectTeam;
static VGUIFrame frmBuyInfo;
static vguiButton btnCancel;
static vguiLabel lblSelectTeam;
static vguiFrame frmBuyInfo;
static void VGUI_BuyMenu_Cancel(void) {
winBuyMenu.Hide();
@ -122,21 +122,21 @@ VGUI_BuyMenu(void)
vector btnpos = [40,80];
initialized = TRUE;
winBuyMenu = spawn(VGUIWindow);
winBuyMenu = spawn(vguiWindow);
winBuyMenu.SetSize('640 480');
winBuyMenu.SetStyleMask(VGUIWindowBorderless | VGUIWindowFullscreen);
winBuyMenu.SetStyleMask(vguiWindowBorderless | vguiWindowFullscreen);
lblSelectTeam = spawn(VGUILabel);
lblSelectTeam = spawn(vguiLabel);
lblSelectTeam.SetTitle(Titles_GetTextBody("Title_select_category_of_purchase"));
lblSelectTeam.SetTextSize(19);
lblSelectTeam.SetPos([40, 38]);
lblSelectTeam.SetSize('400 24');
frmBuyInfo = spawn(VGUIFrame);
frmBuyInfo = spawn(vguiFrame);
frmBuyInfo.SetPos('176 80');
frmBuyInfo.SetSize('200 100');
lblCategoryDescr = spawn(VGUILabel);
lblCategoryDescr = spawn(vguiLabel);
lblCategoryDescr.SetTitle("");
lblCategoryDescr.SetPos('185 90');
lblCategoryDescr.SetSize('375 250');

View file

@ -14,10 +14,10 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
static VGUIWindow winBuyMenuPage;
static VGUILabel lblBuyItemDescr;
static VGUILabel lblBuyItemTitle;
static VGUIPic imgBuyItemPic;
static vguiWindow winBuyMenuPage;
static vguiLabel lblBuyItemDescr;
static vguiLabel lblBuyItemTitle;
static vguiPic imgBuyItemPic;
/* these id's are for the button tags only */
typedef enum
@ -104,7 +104,7 @@ const buyItems_t g_buyItemList [] = {
string g_butItemDescr[29];
class CSBuyItemButton:VGUIButton
class CSBuyItemButton:vguiButton
{
void CSBuyItemButton(void);
@ -150,9 +150,9 @@ void
VGUI_BuyMenu_Page(int buyPage)
{
static int initialized;
static VGUIButton btnCancel;
static VGUIFrame frmBuyInfo;
static VGUILabel lblBuyScreenTitle;
static vguiButton btnCancel;
static vguiFrame frmBuyInfo;
static vguiLabel lblBuyScreenTitle;
static CSBuyItemButton btnBuyItem1;
static CSBuyItemButton btnBuyItem2;
@ -176,29 +176,29 @@ VGUI_BuyMenu_Page(int buyPage)
vector btnpos = [40,80];
initialized = TRUE;
winBuyMenuPage = spawn(VGUIWindow);
winBuyMenuPage = spawn(vguiWindow);
winBuyMenuPage.SetSize([640,480]);
winBuyMenuPage.SetStyleMask(VGUIWindowBorderless | VGUIWindowFullscreen);
winBuyMenuPage.SetStyleMask(vguiWindowBorderless | vguiWindowFullscreen);
lblBuyScreenTitle = spawn(VGUILabel);
lblBuyScreenTitle = spawn(vguiLabel);
lblBuyScreenTitle.SetTitle(Titles_GetTextBody("Title_select_category_of_purchase"));
lblBuyScreenTitle.SetTextSize(19);
lblBuyScreenTitle.SetPos([40, 38]);
lblBuyScreenTitle.SetSize('400 24');
frmBuyInfo = spawn(VGUIFrame);
frmBuyInfo = spawn(vguiFrame);
frmBuyInfo.SetPos('176 80');
frmBuyInfo.SetSize('424 312');
lblBuyItemDescr = spawn(VGUILabel);
lblBuyItemDescr = spawn(vguiLabel);
lblBuyItemDescr.SetTitle("");
lblBuyItemDescr.SetPos('185 190');
lblBuyItemDescr.SetSize('408 250');
imgBuyItemPic = spawn(VGUIPic);
imgBuyItemPic = spawn(vguiPic);
imgBuyItemPic.SetPos([260, 130]);
lblBuyItemTitle = spawn(VGUILabel);
lblBuyItemTitle = spawn(vguiLabel);
lblBuyItemTitle.SetPos([185, 96]);
lblBuyItemTitle.SetTextSize(19);
lblBuyItemTitle.SetSize([390, 24]);
@ -257,7 +257,7 @@ VGUI_BuyMenu_Page(int buyPage)
btnBuyItem9.SetKeyEquivalent("9");
btnBuyItem9.SetFunc(VGUI_BuyMenu_Pistols_Cancel);
btnCancel = spawn(VGUIButton);
btnCancel = spawn(vguiButton);
btnCancel.SetTitle(Titles_GetTextBody("Menu_Cancel"));
btnCancel.SetPos('40 368');
btnCancel.SetSize('124 24');

View file

@ -31,13 +31,13 @@ CSClassCT_Init(void)
g_classDescrAuto = textfile_to_string("classes/autoselect.txt");
}
static VGUIWindow winClassSelectionCT;
static VGUIPic imgClassPreview;
static VGUILabel lblClassTitle;
static VGUILabel lblClassDescription;
static VGUILabel lblClassCounter;
static vguiWindow winClassSelectionCT;
static vguiPic imgClassPreview;
static vguiLabel lblClassTitle;
static vguiLabel lblClassDescription;
static vguiLabel lblClassCounter;
class CSClassButtonCT:VGUIButton
class CSClassButtonCT:vguiButton
{
void CSClassButtonCT(void);
@ -115,8 +115,8 @@ void
VGUI_ChooseClassCT(void)
{
static int initialized;
static VGUILabel lblSelectClass;
static VGUIFrame frmClassInfo;
static vguiLabel lblSelectClass;
static vguiFrame frmClassInfo;
static CSClassButtonCT btnSeal;
static CSClassButtonCT btnGSG9;
static CSClassButtonCT btnSAS;
@ -129,33 +129,33 @@ VGUI_ChooseClassCT(void)
CSClassCT_Init();
winClassSelectionCT = spawn(VGUIWindow);
winClassSelectionCT = spawn(vguiWindow);
winClassSelectionCT.SetSize([640, 480]);
winClassSelectionCT.SetStyleMask(VGUIWindowBorderless | VGUIWindowFullscreen);
winClassSelectionCT.SetStyleMask(vguiWindowBorderless | vguiWindowFullscreen);
lblSelectClass = spawn(VGUILabel);
lblSelectClass = spawn(vguiLabel);
lblSelectClass.SetTitle(Titles_GetTextBody("Title_ct_model_selection"));
lblSelectClass.SetTextSize(19);
lblSelectClass.SetPos([40, 38]);
lblSelectClass.SetSize([400, 24]);
frmClassInfo = spawn(VGUIFrame);
frmClassInfo = spawn(vguiFrame);
frmClassInfo.SetPos([176, 80]);
frmClassInfo.SetSize([424, 312]);
imgClassPreview = spawn(VGUIPic);
imgClassPreview = spawn(vguiPic);
imgClassPreview.SetPos([190, 90]);
lblClassTitle = spawn(VGUILabel);
lblClassTitle = spawn(vguiLabel);
lblClassTitle.SetPos([338, 90]);
lblClassTitle.SetTextSize(19);
lblClassTitle.SetSize([320, 24]);
lblClassCounter = spawn(VGUILabel);
lblClassCounter = spawn(vguiLabel);
lblClassCounter.SetPos([338, 90 + 32]);
lblClassCounter.SetSize([320, 18]);
lblClassDescription = spawn(VGUILabel);
lblClassDescription = spawn(vguiLabel);
lblClassDescription.SetPos([338, 90 + 32 + 32]);
lblClassDescription.SetSize([250, 240]);

View file

@ -32,13 +32,13 @@ CSClassT_Init(void)
g_classDescrAuto = textfile_to_string("classes/autoselect.txt");
}
static VGUIWindow winClassSelection;
static VGUIPic imgClassPreview;
static VGUILabel lblClassTitle;
static VGUILabel lblClassDescription;
static VGUILabel lblClassCounter;
static vguiWindow winClassSelection;
static vguiPic imgClassPreview;
static vguiLabel lblClassTitle;
static vguiLabel lblClassDescription;
static vguiLabel lblClassCounter;
class CSClassButtonT:VGUIButton
class CSClassButtonT:vguiButton
{
void CSClassButtonT(void);
@ -116,8 +116,8 @@ void
VGUI_ChooseClassT(void)
{
static int initialized;
static VGUILabel lblSelectClass;
static VGUIFrame frmClassInfo;
static vguiLabel lblSelectClass;
static vguiFrame frmClassInfo;
static CSClassButtonT btnPhoenix;
static CSClassButtonT btnLeet;
static CSClassButtonT btnArctic;
@ -130,33 +130,33 @@ VGUI_ChooseClassT(void)
CSClassT_Init();
winClassSelection = spawn(VGUIWindow);
winClassSelection = spawn(vguiWindow);
winClassSelection.SetSize([640, 480]);
winClassSelection.SetStyleMask(VGUIWindowBorderless | VGUIWindowFullscreen);
winClassSelection.SetStyleMask(vguiWindowBorderless | vguiWindowFullscreen);
lblSelectClass = spawn(VGUILabel);
lblSelectClass = spawn(vguiLabel);
lblSelectClass.SetTitle(Titles_GetTextBody("Title_terrorist_model_selection"));
lblSelectClass.SetTextSize(19);
lblSelectClass.SetPos([40, 38]);
lblSelectClass.SetSize([400, 24]);
frmClassInfo = spawn(VGUIFrame);
frmClassInfo = spawn(vguiFrame);
frmClassInfo.SetPos([176, 80]);
frmClassInfo.SetSize([424, 312]);
imgClassPreview = spawn(VGUIPic);
imgClassPreview = spawn(vguiPic);
imgClassPreview.SetPos([190, 90]);
lblClassTitle = spawn(VGUILabel);
lblClassTitle = spawn(vguiLabel);
lblClassTitle.SetPos([338, 90]);
lblClassTitle.SetTextSize(19);
lblClassTitle.SetSize([320, 24]);
lblClassCounter = spawn(VGUILabel);
lblClassCounter = spawn(vguiLabel);
lblClassCounter.SetPos([338, 90 + 32]);
lblClassCounter.SetSize([320, 18]);
lblClassDescription = spawn(VGUILabel);
lblClassDescription = spawn(vguiLabel);
lblClassDescription.SetPos([338, 90 + 32 + 32]);
lblClassDescription.SetSize([250, 240]);

View file

@ -14,7 +14,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
static VGUIWindow winChooseTeam;
static vguiWindow winChooseTeam;
string
VGUI_ChooseTeam_MapInfo(void)
@ -63,14 +63,14 @@ void
VGUI_ChooseTeam(void)
{
static int initialized;
static VGUIButton btnJoinT;
static VGUIButton btnJoinCT;
static VGUIButton btnAutoAssign;
static VGUIButton btnGoSpectator;
static VGUIFrame frmMapInfo;
static VGUILabel lblSelectTeam;
static VGUILabel lblMapName;
static VGUILabel lblMapInfo;
static vguiButton btnJoinT;
static vguiButton btnJoinCT;
static vguiButton btnAutoAssign;
static vguiButton btnGoSpectator;
static vguiFrame frmMapInfo;
static vguiLabel lblSelectTeam;
static vguiLabel lblMapName;
static vguiLabel lblMapInfo;
static void VGUI_ChooseTeam_CT(void) {
localcmd("cmd joinTeam 2\n");
@ -97,53 +97,53 @@ VGUI_ChooseTeam(void)
vector btnpos = [40,80];
initialized = TRUE;
winChooseTeam = spawn(VGUIWindow);
winChooseTeam = spawn(vguiWindow);
winChooseTeam.SetSize('640 480');
winChooseTeam.SetStyleMask(VGUIWindowBorderless | VGUIWindowFullscreen);
winChooseTeam.SetStyleMask(vguiWindowBorderless | vguiWindowFullscreen);
lblSelectTeam = spawn(VGUILabel);
lblSelectTeam = spawn(vguiLabel);
lblSelectTeam.SetTitle("Select Your Team");
lblSelectTeam.SetTextSize(19);
lblSelectTeam.SetPos([40, 38]);
lblSelectTeam.SetSize('400 24');
frmMapInfo = spawn(VGUIFrame);
frmMapInfo = spawn(vguiFrame);
frmMapInfo.SetPos('176 80');
frmMapInfo.SetSize('424 312');
lblMapName = spawn(VGUILabel);
lblMapName = spawn(vguiLabel);
lblMapName.SetTitle(mapname);
lblMapName.SetTextSize(19);
lblMapName.SetPos('194 105');
lblMapName.SetSize('250 312');
lblMapInfo = spawn(VGUILabel);
lblMapInfo = spawn(vguiLabel);
lblMapInfo.SetTitle(VGUI_ChooseTeam_MapInfo());
lblMapInfo.SetPos('194 129');
lblMapInfo.SetSize('375 250');
btnJoinT = spawn(VGUIButton);
btnJoinT = spawn(vguiButton);
btnJoinT.SetTitle("Terrorist Forces");
btnJoinT.SetPos('40 80');
btnJoinT.SetSize('124 24');
btnJoinT.SetKeyEquivalent("1");
btnJoinT.SetFunc(VGUI_ChooseTeam_T);
btnJoinCT = spawn(VGUIButton);
btnJoinCT = spawn(vguiButton);
btnJoinCT.SetTitle("CT Forces");
btnJoinCT.SetPos('40 112');
btnJoinCT.SetSize('124 24');
btnJoinCT.SetKeyEquivalent("2");
btnJoinCT.SetFunc(VGUI_ChooseTeam_CT);
btnAutoAssign = spawn(VGUIButton);
btnAutoAssign = spawn(vguiButton);
btnAutoAssign.SetTitle("Auto Assign");
btnAutoAssign.SetPos('40 208');
btnAutoAssign.SetSize('124 24');
btnAutoAssign.SetKeyEquivalent("5");
btnAutoAssign.SetFunc(VGUI_ChooseTeam_Auto);
btnGoSpectator = spawn(VGUIButton);
btnGoSpectator = spawn(vguiButton);
btnGoSpectator.SetTitle("Spectate");
btnGoSpectator.SetPos('40 272');
btnGoSpectator.SetSize('124 24');

View file

@ -18,11 +18,11 @@ void
VGUI_ShowMOTD(void)
{
static int initialized;
static VGUIButton winMotdClose;
static VGUIWindow winMotd;
static VGUILabel winMotdHostname;
static VGUILabel winMotdBody;
static VGUIFrame frmWindow;
static vguiButton winMotdClose;
static vguiWindow winMotd;
static vguiLabel winMotdHostname;
static vguiLabel winMotdBody;
static vguiFrame frmWindow;
static void VGUI_ShowMOTD_Close(void)
{
@ -35,27 +35,27 @@ VGUI_ShowMOTD(void)
if (!initialized) {
initialized = TRUE;
winMotd = spawn(VGUIWindow);
winMotd = spawn(vguiWindow);
winMotd.SetTitle("Message Of The Day");
winMotd.SetStyleMask(VGUIWindowBorderless | VGUIWindowFullscreen);
winMotd.SetStyleMask(vguiWindowBorderless | vguiWindowFullscreen);
winMotd.SetSize('424 312');
frmWindow = spawn(VGUIFrame);
frmWindow = spawn(vguiFrame);
frmWindow.SetPos('0 0');
frmWindow.SetSize('424 312');
winMotdClose = spawn(VGUIButton);
winMotdClose = spawn(vguiButton);
winMotdClose.SetTitle("OK");
winMotdClose.SetPos([16, 266]);
winMotdClose.SetSize([160, 30]);
winMotdClose.SetFunc(VGUI_ShowMOTD_Close);
winMotdHostname = spawn(VGUILabel);
winMotdHostname = spawn(vguiLabel);
winMotdHostname.SetTitle(serverkey("hostname"));
winMotdHostname.SetTextSize(19);
winMotdHostname.SetPos([16, 20]);
winMotdBody = spawn(VGUILabel);
winMotdBody = spawn(vguiLabel);
winMotdBody.SetTitle(MOTD_GetTextBody());
winMotdBody.SetPos([16, 48]);
winMotdBody.SetSize([392, 210]);

View file

@ -18,7 +18,7 @@
#define SPEC_FG_COL [0.561,0.561,0.212]
class
CSSpectateHUD:VGUIWidget
CSSpectateHUD:vguiWidget
{
void CSSpectateHUD(void);
@ -39,7 +39,7 @@ CSSpectateHUD::Draw(void)
float flSep;
string strText;
int iMinutes, iSeconds;
NSClientSpectator spec = (NSClientSpectator)pSeat->m_ePlayer;
ncSpectator spec = (ncSpectator)pSeat->m_ePlayer;
float moneyValue = getplayerkeyfloat(player_localnum, "*money");
/* parts on top and bottom */

View file

@ -1,2 +1,3 @@
#pragma sourcefile client/progs.src
#pragma sourcefile server/progs.src
#pragma sourcefile rules/counterstrike.qc

View file

@ -2,4 +2,5 @@ QCC=fteqcc
all:
mkdir -pv ../../zpak001.pk3dir/progs/
$(QCC) deathmatch.qc
$(QCC) counterstrike.qc

View file

@ -32,6 +32,16 @@ typedef enum
STATE_OVER = 5i
} csGameState_t;
string g_csGameStateName[] =
{
"STATE_INACTIVE",
"STATE_COMMENCING",
"STATE_FREEZE",
"STATE_ACTIVE",
"STATE_END",
"STATE_OVER"
};
var csGameState_t g_csGameState;
var float g_cs_gametime;
var int g_csSwapTeamRoundCounter;
@ -117,6 +127,12 @@ GameState(void)
return (g_csGameState);
}
string
GameStateName(void)
{
return (g_csGameStateName[g_csGameState]);
}
float
GameTime(void)
{
@ -461,7 +477,7 @@ Round_TimerUpdate(void)
/* our continously running down timer */
g_cs_gametime = bound(0.0f, g_cs_gametime - frametime, g_cs_gametime);
//printf("%f\n", g_cs_gametime);
//printf("%f %S\n", GameTime(), GameStateName());
/* if the round is over or the game is done with... */
if (GameState() == STATE_COMMENCING || GameState() == STATE_END) {
@ -814,6 +830,7 @@ CodeCallback_FrameStart(void)
serverinfo.SetInteger("cs_roundsplayed", 0i);
return;
}
/* should only ever run when players are actually present. */
Round_TimerUpdate();
@ -912,17 +929,17 @@ CodeCallback_MaxItemPerSlot(int weaponSlot)
}
void
CodeCallback_PlayerSpawn(void)
CodeCallback_PlayerSpawn(entity playerEntity)
{
/* first course of action is to kick players into spectator cam */
CS_GoSpectator(self);
CS_GoSpectator(playerEntity);
}
void
CodeCallback_PlayerDisconnect(void)
CodeCallback_PlayerDisconnect(entity playerEntity)
{
/* if they leave, timeout, get kicked (or banned), we gotta know! */
CS_PlayerRemovedFromGame(self);
CS_PlayerRemovedFromGame(playerEntity);
}
void
@ -932,18 +949,18 @@ CodeCallback_PlayerDamage(entity inflictor, entity attacker)
}
void
CodeCallback_PlayerKilled(entity inflictor, entity attacker, string weapon)
CodeCallback_PlayerKilled(entity playerEntity, entity inflictor, entity attacker, string weapon)
{
combat.Obituary(self.netname, attacker.netname, weapon, "");
combat.Obituary(playerEntity.netname, attacker.netname, weapon, "");
/* death-counter */
self.deaths++;
playerEntity.deaths++;
/* update player scores */
if (ents.isPlayer(attacker)) {
if (self == attacker) {
if (playerEntity == attacker) {
attacker.frags--;
} else if (self.team == attacker.team) {
} else if (playerEntity.team == attacker.team) {
attacker.frags--;
Money_AddMoney(attacker, cvars.GetInteger("fcs_penalty_teamkill"));
} else {
@ -953,29 +970,29 @@ CodeCallback_PlayerKilled(entity inflictor, entity attacker, string weapon)
}
/* scoreboard death icon */
if (ents.isPlayer(self)) {
userinfo.SetString(self, "*icon1", "d_skull");
userinfo.SetString(self, "*icon1_r", "1");
userinfo.SetString(self, "*icon1_g", "0");
userinfo.SetString(self, "*icon1_b", "0");
if (ents.isPlayer(playerEntity)) {
userinfo.SetString(playerEntity, "*icon1", "d_skull");
userinfo.SetString(playerEntity, "*icon1_r", "1");
userinfo.SetString(playerEntity, "*icon1_g", "0");
userinfo.SetString(playerEntity, "*icon1_b", "0");
/* turn into a fake spec */
ents.Input(self, "Spectate", "", world);
ents.Input(playerEntity, "Spectate", "", world);
}
CS_PlayerRemovedFromGame(self);
CS_PlayerRemovedFromGame(playerEntity);
}
bool
CodeCallback_CallRequestTeam(int teamNum)
CodeCallback_CallRequestTeam(entity playerEntity, int teamNum)
{
/* can't switch teams while alive. */
if (ents.isAlive(self) == true) {
if (ents.isAlive(playerEntity) == true) {
return (false);
}
/* can't switch teams while we're a VIP */
if (IsVIP(self) == true) {
if (IsVIP(playerEntity) == true) {
return (false);
}
@ -986,13 +1003,13 @@ CodeCallback_CallRequestTeam(int teamNum)
switch (teamNum) {
case TEAM_T:
ents.Input(self, "SetTeam", "1", self);
ents.Input(playerEntity, "SetTeam", "1", playerEntity);
break;
case TEAM_CT:
ents.Input(self, "SetTeam", "2", self);
ents.Input(playerEntity, "SetTeam", "2", playerEntity);
break;
default:
CS_GoSpectator(self);
CS_GoSpectator(playerEntity);
return (true);
}
@ -1000,57 +1017,57 @@ CodeCallback_CallRequestTeam(int teamNum)
}
bool
CodeCallback_ClientCommand(string command)
CodeCallback_ClientCommand(entity playerEntity, string command)
{
float commandArgs = tokenize(command);
switch (argv(0)) {
/* class selection */
case "terror":
SetTClass(self, 1);
CodeCallback_CallRequestTeam(TEAM_T);
CS_RequestSpawn(self);
SetTClass(playerEntity, 1);
CodeCallback_CallRequestTeam(playerEntity, TEAM_T);
CS_RequestSpawn(playerEntity);
break;
case "leet":
SetTClass(self, 2);
CodeCallback_CallRequestTeam(TEAM_T);
CS_RequestSpawn(self);
SetTClass(playerEntity, 2);
CodeCallback_CallRequestTeam(playerEntity, TEAM_T);
CS_RequestSpawn(playerEntity);
break;
case "arctic":
SetTClass(self, 3);
CodeCallback_CallRequestTeam(TEAM_T);
CS_RequestSpawn(self);
SetTClass(playerEntity, 3);
CodeCallback_CallRequestTeam(playerEntity, TEAM_T);
CS_RequestSpawn(playerEntity);
break;
case "guerilla":
SetTClass(self, 4);
CodeCallback_CallRequestTeam(TEAM_T);
CS_RequestSpawn(self);
SetTClass(playerEntity, 4);
CodeCallback_CallRequestTeam(playerEntity, TEAM_T);
CS_RequestSpawn(playerEntity);
break;
case "urban":
SetCTClass(self, 1);
CodeCallback_CallRequestTeam(TEAM_CT);
CS_RequestSpawn(self);
SetCTClass(playerEntity, 1);
CodeCallback_CallRequestTeam(playerEntity, TEAM_CT);
CS_RequestSpawn(playerEntity);
break;
case "gsg9":
SetCTClass(self, 2);
CodeCallback_CallRequestTeam(TEAM_CT);
CS_RequestSpawn(self);
SetCTClass(playerEntity, 2);
CodeCallback_CallRequestTeam(playerEntity, TEAM_CT);
CS_RequestSpawn(playerEntity);
break;
case "sas":
SetCTClass(self, 3);
CodeCallback_CallRequestTeam(TEAM_CT);
CS_RequestSpawn(self);
SetCTClass(playerEntity, 3);
CodeCallback_CallRequestTeam(playerEntity, TEAM_CT);
CS_RequestSpawn(playerEntity);
break;
case "gign":
SetCTClass(self, 4);
CodeCallback_CallRequestTeam(TEAM_CT);
CS_RequestSpawn(self);
SetCTClass(playerEntity, 4);
CodeCallback_CallRequestTeam(playerEntity, TEAM_CT);
CS_RequestSpawn(playerEntity);
break;
case "buy":
Money_Purchase(self, argv(1));
Money_Purchase(playerEntity, argv(1));
break;
case "buyammo":
Money_PurchaseAmmoForSlot(self, stoi(argv(1)));
Money_PurchaseAmmoForSlot(playerEntity, stoi(argv(1)));
break;
default:
return (false);
@ -1060,13 +1077,13 @@ CodeCallback_ClientCommand(string command)
}
bool
CodeCallback_ImpulseCommand(float impulseNum)
CodeCallback_ImpulseCommand(entity playerEntity, float impulseNum)
{
switch (impulseNum) {
/* this is how Half-Life triggers the flashlight. `impulse 100`. */
case 100:
if (AllowFlashlight() == true) {
ents.Input(self, "UseItem", "item_suit", self);
ents.Input(playerEntity, "UseItem", "item_suit", playerEntity);
}
break;
default:

171
src/rules/deathmatch.qc Normal file
View file

@ -0,0 +1,171 @@
/*
* Copyright (c) 2024 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.
*/
#pragma PROGS_DAT "../../zpak001.pk3dir/progs/deathmatch.dat"
#include "../../../src/server/api.h"
bool
IsTeamplay(void)
{
return cvars.GetBool("mp_teamplay");
}
bool
AllowFlashlight(void)
{
return cvars.GetBool("mp_flashlight");
}
void
CodeCallback_StartGameType(void)
{
motd.LoadDefault();
if (IsTeamplay() == true) {
teams.SetUp(1, "Terrorist", [153, 204, 255], true);
teams.SetSpawnPoint(1, "info_player_deathmatch");
teams.SetUp(2, "Counter-Terrorist", [255, 63, 63], true);
teams.SetSpawnPoint(2, "info_player_deathmatch");
} else {
game.SetSpawnPoint("info_player_deathmatch");
}
}
void
HLDM_PlayerSpawn(entity playerEntity)
{
string playerModel;
ents.ChangeToClass(playerEntity, "player_csdm");
if (IsTeamplay() == true) {
float teamCount = 2;
float playerTeam = playerEntity.team;
string teamModel;
/* not part of a team? pick one of the ones we have */
/* TODO: this should sort us into the lowest team */
if (playerTeam == 0) {
playerTeam = 1 + floor(random(0, teamCount)); /* teams start at 1 after all */
ents.Input(playerEntity, "SetTeam", ftos(playerTeam), playerEntity);
}
teamModel = argv(playerTeam - 1);
playerModel = sprintf("models/player/%s/%s.mdl", teamModel, teamModel);
} else {
/* interpret the 'model' InfoKey */
playerModel = userinfo.GetString(playerEntity, "model");
if (playerModel != "") {
playerModel = sprintf("models/player/%s/%s.mdl", playerModel, playerModel);
}
}
/* fallback is always models/player.mdl for Half-Life */
if (playerModel == "" || exists.InVFS(playerModel) == false) {
playerModel = "models/player.mdl";
}
playerEntity.modelindex = getmodelindex(playerModel); /* keep OG size */
game.TeleportToSpawn(playerEntity);
}
void
CodeCallback_PlayerSpawn(entity playerEntity)
{
if (IsTeamplay() == false) {
HLDM_PlayerSpawn(playerEntity);
} else {
ents.ChangeToClass(playerEntity, "spectator");
game.TeleportToSpawn(playerEntity);
}
}
void
CodeCallback_PlayerDisconnect(entity playerEntity)
{
}
bool
CodeCallback_PlayerRequestRespawn(entity playerEntity)
{
CodeCallback_PlayerSpawn(playerEntity);
return (true);
}
void
CodeCallback_PlayerDamage(entity playerEntity, entity inflictor, entity attacker)
{
}
bool
CodeCallback_CallRequestTeam(entity playerEntity, int teamNum)
{
ents.Input(playerEntity, "SetTeam", itos(teamNum), playerEntity);
ents.Input(playerEntity, "Damage", "1000", playerEntity);
return (true);
}
void
CodeCallback_PlayerKilled(entity playerEntity, entity inflictor, entity attacker, string weapon)
{
combat.Obituary(playerEntity.netname, attacker.netname, weapon, "");
/* death-counter */
playerEntity.deaths++;
/* update score-counter */
if (ents.isPlayer(attacker)) {
if (playerEntity == attacker) {
attacker.frags--;
} else {
attacker.frags++;
}
}
}
bool
CodeCallback_ClientCommand(entity playerEntity, string command)
{
float commandArgs = tokenize(command);
switch (argv(0)) {
default:
return (false);
}
return (true);
}
bool
CodeCallback_ImpulseCommand(entity playerEntity, float impulseNum)
{
switch (impulseNum) {
case 100:
if (AllowFlashlight() == true) {
ents.Input(playerEntity, "UseItem", "item_suit", playerEntity);
}
break;
default:
return (false);
}
return (true);
}

View file

@ -97,7 +97,7 @@ string g_cstrike_armourymodels[19] = {
"models/w_smokegrenade.mdl"
};
class armoury_entity:NSRenderableEntity
class armoury_entity:ncRenderableEntity
{
int m_iCount;
int m_iLeft;

View file

@ -28,7 +28,7 @@ Once the bomb explodes inside this volume, it'll trigger its targets.
*/
class
func_bomb_target:NSBrushTrigger
func_bomb_target:ncBrushTrigger
{
void(void) func_bomb_target;

View file

@ -41,7 +41,7 @@ Choices for 'team' include:
*/
class
func_buyzone:NSBrushTrigger
func_buyzone:ncBrushTrigger
{
void(void) func_buyzone;

View file

@ -27,7 +27,7 @@ Used in the Escape mode (es_* maps).
*/
class
func_escapezone:NSBrushTrigger
func_escapezone:ncBrushTrigger
{
void func_escapezone(void);

View file

@ -29,7 +29,7 @@ zones will be placed in Counter-Terrorist player spawn nodes automatically.
*/
class
func_hostage_rescue:NSBrushTrigger
func_hostage_rescue:ncBrushTrigger
{
void(void) func_hostage_rescue;

View file

@ -26,7 +26,7 @@ VIP safety zone.
Used in the assassination mode (as_* maps).
*/
class func_vip_safetyzone:NSBrushTrigger
class func_vip_safetyzone:ncBrushTrigger
{
void func_vip_safetyzone(void);

View file

@ -79,15 +79,15 @@ enum
HOSA_DEADTABLE3
};
class CSHostage:NSTalkMonster
class CSHostage:ncTalkMonster
{
bool m_bUsedOnce;
void CSHostage(void);
virtual void OnPlayerUse(void);
virtual void Pain(entity, entity, int, vector, int);
virtual void Death(entity, entity, int, vector, int);
virtual void Pain(entity, entity, int, vector, vector, int);
virtual void Death(entity, entity, int, vector, vector, int);
};
@ -123,19 +123,19 @@ CSHostage::OnPlayerUse(void)
m_bUsedOnce = true;
}
NSTalkMonster::OnPlayerUse();
ncTalkMonster::OnPlayerUse();
}
void
CSHostage::Pain(entity inflictor, entity attacker, int damageDealt, vector dir, int location)
CSHostage::Pain(entity inflictor, entity attacker, int damageDealt, vector dir, vector absImpactPos, int hitBody)
{
super::Pain(inflictor, attacker, damageDealt, dir, location);
super::Pain(inflictor, attacker, damageDealt, dir, absImpactPos, hitBody);
if (IsAlive() == false) {
return;
}
switch (location) {
switch (hitBody) {
case BODY_HEAD:
case BODY_DEFAULT:
case BODY_CHEST:
@ -165,12 +165,12 @@ CSHostage::Pain(entity inflictor, entity attacker, int damageDealt, vector dir,
}
void
CSHostage::Death(entity inflictor, entity attacker, int damageDealt, vector dir, int location)
CSHostage::Death(entity inflictor, entity attacker, int damageDealt, vector dir, vector absImpactPos, int hitBody)
{
WarnAllies();
if (IsAlive() == true) {
switch (location) {
switch (hitBody) {
case BODY_HEAD:
SetFrame(HOSA_DIE_HEADSHOT);
break;
@ -191,6 +191,6 @@ CSHostage::Death(entity inflictor, entity attacker, int damageDealt, vector dir,
SetHealth(0);
/* now mark our state as 'dead' */
super::Death(inflictor, attacker, damageDealt, dir, location);
super::Death(inflictor, attacker, damageDealt, dir, absImpactPos, hitBody);
SetSolid(SOLID_NOT);
}

View file

@ -26,7 +26,7 @@ See func_buyzone for more information.
*/
class
info_buyzone:NSPointTrigger
info_buyzone:ncPointTrigger
{
void info_buyzone(void);

View file

@ -29,7 +29,7 @@ If neither a info_hostage_rescue or a func_hostage_rescue is placed,
zones will be placed in Counter-Terrorist player spawn nodes automatically.
*/
class info_hostage_rescue:NSPointTrigger
class info_hostage_rescue:ncPointTrigger
{
void(void) info_hostage_rescue;
@ -62,7 +62,7 @@ info_hostage_rescue::Touch(entity eToucher)
return;
}
NSTalkMonster hosty = (NSTalkMonster)other;
ncTalkMonster hosty = (ncTalkMonster)other;
if (hosty.GetSolid() == SOLID_NOT) {
return;

View file

@ -41,7 +41,7 @@ typedef enum
} imp_buyrules_t;
class
info_map_parameters:NSEntity
info_map_parameters:ncEntity
{
float m_flBombRadius;
imp_buyrules_t m_buyRules;

View file

@ -1,6 +1,7 @@
#pragma target fte_5768
//#pragma flag enable assumeint
#pragma progs_dat "../../progs.dat"
#pragma forcecrc 54730
#define QWSSQC
#define SERVER

View file

@ -14,20 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
void
Game_InitRules(void)
{
if (cvar("sv_playerslots") == 1 || cvar("coop") == 1) {
g_grMode = NSGameRules::InitFromProgs("progs/singleplayer.dat");
} else {
if (cvar("fcs_deathmatch") == 1) {
g_grMode = NSGameRules::InitFromProgs("progs/deathmatch.dat");
} else {
g_grMode = NSGameRules::InitFromProgs("progs/counterstrike.dat");
}
}
}
void
Game_Worldspawn(void)
{
@ -42,6 +28,4 @@ Game_Worldspawn(void)
Sound_Precache("player.headshotarmor");
Sound_Precache("Player.FlashLightOff");
Sound_Precache("Player.FlashLightOn");
FX_Corpse_Init();
}

View file

@ -15,12 +15,13 @@
*/
class
CSProjectile:NSProjectile
CSProjectile:ncProjectile
{
public:
void CSProjectile(void);
#ifdef SERVER
virtual void HasExploded(void);
nonvirtual void SetRangeModifier(float);
nonvirtual void SetPenetrationMaxThickness(float);
nonvirtual void SetPenetrationPower(int);

View file

@ -21,6 +21,21 @@ CSProjectile::CSProjectile(void)
}
#ifdef SERVER
void
CSProjectile::HasExploded(void)
{
float flashTime = GetSpawnFloat("flashTime");
float smokeTime = GetSpawnFloat("smokeTime");
if (flashTime > 0.0f) {
FX_Flashbang(GetOrigin());
}
if (smokeTime > 0.0f) {
FX_Smokenade(GetOrigin());
}
}
void
CSProjectile::SetRangeModifier(float rangeModifier)
{
@ -143,7 +158,7 @@ CSProjectile::_FireSingle(vector vecPos, vector vecAngles, float flDamage, float
if (trace_ent.takedamage != DAMAGE_NO && trace_ent.iBleeds) {
Sound_Play(trace_ent, CHAN_BODY, "damage_bullet.hit");
NSClientPlayer pl = (NSClientPlayer)trace_ent;
ncPlayer pl = (ncPlayer)trace_ent;
/* modify the damage based on the location */
switch (trace_surface_id) {
case BODY_HEAD:
@ -183,7 +198,7 @@ CSProjectile::_FireSingle(vector vecPos, vector vecAngles, float flDamage, float
if (trace_ent != m_eMultiTarget) {
trace_endpos = endPos;
_ApplyDamage();
m_eMultiTarget = (NSSurfacePropEntity)trace_ent;
m_eMultiTarget = (ncSurfacePropEntity)trace_ent;
m_iMultiValue = flDamage;
} else {
m_iMultiValue += flDamage;
@ -214,7 +229,7 @@ CSProjectile::_FireSingle(vector vecPos, vector vecAngles, float flDamage, float
}
CSProjectile
CSProjectile_SpawnDef(string entityDef, NSEntity theOwner, float rangeMod, int power, vector spread)
CSProjectile_SpawnDef(string entityDef, ncEntity theOwner, float rangeMod, int power, vector spread)
{
entity oldself = self;

View file

@ -29,21 +29,11 @@ public:
virtual void UpdateGUI(void);
#endif
virtual bool CanFire(void);
virtual void Draw(void);
virtual void SecondaryAttack(void);
virtual void Release(void);
virtual void FiredWeaponAttack(string);
virtual void SwitchedToWeapon(void);
#ifdef CLIENT
private:
int m_iHudSlot;
int m_iHudSlotPos;
string m_ammoIcon;
string m_crossHair;
NSWeapon m_nextWeapon;
#endif
};
void
@ -52,44 +42,36 @@ CSWeapon::CSWeapon(void)
}
bool
CSWeapon::CanFire(void)
{
bool returnValue = super::CanFire();
if (returnValue == true) {
if (!owner.gflags & GF_BOMBZONE && GetSpawnBool("onlyInBombZone")) {
returnValue = false;
}
}
return (returnValue);
}
void
CSWeapon::SwitchedToWeapon(void)
{
Cstrike_ShotReset((CSPlayer)owner);
}
void
CSWeapon::SecondaryAttack(void)
{
if (GetDefBool("altSilences") == true) {
if (CanFire() == false) {
return;
}
float silAnimation = 0;
float silTime;
m_iMode = 1 - m_iMode;
if (m_iMode)
silAnimation = GetDefAct("actAddSil");
else
silAnimation = GetDefAct("actDetachSil");
SetWeaponFrame(silAnimation);
silTime = frameduration(m_viewModel, silAnimation);
SetAttackNext(silTime);
SetIdleNext(silTime + 1.0f);
return;
}
super::SecondaryAttack();
}
void
CSWeapon::FiredWeaponAttack(string defName)
{
CSPlayer ourOwner = (CSPlayer)owner;
if (GetSubDefBool(defName, "csWeaponMode") == false) {
super::FiredWeaponAttack(defName);
return;
}
int numProjectiles = GetSubDefInt(defName, "numProjectiles");
string traceInfo = GetSubDefString(defName, "def_onFire");
float flAccuracyDivisor = GetSubDefFloat(defName,"accuracyDivisor");
@ -213,4 +195,4 @@ CSWeapon::UpdateGUI(void)
HUD_DrawAmmo3();
}
}
#endif
#endif

View file

@ -46,10 +46,10 @@ FX_Flashbang(vector org)
/* send the blinding env_fade event */
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_FADE);
WriteFloat(MSG_MULTICAST, 1.0f);
WriteFloat(MSG_MULTICAST, 1.0f);
WriteFloat(MSG_MULTICAST, 1.0f);
WriteFloat(MSG_MULTICAST, 1.0f);
WriteByte(MSG_MULTICAST, 255);
WriteByte(MSG_MULTICAST, 255);
WriteByte(MSG_MULTICAST, 255);
WriteByte(MSG_MULTICAST, 255);
WriteFloat(MSG_MULTICAST, blindness);
WriteFloat(MSG_MULTICAST, fade);
WriteByte(MSG_MULTICAST, EVF_FADEDROM);
@ -57,4 +57,4 @@ FX_Flashbang(vector org)
multicast([0,0,0], MULTICAST_ONE_R);
}
}
#endif
#endif

View file

@ -52,7 +52,7 @@ FX_Impact_Init(void)
void
Wallpuff_Travel(void)
{
NSEntity sprite = (NSEntity)self;
ncEntity sprite = (ncEntity)self;
vector newpos;
sprite.origin = sprite.origin_net;

View file

@ -7,7 +7,6 @@
../../../cstrike/src/shared/animations.qc
../../../cstrike/src/shared/item_c4bomb.h
../../../valve/src/shared/fx_blood.qc
../../../valve/src/shared/fx_corpse.qc
../../../cstrike/src/shared/fx_flashbang.qc
../../../cstrike/src/shared/fx_smokenade.qc
../../../cstrike/src/shared/item_c4bomb.qc

View file

@ -14,7 +14,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
class CSBombEntity:NSRenderableEntity
class CSBombEntity:ncRenderableEntity
{
public:
void CSBombEntity(void);
@ -135,7 +135,7 @@ CSBombEntity::Logic(void)
/* if our time has passed, explode */
if (m_flExplodeTime < time) {
float bestDist = 9999.0f;
NSEntity bestTarget = __NULL__;
ncEntity bestTarget = __NULL__;
g_grMode.Input(m_eUser, "BombExploded", "");
combat.RadiusDamage(origin, -g_cstrike_bombradius, 0i, 500i, real_owner, "");
@ -149,7 +149,7 @@ CSBombEntity::Logic(void)
if (dist < bestDist) {
bestDist = dist;
bestTarget = (NSEntity)e;
bestTarget = (ncEntity)e;
}
}

View file

@ -15,13 +15,13 @@
*/
/** @brief Get entity by class name and index **/
NSEntity
ncEntity
GetEntityByNameAndIndex(string name, int index)
{
int curIndex = 0;
for (entity a = world; (a = find(a, ::classname, name));) {
if (curIndex == index) {
return (NSEntity)a;
return (ncEntity)a;
}
++curIndex;
}
@ -36,21 +36,21 @@ GetEntityByNameAndIndex(string name, int index)
* When there are for example 2 bombsites (g_cs_bombzones == 2) then valid
* indexes would be 0 and 1.
* */
NSEntity
ncEntity
GetBombsiteByIndex(int index)
{
return GetEntityByNameAndIndex("func_bomb_target", index);
}
/** @brief Get Escape Zone entity by index **/
NSEntity
ncEntity
GetEscapeZoneByIndex(int index)
{
return GetEntityByNameAndIndex("func_escapezone", index);
}
/** @brief Get VIP Safety Zone entity by index **/
NSEntity
ncEntity
GetVIPSafetyZoneByIndex(int index)
{
return GetEntityByNameAndIndex("func_vip_safetyzone", index);
@ -77,10 +77,11 @@ CSPlayer:HLPlayer
PREDICTED_INT(cs_hor_rec_sign)
PREDICTED_FLOAT(cs_rec_reverse_chance)
virtual void(float) Physics_Fall;
virtual void(void) Physics_Jump;
virtual void Physics_Fall(float);
virtual void Physics_Jump(void);
virtual void Physics_InputPreMove(void);
virtual void(void) Physics_InputPostMove;
virtual void Physics_InputPostMove(void);
#ifdef CLIENT
int playertype;
@ -171,9 +172,23 @@ CSPlayer::CSPlayer(void)
#endif
}
float punchangle_recovery(float punchangle) {
void
CSPlayer::Physics_InputPreMove(void)
{
super::Physics_InputPreMove();
gflags &= ~GF_BUYZONE;
gflags &= ~GF_RESCUEZONE;
gflags &= ~GF_BOMBZONE;
}
float
punchangle_recovery(float punchangle)
{
return 0.05 * (-0.2 * pow(1.2, fabs(punchangle)) + 4);
}
void
CSPlayer::Physics_InputPostMove(void)
{
@ -181,14 +196,15 @@ CSPlayer::Physics_InputPostMove(void)
float punch;
/* timers, these are predicted and shared across client and server */
w_attack_next = max(0, w_attack_next - input_timelength);
w_reload_next = max(0, w_reload_next - input_timelength);
w_idle_next = max(0, w_idle_next - input_timelength);
weapontime += input_timelength;
punch = max(0, 1.0f - (input_timelength * 4));
if (punchangle[0] < 0) {
punchangle[0] += punchangle_recovery(punchangle[0]);
}
punchangle[1] *= .98;
punchangle[2] *= .99;
punchangle[1] *= punch;
punchangle[2] *= punch;
/* player animation code */
UpdatePlayerAnimation(input_timelength);
@ -217,7 +233,7 @@ CSPlayer::ReceiveEntity
void
CSPlayer::ReceiveEntity(float flIsNew, float flChanged)
{
NSClientPlayer::ReceiveEntity(flIsNew, flChanged);
ncPlayer::ReceiveEntity(flIsNew, flChanged);
/* animation */
READENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
@ -326,8 +342,8 @@ CSPlayer::Bot_RunToConfront(void)
void
CSPlayer::Bot_RunToBomb(void)
{
NSEntity e = __NULL__;
e = (NSEntity)find(e, ::model, "models/w_c4.mdl");
ncEntity e = __NULL__;
e = (ncEntity)find(e, ::model, "models/w_c4.mdl");
if (e) {
RouteToPosition(e.WorldSpaceCenter());
@ -339,7 +355,7 @@ CSPlayer::Bot_RunToBomb(void)
void
CSPlayer::Bot_RunToBombsite(int bombsiteIndex)
{
NSEntity e = GetBombsiteByIndex(bombsiteIndex);
ncEntity e = GetBombsiteByIndex(bombsiteIndex);
RouteToPosition(e.WorldSpaceCenter());
ChatSayTeam(strcat("Going to run to Bomb Site ", itos(bombsiteIndex), "!"));
}
@ -355,7 +371,7 @@ CSPlayer::Bot_RunToRandomBombsite(void)
void
CSPlayer::Bot_RunToEscapeZone(int index)
{
NSEntity e = GetEscapeZoneByIndex(index);
ncEntity e = GetEscapeZoneByIndex(index);
RouteToPosition(e.WorldSpaceCenter());
ChatSayTeam(strcat("Going to run to Escape Zone ", itos(index), "!"));
}
@ -371,7 +387,7 @@ CSPlayer::Bot_RunToRandomEscapeZone(void)
void
CSPlayer::Bot_RunToVIPSafetyZone(int index)
{
NSEntity e = GetVIPSafetyZoneByIndex(index);
ncEntity e = GetVIPSafetyZoneByIndex(index);
RouteToPosition(e.WorldSpaceCenter());
ChatSayTeam(strcat("Going to run to VIP Safety Zone ", itos(index), "!"));
}
@ -386,9 +402,9 @@ CSPlayer::Bot_RunToRandomVIPSafetyZone(void)
void
CSPlayer::Bot_RunToHostages(void)
{
NSEntity e = __NULL__;
ncEntity e = __NULL__;
e = (NSEntity)find(e, ::classname, "hostage_entity");
e = (ncEntity)find(e, ::classname, "hostage_entity");
RouteToPosition(e.origin);
ChatSayTeam("Going to run to the hostages!");
@ -514,7 +530,7 @@ CSPlayer::Bot_CreateObjective(void)
}
else {
/* T-bot: check if the bomb has been dropped */
NSEntity e = (NSEntity)find(world, ::model, "models/w_backpack.mdl");
ncEntity e = (ncEntity)find(world, ::model, "models/w_backpack.mdl");
if (e != __NULL__) {
/* The bomb backpack has been dropped */
@ -741,7 +757,7 @@ CSPlayer::SendEntity(entity ePEnt, float flChanged)
flChanged = OptimiseChangedFlags(ePEnt, flChanged);
NSClientPlayer::SendEntity(ePEnt, flChanged);
ncPlayer::SendEntity(ePEnt, flChanged);
SENDENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
SENDENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
@ -776,7 +792,7 @@ CSPlayer::Physics_Fall(float impactspeed)
float impactDamage = (impactspeed - 580) * (100 / (1024 - 580)) * 0.75f;
/* this is kinda ugly, but worth the price */
NSDict damageDecl = spawn(NSDict);
ncDict damageDecl = spawn(ncDict);
damageDecl.AddKey("damage", ftos((int)impactDamage));
Damage(this, this, damageDecl, 1.0, g_vec_null, origin);
remove(damageDecl);

View file

@ -185,3 +185,18 @@ set sk_plr_awp_dmg3 115
set sk_plr_m249_dmg1 35
set sk_plr_m249_dmg2 35
set sk_plr_m249_dmg3 35
// hegrenade: splash damage
set sk_plr_hegrenade_dmg1 100
set sk_plr_hegrenade_dmg2 100
set sk_plr_hegrenade_dmg3 100
// hegrenade: splash radius
set sk_plr_hegrenade_radius1 100
set sk_plr_hegrenade_radius2 100
set sk_plr_hegrenade_radius3 100
// hegrenade: direct damage
set sk_plr_hegrenade_directdmg1 15
set sk_plr_hegrenade_directdmg2 15
set sk_plr_hegrenade_directdmg3 15

View file

@ -1,2 +1 @@
exec "skill.cfg"
exec "skill_cstrike.cfg"
exec "skill_cstrike.cfg"

View file

@ -1,22 +1,3 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-21 15:30+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "VGUI_TITLE_MOTD"
msgstr "Nachricht des Tages"

View file

@ -15,6 +15,7 @@ entityDef ammo_types {
"ammo_hegrenade" "11"
"ammo_smokegrenade" "12"
"ammo_flashbang" "13"
"ammo_c4" "14"
}
entityDef ammo_names {
@ -23,15 +24,16 @@ entityDef ammo_names {
"ammo_357sig" ".357 SIG"
"ammo_45acp" ".45 ACP"
"ammo_50ae" ".50 Action Express"
"ammo_556nato" "5.56×45mm NATO"
"ammo_556natobox" "5.56×45mm NATO BOX"
"ammo_57mm" "FN 5.7×28mm"
"ammo_762nato" "7.62×51mm NATO"
"ammo_9mm" "9×19mm Parabellum"
"ammo_556nato" "5.56x45mm NATO"
"ammo_556natobox" "5.56x45mm NATO BOX"
"ammo_57mm" "FN 5.7x28mm"
"ammo_762nato" "7.62x51mm NATO"
"ammo_9mm" "9x19mm Parabellum"
"ammo_buckshot" "Buckshot"
"ammo_hegrenade" "HE Grenade"
"ammo_smokegrenade" "Smoke Grenade"
"ammo_flashbang" "Flashbang"
"ammo_c4" "C4"
}
entityDef ammo_max {
@ -49,12 +51,12 @@ entityDef ammo_max {
"ammo_hegrenade" "1"
"ammo_smokegrenade" "1"
"ammo_flashbang" "2"
"ammo_c4" "1"
}
// these don't exist as pickups in the game, but
// might be helpful nonetheless for level designers
#include "ammo/base.def"
#include "ammo/556natobox.def"
#include "ammo/338magnum.def"

View file

@ -1,16 +1,16 @@
entityDef hostage_entity
{
"spawnclass" "CSHostage"
"model" "models/hostage.mdl"
"spawnclass" "CSHostage"
"model" "models/hostage.mdl"
"netname" "Hostage"
"health" "skill:hostage_health"
"mins" "-16 -16 0"
"maxs" "16 16 72"
"eye_height" "64"
"team" "0"
"mins" "-16 -16 0"
"maxs" "16 16 72"
"eye_height" "64"
"team" "0"
"propdata" "actor_human"
"follow_on_use" "1"
"speed_walk" "64"
"speed_run" "364"
"speed_run" "364"
}

View file

@ -1,6 +1,6 @@
entityDef item_defuse
{
"spawnclass" "NSItem"
"spawnclass" "ncItem"
"model" "models/w_thighpack.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"

View file

@ -1,7 +1,7 @@
// actually armor
entityDef item_kevlar
{
"spawnclass" "NSItem"
"spawnclass" "ncItem"
"model" "models/w_kevlar.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"

View file

@ -1,7 +1,7 @@
// other equipment
entityDef item_kevlar_helmet
{
"spawnclass" "NSItem"
"spawnclass" "ncItem"
"model" "models/w_kevlar.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"

View file

@ -1,6 +1,6 @@
entityDef item_nightvision
{
"spawnclass" "NSItem"
"spawnclass" "ncItem"
"model" "models/w_backpack.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"

View file

@ -1,7 +1,7 @@
// used in the training mission, HUD etc.
entityDef item_suit
{
"spawnclass" "NSItem"
"spawnclass" "ncItem"
"model" "models/w_kevlar.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"

View file

@ -1,6 +1,21 @@
entityDef player
{
"spawnclass" "CSPlayer"
"snd_stepladderLeft" "step_ladder.left"
"snd_stepladderRight" "step_ladder.right"
"snd_fall" "Player.FallDamage"
"snd_landHard" "Player.LightFall"
"snd_death" "Player.Death"
"snd_airGaspLight" "Player.GaspLight"
"snd_pain" "Player.Pain"
"snd_airGaspHeavy" "Player.GaspHeavy"
"snd_waterExit" "Player.WaterExit"
"snd_waterEnter" "Player.WaterEnter"
"snd_useDeny" "Player.DenyWeaponSelection"
"snd_useSuccess" "Player.WeaponSelected"
"snd_waterWade" "Player.Wade"
"snd_waterSwim" "Player.Swim"
}
entityDef player_mp
@ -79,3 +94,13 @@ entityDef player_vip
"team" "2"
"weapon" "weapon_knife,weapon_usp"
}
entityDef player_csdm
{
"inherit" "player_mp"
"ammo_45acp" "24"
"current_weapon" "1"
"item" "item_suit"
"model" "models/player/vip/vip.mdl"
"weapon" "weapon_knife,weapon_usp"
}

View file

@ -8,7 +8,7 @@ entityDef projectile_bullet_base
entityDef projectile_bullet_shotgun
{
"spawnclass" "NSProjectile"
"spawnclass" "ncProjectile"
"is_bullet" "1"
"decal_impact" "Impact.BigShot"
"detonate_on_world" "1"

View file

@ -3,8 +3,8 @@ entityDef info_player_start
"editor_mins" "-16 -16 -36"
"editor_maxs" "16 16 36"
"editor_description" "Singleplayer Spawn Point"
"editor_color" "1 0 0"
"spawnclass" "NSSpawnPoint"
"editor_color" "1 0 0"
"spawnclass" "ncSpawnPoint"
}
entityDef info_player_deathmatch
@ -12,8 +12,8 @@ entityDef info_player_deathmatch
"editor_mins" "-16 -16 -36"
"editor_maxs" "16 16 36"
"editor_description" "Deathmatch Spawn Point"
"editor_color" "1 0 0"
"spawnclass" "NSSpawnPoint"
"editor_color" "1 0 0"
"spawnclass" "ncSpawnPoint"
}
entityDef info_player_coop
@ -21,6 +21,6 @@ entityDef info_player_coop
"editor_mins" "-16 -16 -36"
"editor_maxs" "16 16 36"
"editor_description" "Cooperative Spawn Point"
"editor_color" "1 0 0"
"spawnclass" "NSSpawnPoint"
"editor_color" "1 0 0"
"spawnclass" "ncSpawnPoint"
}

View file

@ -1,3 +1,4 @@
#include "weapons/csbase.def"
#include "weapons/ak47.def"
#include "weapons/aug.def"
#include "weapons/awp.def"
@ -25,50 +26,3 @@
#include "weapons/ump45.def"
#include "weapons/usp.def"
#include "weapons/xm1014.def"
entityDef CSBaseMelee
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"snd_acquire" "Player.PickupWeapon"
}
entityDef CSBasePistol
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"semiAuto" "1"
"snd_acquire" "Player.PickupWeapon"
"snd_empty" "Default.ClipEmpty_Pistol"
}
entityDef CSBaseRifle
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"snd_acquire" "Player.PickupWeapon"
"snd_empty" "Default.ClipEmpty_Rifle"
}
entityDef CSBaseShotgun
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"snd_acquire" "Player.PickupWeapon"
}

View file

@ -11,16 +11,19 @@ entityDef weapon_c4
"model_view" "models/v_c4.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"ammoRequired" "1"
"def_plant" "item_c4"
"def_fireInfo" "fireInfo_c4Plant"
"inv_name" "C4 Bomb Weapon"
"clipSize" "1"
"ammoType" "ammo_c4"
"inv_ammo_c4" "1"
"trigger_delay" "3" // takes three seconds to charge
"act_fire" "2"
"act_fireFailed" "0"
"act_draw" "1"
"act_idle" "0"
"actDelay" "3"
"act_delay" "3"
"snd_fire" "C4.PlantSound"
@ -30,4 +33,23 @@ entityDef weapon_c4
"hudSlotPos" "0"
"weight" "0"
"team" "1" // Terrorists only!
"onlyInBombZone" "1"
"removeOnEmpty" "1"
}
entityDef fireInfo_c4Plant
{
"def_onFire" "projectile_c4bomb"
"testDistance" "-64"
"chargeTime" "3"
}
entityDef projectile_c4bomb
{
"spawnclass" "ncAttack"
"def_plant" "item_c4"
"plant" "1"
"plantOnGround" "1"
"plantDistance" "64"
"plantOffset" "8"
}

View file

@ -0,0 +1,52 @@
entityDef CSBaseMelee
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"snd_acquire" "Player.PickupWeapon"
}
entityDef CSBasePistol
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"semiAuto" "1"
"snd_acquire" "Player.PickupWeapon"
"snd_empty" "Default.ClipEmpty_Pistol"
"csWeaponMode" "1"
"model_flash" "sprites/muzzleflash1.spr"
}
entityDef CSBaseRifle
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"snd_acquire" "Player.PickupWeapon"
"snd_empty" "Default.ClipEmpty_Rifle"
"csWeaponMode" "1"
"model_flash" "sprites/muzzleflash3.spr"
}
entityDef CSBaseShotgun
{
"spawnclass" "CSWeapon"
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_rotatable" "1"
"snd_acquire" "Player.PickupWeapon"
"csWeaponMode" "1"
"model_flash" "sprites/muzzleflash4.spr"
}

View file

@ -12,17 +12,22 @@ entityDef weapon_flashbang
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"def_onFire" "projectile_flashgrenade"
//"def_onFire" "projectile_flashgrenade"
"def_onRelease" "projectile_flashgrenade"
"inv_name" "Flashbang"
"ammoType" "ammo_flashbang"
"ammoRequired" "1"
"inv_ammo_flashbang" "1"
"silent_fire" "1"
"primed_fuse" "4"
"act_idle" "0"
"act_draw" "3"
"actPull" "1"
"actThrow" "2"
"act_idle" "0"
"act_draw" "3"
"act_delay" "1"
"act_fire" "2"
"chargeTime" "2"
"removeOnEmpty" "1"
"drawAfterRelease" "1"
"hudSlot" "3"
"hudSlotPos" "1"
@ -35,8 +40,10 @@ entityDef projectile_flashgrenade
"frame" "1"
"fuse" "4"
"detonate_on_fuse" "1"
"thrown" "1"
"bounce" "1"
"angular_velocity" "-350 0 0"
"velocity" "300 0 40"
"snd_explode" "Flashbang.Explode"
"snd_bounce" "Flashbang.Bounce"

View file

@ -17,7 +17,7 @@ entityDef weapon_glock18
"act_fireLast" "6"
"act_holster" "9"
"act_reload" "7,12"
"act_draw" "9,11"
"act_draw" "8,11"
"act_idle" "0,1,2"
"snd_fire" "Weapon_Glock.Single"

View file

@ -10,35 +10,37 @@ entityDef weapon_hegrenade
"inv_name" "HE Grenade"
"inv_ammo_hegrenade" "5"
"def_onFire" "projectile_handgrenade"
"def_explode_inhand" "env_handgrenade_explodeinhand"
"def_damage_inhand" "damage_handgrenadeSplash"
"def_onRelease" "projectile_handgrenade"
"ammoType" "ammo_hegrenade"
"ammoRequired" "1"
"silent_fire" "1"
"primed_fuse" "4"
"act_idle" "0"
"act_draw" "3"
"actPull" "1"
"actThrow" "2"
"act_delay" "1"
"act_release" "2"
// HLWeapon specific
"hudSlot" "3"
"hudSlotPos" "0"
"chargeTime" "2"
"removeOnEmpty" "1"
"drawAfterRelease" "1"
}
entityDef projectile_handgrenade
{
"spawnclass" "NSProjectile"
"model" "models/w_grenade.mdl"
"spawnclass" "ncProjectile"
"model" "models/w_hegrenade.mdl"
"frame" "1"
"fuse" "4"
"detonate_on_fuse" "1"
"thrown" "1"
"bounce" "1"
"angular_velocity" "-350 0 0"
"model_detonate" "fx_explosion.main"
"snd_explode" "fx.explosion"
"snd_bounce" "weapon_handgrenade.bounce"
"snd_bounce" "weapon_hegrenade.bounce"
"decal_detonate" "ExplosionScorch"
"def_damage" "damage_handgrenadeDirect"
@ -47,17 +49,12 @@ entityDef projectile_handgrenade
entityDef damage_handgrenadeDirect
{
"damage" "1"
"damage" "skill:plr_hegrenade_directdmg"
}
entityDef damage_handgrenadeSplash
{
"damage" "skill:plr_hand_grenade"
"radius" "250"
}
entityDef env_handgrenade_explodeinhand
{
"spawnclass" "idAnimatedEntity"
"model" "grenadeExplosion.prt"
"damage" "skill:plr_hegrenade_dmg"
"radius" "skill:plr_hegrenade_radius"
"push" "7500"
}

View file

@ -1,5 +1,6 @@
entityDef weapon_knife
{
"spawnclass" "CSWeapon"
"inherit" "CSBaseMelee"
"editor_usage" "Knife Weapon"
@ -11,7 +12,6 @@ entityDef weapon_knife
"testDistance" "-48"
"inv_name" "Knife Weapon"
"ammoRequired" "0"
"clipSize" "0"
"silent_fire" "1"
"failRate" "0.7"
@ -30,9 +30,20 @@ entityDef weapon_knife
entityDef projectile_knife
{
"spawnclass" "NSProjectile"
"spawnclass" "ncProjectile"
"damage" "skill:plr_knife_dmg"
"is_bullet" "1"
"decal_impact" "Impact.Shot"
"detonate_on_world" "1"
"range" "skill:plr_knife_altdmg"
}
entityDef projectile_altKnife
{
"spawnclass" "ncProjectile"
"damage" "skill:plr_knife"
"is_bullet" "1"
"decal_impact" "Impact.Shot"
"detonate_on_world" "1"
"range" "skill:plr_knife_altrange"
}

View file

@ -12,17 +12,19 @@ entityDef weapon_smokegrenade
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"def_onFire" "projectile_smokegrenade"
"def_onFire" "projectile_smokegrenade"
"def_onRelease" "projectile_smokegrenade"
"inv_name" "smokegrenade"
"clipSize" "50"
"clipSizeDefault" "25"
"act_fire" "5,6,7"
"actAltFire" "2"
"act_holster" "4"
"act_reload" "3"
"act_draw" "4"
"act_idle" "0,1"
"silent_fire" "1"
"primed_fuse" "4"
"act_idle" "0"
"act_draw" "3"
"act_delay" "1"
"act_fire" "2"
"chargeTime" "2"
"removeOnEmpty" "1"
"drawAfterRelease" "1"
"snd_fire" "weapon_smokegrenade.shoot"
"snd_altfire" "weapon_smokegrenade.gl"

View file

@ -7,7 +7,7 @@ entityDef weapon_xm1014
"model_view" "models/v_xm1014.mdl"
"inv_name" "Benneli XM1014 Weapon"
"def_fireInfo" "fireInfo_xm1014"
"def_fireInfo" "fireInfo_xm1014"
"clipSize" "7"
"ammoType" "ammo_buckshot"

View file

@ -25,6 +25,7 @@ set fcs_autoreload "0"
set con_color "255 150 0"
set vgui_color "255 170 0"
set cross_color "0 255 0"
set r_menutint "0.22 0.278 0.40"
// physics differences from valve/
set pm_accelerate "4"

BIN
zpak001.pk3dir/icon.tga Normal file

Binary file not shown.

View file

@ -1,5 +1,6 @@
exec default_controls.cfg
exec default_cvar.cfg
exec default_video.cfg
exec default_valve.cfg
exec default_cstrike.cfg
exec default_aliases.cfg