January 2019 Refactor: Added the initial BaseHL logic and started merging things with FreeCS. This will ensure a bright future to anyone porting mods and the like to the codebase. This is very, VERY early and I'm mainly committing this so Xylemon can start tinkering with it.
This commit is contained in:
parent
710509a0c1
commit
546451338f
102 changed files with 4814 additions and 514 deletions
62
Source/client/chat.c
Normal file
62
Source/client/chat.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
#define CHAT_LINES 5
|
||||
#define CHAT_TIME 5
|
||||
|
||||
var float g_chattime;
|
||||
var int g_chatlines = -1;
|
||||
string g_chatbuffer[CHAT_LINES];
|
||||
|
||||
/*
|
||||
=================
|
||||
Chat_Draw
|
||||
|
||||
Just prints whatever is in the chat buffer and removes lines after some time.
|
||||
=================
|
||||
*/
|
||||
void Chat_Draw(void)
|
||||
{
|
||||
vector pos = video_mins + [16, video_res_y - 128];
|
||||
|
||||
if (g_chatlines < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove messages after a g_chattime has passed
|
||||
if (g_chattime < time) {
|
||||
g_chatbuffer[g_chatlines] = __NULL__;
|
||||
g_chatlines--;
|
||||
g_chattime = time + CHAT_TIME;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < CHAT_LINES; i++) {
|
||||
drawstring(pos, g_chatbuffer[i], [12,12], [1,1,1], 1.0f, 0);
|
||||
pos_y += 14;
|
||||
}
|
||||
}
|
||||
|
||||
void Chat_Parse(string msg)
|
||||
{
|
||||
if (g_chatlines < (CHAT_LINES - 1)) {
|
||||
g_chatbuffer[g_chatlines + 1] = msg;
|
||||
g_chatlines++;
|
||||
} else {
|
||||
for (int i = 0; i < (CHAT_LINES - 1); i++) {
|
||||
g_chatbuffer[i] = g_chatbuffer[i + 1];
|
||||
}
|
||||
g_chatbuffer[CHAT_LINES - 1] = msg;
|
||||
}
|
||||
|
||||
g_chattime = time + CHAT_TIME;
|
||||
|
||||
// Log to console
|
||||
localcmd(sprintf("echo \"%s\"\n", msg));
|
||||
sound(self, CHAN_ITEM, "misc/talk.wav", 1.0, ATTN_NONE);
|
||||
}
|
|
@ -16,7 +16,7 @@ cstrike/defs.h
|
|||
defs.h
|
||||
vgui.h
|
||||
|
||||
hud_voice.c
|
||||
voice.c
|
||||
sound.c
|
||||
text.c
|
||||
|
||||
|
@ -59,7 +59,7 @@ text.c
|
|||
../shared/spraylogo.cpp
|
||||
|
||||
cstrike/overview.c
|
||||
cstrike/player.c
|
||||
../shared/valve/player.cpp
|
||||
player.c
|
||||
predict.c
|
||||
events.c
|
||||
|
@ -74,6 +74,7 @@ cstrike/vguiteamselect.c
|
|||
cstrike/vguiradio.c
|
||||
cstrike/vgui.c
|
||||
damage.c
|
||||
chat.c
|
||||
cstrike/nightvision.c
|
||||
cstrike/hudcrosshair.c
|
||||
cstrike/hudscope.c
|
||||
|
@ -85,7 +86,9 @@ cstrike/entities.c
|
|||
cstrike/event.c
|
||||
cstrike/init.c
|
||||
|
||||
cstrike/player.c
|
||||
entities.c
|
||||
|
||||
cstrike/input.c
|
||||
entry.c
|
||||
#endlist
|
||||
|
|
|
@ -115,9 +115,6 @@ struct
|
|||
// Sound Stuff
|
||||
//.string sSoundSample;
|
||||
//.float fVolume;
|
||||
|
||||
void View_AddPunchAngle( vector vAdd );
|
||||
void View_PlayAnimation( int iSequence );
|
||||
string HUD_GetChatColorHEX( float fTeam );
|
||||
|
||||
// For the player entity
|
||||
|
|
|
@ -6,138 +6,6 @@
|
|||
*
|
||||
****/
|
||||
|
||||
#define CHAT_LINES 5
|
||||
#define CHAT_TIME 20
|
||||
var int iLineScroll = 0;
|
||||
|
||||
float fChatTime;
|
||||
float fChatAlpha;
|
||||
string sMSGBuffer[CHAT_LINES];
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_Parse_Print
|
||||
|
||||
Receives a message and sorts it into the chat messagebuffer
|
||||
=================
|
||||
*/
|
||||
void CSQC_Parse_Print(string sMessage, float fLevel) {
|
||||
// This gives messages other than chat an orange tint
|
||||
if (fLevel != PRINT_CHAT) {
|
||||
sMessage = sprintf("^xF80%s", sMessage);
|
||||
}
|
||||
|
||||
if (iLineScroll < (CHAT_LINES - 1)) {
|
||||
sMSGBuffer[iLineScroll + 1] = sMessage;
|
||||
iLineScroll++;
|
||||
} else {
|
||||
for (int i = 0; i < (CHAT_LINES - 1); i++) {
|
||||
sMSGBuffer[i] = sMSGBuffer[i + 1];
|
||||
}
|
||||
sMSGBuffer[CHAT_LINES - 1] = sMessage;
|
||||
}
|
||||
|
||||
fChatTime = time + CHAT_TIME;
|
||||
fChatAlpha = 1.0f;
|
||||
|
||||
// Log to console
|
||||
localcmd(sprintf("echo \"%s\"\n", sMessage));
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_DrawChat
|
||||
|
||||
Just prints whatever is in the chat buffer and removes lines after some time.
|
||||
=================
|
||||
*/
|
||||
void CSQC_DrawChat(void) {
|
||||
vector vChatPos = video_mins + [16, video_res_y - 128];
|
||||
|
||||
// Remove messages after a fChatTime has passed
|
||||
if (fChatTime < time) {
|
||||
fChatAlpha -= frametime;
|
||||
} else {
|
||||
fChatAlpha = 1.0f;
|
||||
}
|
||||
|
||||
if (fChatAlpha > 0.0f) {
|
||||
#if 1
|
||||
for (int i = 0; i < CHAT_LINES; i++) {
|
||||
drawstring(vChatPos, sMSGBuffer[i], '12 12', '1 1 1', fChatAlpha, 0);
|
||||
vChatPos_y += 14;
|
||||
}
|
||||
#else
|
||||
string sDraw = sMSGBuffer[0];
|
||||
for (int i = 1; i < CHAT_LINES; i++) {
|
||||
sDraw = sprintf("%s\n%s\n", sDraw, sMSGBuffer[i]);
|
||||
}
|
||||
|
||||
drawtextfield(vChatPos, [video_res_x - 32, CHAT_LINES * 12], 1, sDraw);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_DrawCenterprint
|
||||
|
||||
Read centerprints from a buffer and display them with alpha and whatnot
|
||||
=================
|
||||
*/
|
||||
float fCenterPrintAlpha;
|
||||
float fCenterPrintTime;
|
||||
float fCenterPrintLines;
|
||||
string sCenterPrintBuffer[18];
|
||||
|
||||
void CSQC_DrawCenterprint(void) {
|
||||
if (fCenterPrintAlpha <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
vector vCenterPrintPos;
|
||||
|
||||
if (fCenterPrintTime > time) {
|
||||
fCenterPrintAlpha = 1;
|
||||
} else {
|
||||
fCenterPrintAlpha -= frametime;
|
||||
|
||||
if (fCenterPrintAlpha < 0) {
|
||||
fCenterPrintAlpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
vCenterPrintPos_y = video_mins_y + (video_res_y / 2) - (fCenterPrintLines - 4) - 69;
|
||||
|
||||
for (int i = 0; i < (fCenterPrintLines); i++) {
|
||||
vCenterPrintPos_x = video_mins_x + (video_res_x / 2) - (stringwidth(sCenterPrintBuffer[i], TRUE, '12 12') / 2);
|
||||
drawstring(vCenterPrintPos, sCenterPrintBuffer[i], '12 12', '1 1 1', fCenterPrintAlpha, 0);
|
||||
vCenterPrintPos_y += 8;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_Parse_CenterPrint
|
||||
|
||||
Catches every centerprint call and allows us to tinker with it.
|
||||
That's how we are able to add color, alpha and whatnot.
|
||||
Keep in mind that newlines need to be tokenized
|
||||
=================
|
||||
*/
|
||||
float CSQC_Parse_CenterPrint(string sMessage) {
|
||||
fCenterPrintLines = tokenizebyseparator(sMessage, "\n");
|
||||
|
||||
for(int i = 0; i < (fCenterPrintLines); i++) {
|
||||
sCenterPrintBuffer[i] = sprintf("^xF80%s", argv(i));
|
||||
}
|
||||
|
||||
fCenterPrintAlpha = 1;
|
||||
fCenterPrintTime = time + 3;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_UpdateView
|
||||
|
|
|
@ -15,39 +15,16 @@ Init all the cmds in one place
|
|||
*/
|
||||
void CSQC_ConsoleCommand_Init(void)
|
||||
{
|
||||
registercommand("slot1");
|
||||
registercommand("slot2");
|
||||
registercommand("slot3");
|
||||
registercommand("slot4");
|
||||
registercommand("slot5");
|
||||
registercommand("slot6");
|
||||
registercommand("slot7");
|
||||
registercommand("slot8");
|
||||
registercommand("slot9");
|
||||
registercommand("slot10");
|
||||
|
||||
registercommand("dev_testorbituary");
|
||||
registercommand("minimap");
|
||||
registercommand("overview_test");
|
||||
registercommand("vox_test");
|
||||
registercommand("+attack2");
|
||||
registercommand("-attack2");
|
||||
registercommand("+reload");
|
||||
registercommand("-reload");
|
||||
registercommand("+use");
|
||||
registercommand("-use");
|
||||
registercommand("+duck");
|
||||
registercommand("-duck");
|
||||
|
||||
registercommand("buy");
|
||||
registercommand("chooseteam");
|
||||
registercommand("lastinv");
|
||||
registercommand("invnext");
|
||||
registercommand("invprev");
|
||||
registercommand("+showscores");
|
||||
registercommand("-showscores");
|
||||
registercommand("nightvision");
|
||||
|
||||
registercommand("drop");
|
||||
registercommand("nightvision");
|
||||
|
||||
registercommand("radio1");
|
||||
registercommand("radio2");
|
||||
|
@ -123,39 +100,6 @@ float Game_ConsoleCommand(void)
|
|||
{
|
||||
/* This has already been tokenized */
|
||||
switch (argv(0)) {
|
||||
case "lastinv":
|
||||
HUD_DrawWeaponSelect_Last();
|
||||
break;
|
||||
case "slot1":
|
||||
localcmd("impulse 1\n");
|
||||
break;
|
||||
case "slot2":
|
||||
localcmd("impulse 2\n");
|
||||
break;
|
||||
case "slot3":
|
||||
localcmd("impulse 3\n");
|
||||
break;
|
||||
case "slot4":
|
||||
localcmd("impulse 4\n");
|
||||
break;
|
||||
case "slot5":
|
||||
localcmd("impulse 5\n");
|
||||
break;
|
||||
case "slot6":
|
||||
localcmd("impulse 6\n");
|
||||
break;
|
||||
case "slot7":
|
||||
localcmd("impulse 7\n");
|
||||
break;
|
||||
case "slot8":
|
||||
localcmd("impulse 8\n");
|
||||
break;
|
||||
case "slot9":
|
||||
localcmd("impulse 9\n");
|
||||
break;
|
||||
case "slot10":
|
||||
localcmd("impulse 10\n");
|
||||
break;
|
||||
case "dev_testorbituary":
|
||||
HUD_AddOrbituaries(player_localnum, TEAM_T, player_localnum, TEAM_CT, floor(random(1, CS_WEAPON_COUNT)), FALSE);
|
||||
break;
|
||||
|
@ -173,18 +117,6 @@ float Game_ConsoleCommand(void)
|
|||
case "chooseteam":
|
||||
pSeat->fVGUI_Display = VGUI_TEAMSELECT;
|
||||
break;
|
||||
case "invnext":
|
||||
HUD_DrawWeaponSelect_Back();
|
||||
break;
|
||||
case "invprev":
|
||||
HUD_DrawWeaponSelect_Forward();
|
||||
break;
|
||||
case "+showscores":
|
||||
pSeat->iShowScores = TRUE;
|
||||
break;
|
||||
case "-showscores":
|
||||
pSeat->iShowScores = FALSE;
|
||||
break;
|
||||
case "nightvision":
|
||||
Nightvision_Toggle();
|
||||
break;
|
||||
|
|
|
@ -69,8 +69,6 @@ void HUD_Init(void)
|
|||
precache_model("sprites/640hud14.spr");
|
||||
precache_model("sprites/640hud3.spr");
|
||||
precache_model("sprites/640hud5.spr");
|
||||
precache_model("sprites/640_pain.spr");
|
||||
precache_model("sprites/crosshairs.spr");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,7 +38,6 @@ void Client_Init(float apilevel, string enginename, float engineversion)
|
|||
PARTICLE_SMOKEGRENADE = particleeffectnum("smokegren");
|
||||
|
||||
Radio_InitSounds();
|
||||
|
||||
CSQC_ConsoleCommand_Init();
|
||||
CSQC_VGUI_Init();
|
||||
Overview_Init();
|
||||
|
|
12
Source/client/cstrike/input.c
Normal file
12
Source/client/cstrike/input.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
void Game_Input(void)
|
||||
{
|
||||
|
||||
}
|
|
@ -43,3 +43,37 @@ string sPModels[CS_WEAPON_COUNT - 1] = {
|
|||
"models/p_hegrenade.mdl",
|
||||
"models/p_smokegrenade.mdl"
|
||||
};
|
||||
|
||||
void Player_ReadEntity(float flIsNew)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if ( flIsNew == TRUE ) {
|
||||
spawnfunc_player();
|
||||
|
||||
pl.classname = "player";
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.drawmask = MASK_ENGINE;
|
||||
pl.customphysics = Empty;
|
||||
setsize( pl, VEC_HULL_MIN, VEC_HULL_MAX );
|
||||
}
|
||||
|
||||
pl.modelindex = readshort();
|
||||
pl.origin[0] = readcoord();
|
||||
pl.origin[1] = readcoord();
|
||||
pl.origin[2] = readcoord();
|
||||
pl.pitch = readcoord() / 90;
|
||||
pl.angles[1] = readcoord();
|
||||
pl.angles[2] = readcoord();
|
||||
pl.velocity[0] = readcoord();
|
||||
pl.velocity[1] = readcoord();
|
||||
pl.velocity[2] = readcoord();
|
||||
pl.flags = readfloat();
|
||||
pl.pmove_flags = readfloat();
|
||||
pl.weapon = readbyte();
|
||||
pl.health = readbyte();
|
||||
pl.movetype = readfloat();
|
||||
pl.view_ofs[2] = readfloat();
|
||||
pl.viewzoom = readfloat();
|
||||
setorigin( pl, pl.origin );
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#define DRAWFLAG_2XMODULATE 3
|
||||
|
||||
// Undocumented printcall types
|
||||
#define PRINT_LOW 0
|
||||
#define PRINT_MEDIUM 1
|
||||
#define PRINT_HIGH 2
|
||||
#define PRINT_CHAT 3
|
||||
#define PRINT_LOW 0
|
||||
#define PRINT_MEDIUM 1
|
||||
#define PRINT_HIGH 2
|
||||
#define PRINT_CHAT 3
|
||||
|
||||
var float FONT_16;
|
||||
var float FONT_20;
|
||||
|
@ -31,7 +31,7 @@ var float autocvar_cl_bob = 0;
|
|||
var float autocvar_v_bob = 0.01;
|
||||
var float autocvar_v_bobcycle = 0.8;
|
||||
var float autocvar_v_bobup = 0.5;
|
||||
var int autocvar_v_bobclassic = FALSE;
|
||||
var int autocvar_v_bobclassic = TRUE;
|
||||
var vector autocvar_v_gunofs = [0,0,0];
|
||||
var int autocvar_cl_thirdperson = FALSE;
|
||||
var int autocvar_cl_smoothstairs = TRUE;
|
||||
|
@ -73,4 +73,10 @@ vector mouse_pos;
|
|||
float clframetime;
|
||||
|
||||
|
||||
|
||||
void View_AddPunchAngle( vector vAdd );
|
||||
void View_PlayAnimation( int iSequence );
|
||||
void Game_Input(void);
|
||||
|
||||
|
||||
int(float playernum, string keyname, optional void *outptr, int size) getplayerkeyblob = #0;
|
||||
|
|
|
@ -18,36 +18,7 @@ void CSQC_Ent_Update(float flIsNew)
|
|||
float fEntType = readbyte();
|
||||
|
||||
if ( fEntType == ENT_PLAYER ) {
|
||||
player pl = (player)self;
|
||||
|
||||
if ( flIsNew == TRUE ) {
|
||||
spawnfunc_player();
|
||||
|
||||
pl.classname = "player";
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.drawmask = MASK_ENGINE;
|
||||
pl.customphysics = Empty;
|
||||
setsize( pl, VEC_HULL_MIN, VEC_HULL_MAX );
|
||||
}
|
||||
|
||||
pl.modelindex = readshort();
|
||||
pl.origin[0] = readcoord();
|
||||
pl.origin[1] = readcoord();
|
||||
pl.origin[2] = readcoord();
|
||||
pl.pitch = readcoord() / 90;
|
||||
pl.angles[1] = readcoord();
|
||||
pl.angles[2] = readcoord();
|
||||
pl.velocity[0] = readcoord();
|
||||
pl.velocity[1] = readcoord();
|
||||
pl.velocity[2] = readcoord();
|
||||
pl.flags = readfloat();
|
||||
pl.pmove_flags = readfloat();
|
||||
pl.weapon = readbyte();
|
||||
pl.health = readbyte();
|
||||
pl.movetype = readfloat();
|
||||
pl.view_ofs[2] = readfloat();
|
||||
pl.viewzoom = readfloat();
|
||||
setorigin( pl, pl.origin );
|
||||
Player_ReadEntity(flIsNew);
|
||||
} else if ( fEntType == ENT_SPRITE ) {
|
||||
Sprite_Animated();
|
||||
} else if ( fEntType == ENT_SPRAY ) {
|
||||
|
|
|
@ -10,6 +10,35 @@ void CSQC_Init(float apilevel, string enginename, float engineversion)
|
|||
{
|
||||
pSeat = &seats[0];
|
||||
|
||||
registercommand("vox_test");
|
||||
registercommand("+attack2");
|
||||
registercommand("-attack2");
|
||||
registercommand("+reload");
|
||||
registercommand("-reload");
|
||||
registercommand("+use");
|
||||
registercommand("-use");
|
||||
registercommand("+duck");
|
||||
registercommand("-duck");
|
||||
|
||||
registercommand("slot1");
|
||||
registercommand("slot2");
|
||||
registercommand("slot3");
|
||||
registercommand("slot4");
|
||||
registercommand("slot5");
|
||||
registercommand("slot6");
|
||||
registercommand("slot7");
|
||||
registercommand("slot8");
|
||||
registercommand("slot9");
|
||||
registercommand("slot10");
|
||||
registercommand("lastinv");
|
||||
registercommand("invnext");
|
||||
registercommand("invprev");
|
||||
registercommand("+showscores");
|
||||
registercommand("-showscores");
|
||||
|
||||
precache_model("sprites/640_pain.spr");
|
||||
precache_model("sprites/crosshairs.spr");
|
||||
|
||||
/* Fonts */
|
||||
FONT_16 = loadfont("16", "fonts/default", "16", -1);
|
||||
FONT_CON = loadfont("font", "", "12", -1);
|
||||
|
@ -37,6 +66,9 @@ void CSQC_Init(float apilevel, string enginename, float engineversion)
|
|||
|
||||
/* VOX */
|
||||
Sound_InitVOX();
|
||||
|
||||
/* View */
|
||||
View_Init();
|
||||
|
||||
/* Effects */
|
||||
precache_sound("debris/bustglass1.wav");
|
||||
|
@ -159,14 +191,15 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
|
||||
// The spectator sees things... differently
|
||||
if (getplayerkeyvalue(player_localnum, "*spec") != "0") {
|
||||
///VGUI_DrawSpectatorHUD();
|
||||
VGUI_DrawSpectatorHUD();
|
||||
} else {
|
||||
HUD_Draw();
|
||||
}
|
||||
|
||||
///HUD_DrawOrbituaries();
|
||||
Voice_DrawHUD();
|
||||
///CSQC_DrawChat();
|
||||
Chat_Draw();
|
||||
Print_Draw();
|
||||
|
||||
#ifdef CSTRIKE
|
||||
// Don't even try to draw centerprints and VGUI menus when scores are shown
|
||||
|
@ -191,9 +224,6 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
}
|
||||
|
||||
Sound_ProcessWordQue();
|
||||
|
||||
CSQC_DrawText([16,16], "THIS IS A TEST.\n", [20,20], [1,1,1], 1.0f,
|
||||
0, FONT_20);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -264,7 +294,7 @@ void CSQC_Input_Frame(void)
|
|||
int s = (float)getproperty(VF_ACTIVESEAT);
|
||||
pSeat = &seats[s];
|
||||
|
||||
#ifdef CSTRIKE
|
||||
|
||||
// If we are inside a VGUI, don't let the client do stuff outside
|
||||
if ((pSeat->fVGUI_Display != VGUI_NONE)) {
|
||||
fInputSendNext = time + 0.2;
|
||||
|
@ -273,7 +303,7 @@ void CSQC_Input_Frame(void)
|
|||
input_buttons = 0;
|
||||
fInputSendNext = time + 0.2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (fInputSendNext > time) {
|
||||
input_impulse = 0;
|
||||
|
@ -305,8 +335,9 @@ void CSQC_Input_Frame(void)
|
|||
if (iInputDuck == TRUE) {
|
||||
input_buttons |= INPUT_BUTTON8;
|
||||
}
|
||||
|
||||
|
||||
input_angles += pSeat->vPunchAngle;
|
||||
Game_Input();
|
||||
}
|
||||
|
||||
|
||||
|
@ -437,12 +468,105 @@ float CSQC_ConsoleCommand(string sCMD)
|
|||
case "-duck":
|
||||
iInputDuck = FALSE;
|
||||
break;
|
||||
case "invnext":
|
||||
HUD_DrawWeaponSelect_Back();
|
||||
break;
|
||||
case "invprev":
|
||||
HUD_DrawWeaponSelect_Forward();
|
||||
break;
|
||||
case "lastinv":
|
||||
HUD_DrawWeaponSelect_Last();
|
||||
break;
|
||||
case "+showscores":
|
||||
pSeat->iShowScores = TRUE;
|
||||
break;
|
||||
case "-showscores":
|
||||
pSeat->iShowScores = FALSE;
|
||||
break;
|
||||
case "slot1":
|
||||
localcmd("impulse 1\n");
|
||||
break;
|
||||
case "slot2":
|
||||
localcmd("impulse 2\n");
|
||||
break;
|
||||
case "slot3":
|
||||
localcmd("impulse 3\n");
|
||||
break;
|
||||
case "slot4":
|
||||
localcmd("impulse 4\n");
|
||||
break;
|
||||
case "slot5":
|
||||
localcmd("impulse 5\n");
|
||||
break;
|
||||
case "slot6":
|
||||
localcmd("impulse 6\n");
|
||||
break;
|
||||
case "slot7":
|
||||
localcmd("impulse 7\n");
|
||||
break;
|
||||
case "slot8":
|
||||
localcmd("impulse 8\n");
|
||||
break;
|
||||
case "slot9":
|
||||
localcmd("impulse 9\n");
|
||||
break;
|
||||
case "slot10":
|
||||
localcmd("impulse 10\n");
|
||||
break;
|
||||
default:
|
||||
return Game_ConsoleCommand();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CSQC_Parse_Print(string sMessage, float fLevel)
|
||||
{
|
||||
// This gives messages other than chat an orange tint
|
||||
if (fLevel == PRINT_CHAT) {
|
||||
Chat_Parse(sMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_printlines < (4)) {
|
||||
g_printbuffer[g_printlines + 1] = sMessage;
|
||||
g_printlines++;
|
||||
} else {
|
||||
for (int i = 0; i < (4); i++) {
|
||||
g_printbuffer[i] = g_printbuffer[i + 1];
|
||||
}
|
||||
g_printbuffer[4] = sMessage;
|
||||
}
|
||||
|
||||
g_printtime = time + CHAT_TIME;
|
||||
|
||||
// Log to console
|
||||
localcmd(sprintf("echo \"%s\"\n", sMessage));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_Parse_CenterPrint
|
||||
|
||||
Catches every centerprint call and allows us to tinker with it.
|
||||
That's how we are able to add color, alpha and whatnot.
|
||||
Keep in mind that newlines need to be tokenized
|
||||
=================
|
||||
*/
|
||||
float CSQC_Parse_CenterPrint(string sMessage)
|
||||
{
|
||||
fCenterPrintLines = tokenizebyseparator(sMessage, "\n");
|
||||
|
||||
for(int i = 0; i < (fCenterPrintLines); i++) {
|
||||
sCenterPrintBuffer[i] = sprintf("^xF80%s", argv(i));
|
||||
}
|
||||
|
||||
fCenterPrintAlpha = 1;
|
||||
fCenterPrintTime = time + 3;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_WorldLoaded
|
||||
|
@ -452,7 +576,16 @@ Whenever the world is fully initialized...
|
|||
*/
|
||||
void CSQC_WorldLoaded(void)
|
||||
{
|
||||
|
||||
/*precache_pic("{shot1", TRUE);
|
||||
precache_pic("{shot2", TRUE);
|
||||
precache_pic("{shot3", TRUE);
|
||||
precache_pic("{shot4", TRUE);
|
||||
precache_pic("{shot5", TRUE);
|
||||
precache_pic("{bigshot1", TRUE);
|
||||
precache_pic("{bigshot2", TRUE);
|
||||
precache_pic("{bigshot3", TRUE);
|
||||
precache_pic("{bigshot4", TRUE);
|
||||
precache_pic("{bigshot5", TRUE);*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,8 +13,9 @@ View_ShellEject
|
|||
Spawns a shell tempentity. Looking fancy
|
||||
====================
|
||||
*/
|
||||
void Event_EjectShell( void ) {
|
||||
static void Event_EjectShell_Death( void ) {
|
||||
void Event_EjectShell(void)
|
||||
{
|
||||
static void Event_EjectShell_Death(void) {
|
||||
remove( self );
|
||||
}
|
||||
vector vOrigin = pSeat->vPlayerOrigin;
|
||||
|
@ -45,7 +46,8 @@ Called by the engine whenever a model
|
|||
tries to play an event.
|
||||
====================
|
||||
*/
|
||||
void Event_ProcessModel( float fTimeStamp, int iCode, string sData ) {
|
||||
void Event_ProcessModel( float fTimeStamp, int iCode, string sData )
|
||||
{
|
||||
if ( iCode == 5004 ) {
|
||||
localsound( sData, CHAN_AUTO, 1.0 );
|
||||
} else if ( iCode == 5001 ) {
|
||||
|
|
|
@ -6,31 +6,6 @@
|
|||
*
|
||||
****/
|
||||
|
||||
class player
|
||||
{
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
|
||||
vector netorigin;
|
||||
vector netvelocity;
|
||||
float netflags;
|
||||
|
||||
float weapon;
|
||||
float lastweapon;
|
||||
|
||||
float health;
|
||||
float armor;
|
||||
float pitch;
|
||||
float viewzoom;
|
||||
|
||||
vector view_ofs;
|
||||
|
||||
virtual void() gun_offset;
|
||||
virtual void() draw;
|
||||
virtual float() predraw;
|
||||
};
|
||||
|
||||
//.float bonecontrol1; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
|
||||
//.float bonecontrol2; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
|
||||
//.float bonecontrol3; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
|
||||
|
@ -67,13 +42,13 @@ void player::draw(void)
|
|||
this.subblend2frac = this.pitch;
|
||||
|
||||
// Only bother updating the model if the weapon has changed
|
||||
if (this.lastweapon != this.weapon) {
|
||||
if (this.weapon) {
|
||||
if (this.lastweapon != this.activeweapon) {
|
||||
if (this.activeweapon) {
|
||||
// FIXME: setmodel(this.p_model, sPModels[this.weapon - 1]);
|
||||
} else {
|
||||
setmodel(this.p_model, "");
|
||||
}
|
||||
this.lastweapon = this.weapon;
|
||||
this.lastweapon = this.activeweapon;
|
||||
|
||||
// Update the bone index of the current p_ model so we can calculate the offset
|
||||
// Get the weapon bone ID for the current player model
|
||||
|
@ -81,7 +56,7 @@ void player::draw(void)
|
|||
this.p_model_bone = gettagindex(this.p_model, "Bip01 R Hand");
|
||||
}
|
||||
|
||||
//Animation_PlayerUpdate();
|
||||
Animation_PlayerUpdate();
|
||||
/*makevectors([0, this.angles[1], 0]);
|
||||
float fDirection = dotproduct(this.velocity, v_forward);
|
||||
|
||||
|
|
|
@ -20,6 +20,12 @@ void Predict_PreFrame(player pl)
|
|||
pl.netorigin = pl.origin;
|
||||
pl.netvelocity = pl.velocity;
|
||||
pl.netflags = pl.flags;
|
||||
|
||||
#ifdef VALVE
|
||||
pl.net_w_attack_next = pl.w_attack_next;
|
||||
pl.net_w_idle_next = pl.w_idle_next;
|
||||
#endif
|
||||
|
||||
//self.netpmove_flags = self.pmove_flags;
|
||||
|
||||
//we want to predict an exact copy of the data in the new packet
|
||||
|
@ -57,6 +63,12 @@ void Predict_PostFrame(player pl)
|
|||
pl.origin = pl.netorigin;
|
||||
pl.velocity = pl.netvelocity;
|
||||
pl.flags = pl.netflags;
|
||||
|
||||
#ifdef VALVE
|
||||
pl.w_attack_next = pl.net_w_attack_next;
|
||||
pl.w_idle_next = pl.net_w_idle_next;
|
||||
#endif
|
||||
|
||||
//self.pmove_flags = self.netpmove_flags;
|
||||
setorigin(pl, pl.origin);
|
||||
//self.pmove_frame = servercommandframe + 1;
|
||||
|
|
|
@ -16,32 +16,32 @@ var int iVOXCount;
|
|||
var int iVOXPos;
|
||||
var float fSampleTime = 0.0f;
|
||||
|
||||
void Sound_PlayVOX( string sMessage ) {
|
||||
if ( iVOXCount ) {
|
||||
void Sound_PlayVOX(string msg) {
|
||||
if (iVOXCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
iVOXCount = tokenize( sMessage );
|
||||
sndVOX = memalloc( sizeof( sound_t ) * iVOXCount );
|
||||
iVOXCount = tokenize(msg);
|
||||
sndVOX = memalloc(sizeof(sound_t) * iVOXCount);
|
||||
|
||||
for ( int i = 0; i < iVOXCount; i++ ) {
|
||||
sndVOX[i].sSample = sprintf( "vox/%s.wav", argv( i ) );
|
||||
sndVOX[i].fLength = soundlength( sndVOX[i].sSample );
|
||||
for (int i = 0; i < iVOXCount; i++) {
|
||||
sndVOX[i].sSample = sprintf("vox/%s.wav", argv(i));
|
||||
sndVOX[i].fLength = soundlength(sndVOX[i].sSample);
|
||||
}
|
||||
fSampleTime = time;
|
||||
}
|
||||
|
||||
void Sound_ProcessWordQue( void ) {
|
||||
if ( cltime < 2 ) {
|
||||
void Sound_ProcessWordQue(void) {
|
||||
if (cltime < 2) {
|
||||
return;
|
||||
}
|
||||
if ( iVOXCount ) {
|
||||
if ( fSampleTime < time ) {
|
||||
localcmd( sprintf( "play %s\n", sndVOX[ iVOXPos ].sSample ) );
|
||||
if (iVOXCount) {
|
||||
if (fSampleTime < time) {
|
||||
localcmd(sprintf("play %s\n", sndVOX[ iVOXPos ].sSample));
|
||||
iVOXPos++;
|
||||
|
||||
if ( iVOXPos == iVOXCount ) {
|
||||
memfree( sndVOX );
|
||||
if (iVOXPos == iVOXCount) {
|
||||
memfree(sndVOX);
|
||||
iVOXCount = 0;
|
||||
iVOXPos = 0;
|
||||
} else {
|
||||
|
|
|
@ -6,9 +6,80 @@
|
|||
*
|
||||
****/
|
||||
|
||||
float g_printtime;
|
||||
string g_printbuffer[5];
|
||||
var int g_printlines = -1;
|
||||
|
||||
void CSQC_DrawText(vector pos, string txt, vector sz, vector col, float a,
|
||||
float fl, float fnt)
|
||||
{
|
||||
drawfont = fnt;
|
||||
drawstring(pos, txt, sz, col, a, fl);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Chat_Draw
|
||||
|
||||
Just prints whatever is in the chat buffer and removes lines after some time.
|
||||
=================
|
||||
*/
|
||||
void Print_Draw(void) {
|
||||
vector pos = video_mins + [16, 16];
|
||||
|
||||
if (g_printlines < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove messages after a g_chattime has passed
|
||||
if (g_printtime < time) {
|
||||
g_printbuffer[g_printlines] = __NULL__;
|
||||
g_printlines--;
|
||||
g_printtime = time + 5;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
drawstring(pos, g_printbuffer[i], [12,12], [1,1,1], 1.0f, 0);
|
||||
pos_y += 14;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSQC_DrawCenterprint
|
||||
|
||||
Read centerprints from a buffer and display them with alpha and whatnot
|
||||
=================
|
||||
*/
|
||||
float fCenterPrintAlpha;
|
||||
float fCenterPrintTime;
|
||||
float fCenterPrintLines;
|
||||
string sCenterPrintBuffer[18];
|
||||
|
||||
void CSQC_DrawCenterprint(void)
|
||||
{
|
||||
if (fCenterPrintAlpha <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
vector vCenterPrintPos;
|
||||
|
||||
if (fCenterPrintTime > time) {
|
||||
fCenterPrintAlpha = 1;
|
||||
} else {
|
||||
fCenterPrintAlpha -= frametime;
|
||||
|
||||
if (fCenterPrintAlpha < 0) {
|
||||
fCenterPrintAlpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
vCenterPrintPos_y = video_mins_y + (video_res_y / 2) - (fCenterPrintLines - 4) - 69;
|
||||
|
||||
for (int i = 0; i < (fCenterPrintLines); i++) {
|
||||
vCenterPrintPos_x = video_mins_x + (video_res_x / 2) - (stringwidth(sCenterPrintBuffer[i], TRUE, '12 12') / 2);
|
||||
drawstring(vCenterPrintPos, sCenterPrintBuffer[i], '12 12', '1 1 1', fCenterPrintAlpha, 0);
|
||||
vCenterPrintPos_y += 8;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,15 +20,38 @@ valve/init.c
|
|||
|
||||
../gs-entbase/client.src
|
||||
|
||||
../shared/pmove.c
|
||||
sound.c
|
||||
text.c
|
||||
hud_voice.c
|
||||
voice.c
|
||||
|
||||
../shared/valve/animations.c
|
||||
../shared/valve/player.cpp
|
||||
player.c
|
||||
../shared/pmove.c
|
||||
predict.c
|
||||
../shared/effects.c
|
||||
../shared/spraylogo.cpp
|
||||
|
||||
../shared/valve/items.h
|
||||
../shared/valve/crosshair.h
|
||||
../shared/valve/weapons.h
|
||||
../shared/valve/w_crowbar.c
|
||||
../shared/valve/w_glock.c
|
||||
../shared/valve/w_python.c
|
||||
../shared/valve/w_mp5.c
|
||||
../shared/valve/w_crossbow.c
|
||||
../shared/valve/w_shotgun.c
|
||||
../shared/valve/w_rpg.c
|
||||
../shared/valve/w_gauss.c
|
||||
../shared/valve/w_egon.c
|
||||
../shared/valve/w_hornetgun.c
|
||||
../shared/valve/w_handgrenade.c
|
||||
../shared/valve/w_tripmine.c
|
||||
../shared/valve/w_satchel.c
|
||||
../shared/valve/w_snark.c
|
||||
../shared/valve/weapons.c
|
||||
|
||||
valve/player.c
|
||||
entities.c
|
||||
|
||||
valve/cmds.c
|
||||
|
@ -37,7 +60,10 @@ events.c
|
|||
valve/view.c
|
||||
view.c
|
||||
damage.c
|
||||
chat.c
|
||||
valve/hud.c
|
||||
valve/hud_weaponselect.c
|
||||
|
||||
valve/input.c
|
||||
entry.c
|
||||
#endlist
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
*
|
||||
****/
|
||||
|
||||
vector g_hud_color;
|
||||
|
||||
struct
|
||||
{
|
||||
//Viewmodel stuff
|
||||
|
@ -31,29 +33,16 @@ struct
|
|||
vector vCameraAngle;
|
||||
float fCameraTime;
|
||||
|
||||
// Flashbang'd
|
||||
float fFlashTime;
|
||||
float fFlashAlpha;
|
||||
|
||||
//UI fields
|
||||
float fVGUI_Display; // The VGUI menu currently being drawn
|
||||
int iShowScores; // This is seperated from the other VGUI stuff so we can check scores while buying and whatnot
|
||||
|
||||
// Testing
|
||||
int iOverview;
|
||||
int iMapExpand;
|
||||
float fMapLerp;
|
||||
|
||||
//crosshair
|
||||
int iOldShotMultiplier;
|
||||
float fCrosshairDistance;
|
||||
float fDecreaseShotTime;
|
||||
int iShotMultiplier;
|
||||
|
||||
//buy menu
|
||||
// We can only carry one item per slot, so this is hacking around the last one
|
||||
int iHUDGrenades;
|
||||
int iHUDGrenadesSelected;
|
||||
float fHUDWeaponSelectTime;
|
||||
float fHUDWeaponSelected;
|
||||
float fHUDWeaponSelectTime;
|
||||
} seats[4], *pSeat;
|
||||
|
||||
void HUD_DrawAmmo1(void);
|
||||
void HUD_DrawAmmo2(void);
|
||||
void HUD_DrawAmmo3(void);
|
||||
|
|
|
@ -8,5 +8,21 @@
|
|||
|
||||
void Game_Parse_Event(float fHeader)
|
||||
{
|
||||
|
||||
if (fHeader == EV_CHAT) {
|
||||
float fSender = readbyte();
|
||||
float fTeam = readbyte();
|
||||
string sMessage = readstring();
|
||||
|
||||
CSQC_Parse_Print(sprintf("%s: %s", getplayerkeyvalue(fSender, "name"), sMessage), PRINT_CHAT);
|
||||
} else if (fHeader == EV_CHAT_TEAM) {
|
||||
float fSender2 = readbyte();
|
||||
float fTeam2 = readbyte();
|
||||
string sMessage2 = readstring();
|
||||
|
||||
CSQC_Parse_Print(sprintf("[TEAM] %s: %s", getplayerkeyvalue(fSender2, "name"), sMessage2), PRINT_CHAT);
|
||||
} else if (fHeader == EV_CHAT_VOX) {
|
||||
Sound_PlayVOX(readstring());
|
||||
} else if (fHeader == EV_VIEWMODEL) {
|
||||
View_PlayAnimation(readbyte());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#define NUMSIZE_Y 24/128
|
||||
#define HUD_ALPHA 0.5
|
||||
|
||||
vector g_hud_color;
|
||||
|
||||
float spr_hudnum[10] = {
|
||||
0 / 256,
|
||||
24 / 256,
|
||||
|
@ -34,15 +32,15 @@ float spr_health[4] = {
|
|||
32 / 128 // size y
|
||||
};
|
||||
float spr_suit1[4] = {
|
||||
10 / 256, // pos x
|
||||
0 / 256, // pos x
|
||||
24 / 128, // pos u
|
||||
30 / 256, // size x
|
||||
40 / 256, // size x
|
||||
40 / 128 // size y
|
||||
};
|
||||
float spr_suit2[4] = {
|
||||
50 / 256, // pos x
|
||||
40 / 256, // pos x
|
||||
24 / 128, // pos u
|
||||
30 / 256, // size x
|
||||
40 / 256, // size x
|
||||
40 / 128 // size y
|
||||
};
|
||||
|
||||
|
@ -60,6 +58,8 @@ float spr_flash2[4] = {
|
|||
32 / 128 // size y
|
||||
};
|
||||
|
||||
void HUD_DrawWeaponSelect(void);
|
||||
|
||||
void HUD_Init(void)
|
||||
{
|
||||
precache_model("sprites/640hud7.spr");
|
||||
|
@ -77,6 +77,12 @@ void HUD_DrawNumber(int iNumber, vector vPos, float fAlpha, vector vColor) {
|
|||
[NUMSIZE_X, NUMSIZE_Y], vColor, fAlpha, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
void HUD_DrawSeperator(vector pos)
|
||||
{
|
||||
drawsubpic(pos, [2,24], HUD_NUMS, [240/256, 0],
|
||||
[2/256, 24/128], g_hud_color, HUD_ALPHA, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
HUD_DrawNums
|
||||
|
@ -129,6 +135,7 @@ void HUD_DrawHealth(void) {
|
|||
[spr_health[2], spr_health[3]], [1,0,0], HUD_ALPHA, DRAWFLAG_ADDITIVE);
|
||||
HUD_DrawNums(pl.health, pos + [72, 0], HUD_ALPHA, [1,0,0]);
|
||||
}
|
||||
|
||||
fOldHealth = pl.health;
|
||||
}
|
||||
|
||||
|
@ -147,7 +154,7 @@ void HUD_DrawArmor(void)
|
|||
static float armoralpha;
|
||||
player pl = (player)self;
|
||||
|
||||
pos = video_mins + [128, video_res[1] - 42];
|
||||
pos = video_mins + [72+16+30, video_res[1] - 42];
|
||||
|
||||
if (pl.armor != oldarmor) {
|
||||
armoralpha = 1.0;
|
||||
|
@ -159,13 +166,100 @@ void HUD_DrawArmor(void)
|
|||
armoralpha = HUD_ALPHA;
|
||||
}
|
||||
|
||||
drawsubpic(pos + [0,-9], [30,40], HUD_NUMS, [spr_suit2[0], spr_suit2[1]],
|
||||
drawsubpic(pos + [0,-9], [40,40], HUD_NUMS, [spr_suit2[0], spr_suit2[1]],
|
||||
[spr_suit2[2], spr_suit2[3]], g_hud_color, armoralpha, DRAWFLAG_ADDITIVE);
|
||||
HUD_DrawNums(pl.armor, pos + [72, 0], armoralpha, g_hud_color);
|
||||
|
||||
float fwhat = pl.armor / 100;
|
||||
if (fwhat > 0.0) {
|
||||
drawsubpic(pos + [0,-9], [40,40*fwhat], HUD_NUMS, [spr_suit1[0], spr_suit1[1]],
|
||||
[spr_suit1[2], spr_suit1[3]*fwhat], g_hud_color, armoralpha, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
HUD_DrawNums(pl.armor, pos + [80, 0], armoralpha, g_hud_color);
|
||||
|
||||
oldarmor = pl.armor;
|
||||
}
|
||||
|
||||
void HUD_DrawAmmo1(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
vector pos;
|
||||
static int old_ammo1;
|
||||
static float ammo1_alpha;
|
||||
|
||||
if (pl.a_ammo1 != old_ammo1) {
|
||||
ammo1_alpha = 1.0;
|
||||
old_ammo1 = pl.a_ammo1;
|
||||
}
|
||||
|
||||
if (ammo1_alpha >= HUD_ALPHA) {
|
||||
ammo1_alpha -= frametime * 0.5;
|
||||
} else {
|
||||
ammo1_alpha = HUD_ALPHA;
|
||||
}
|
||||
|
||||
pos = video_mins + [video_res[0] - 48, video_res[1] - 42];
|
||||
|
||||
/* Magazine/Clip */
|
||||
if (pl.a_ammo1 != -1) {
|
||||
HUD_DrawNums(pl.a_ammo1, pos + [-80,0], ammo1_alpha, g_hud_color);
|
||||
}
|
||||
|
||||
HUD_DrawSeperator(pos + [-50,0]);
|
||||
}
|
||||
|
||||
void HUD_DrawAmmo2(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
vector pos;
|
||||
|
||||
static int old_ammo2;
|
||||
static float ammo2_alpha;
|
||||
|
||||
if (pl.a_ammo2 != old_ammo2) {
|
||||
ammo2_alpha = 1.0;
|
||||
old_ammo2 = pl.a_ammo2;
|
||||
}
|
||||
|
||||
if (ammo2_alpha >= HUD_ALPHA) {
|
||||
ammo2_alpha -= frametime * 0.5;
|
||||
} else {
|
||||
ammo2_alpha = HUD_ALPHA;
|
||||
}
|
||||
|
||||
pos = video_mins + [video_res[0] - 48, video_res[1] - 42];
|
||||
|
||||
/* Leftover Ammo */
|
||||
HUD_DrawNums(pl.a_ammo2, pos, ammo2_alpha, g_hud_color);
|
||||
}
|
||||
|
||||
void HUD_DrawAmmo3(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
vector pos;
|
||||
|
||||
static int old_ammo3;
|
||||
static float ammo3_alpha;
|
||||
|
||||
if (pl.a_ammo3 != old_ammo3) {
|
||||
ammo3_alpha = 1.0;
|
||||
old_ammo3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
if (ammo3_alpha >= HUD_ALPHA) {
|
||||
ammo3_alpha -= frametime * 0.5;
|
||||
} else {
|
||||
ammo3_alpha = HUD_ALPHA;
|
||||
}
|
||||
|
||||
pos = video_mins + [video_res[0] - 48, video_res[1] - 42];
|
||||
|
||||
/* Special */
|
||||
if (pl.a_ammo3) {
|
||||
HUD_DrawNums(pl.a_ammo3, pos + [0, -32], ammo3_alpha, g_hud_color);
|
||||
}
|
||||
}
|
||||
|
||||
void HUD_DrawFlashlight(void)
|
||||
{
|
||||
vector pos;
|
||||
|
@ -183,4 +277,11 @@ void HUD_Draw(void)
|
|||
HUD_DrawArmor();
|
||||
HUD_DrawFlashlight();
|
||||
Damage_Draw();
|
||||
Weapons_DrawCrosshair();
|
||||
HUD_DrawWeaponSelect();
|
||||
}
|
||||
|
||||
void VGUI_DrawSpectatorHUD(void)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
|
152
Source/client/valve/hud_weaponselect.c
Normal file
152
Source/client/valve/hud_weaponselect.c
Normal file
|
@ -0,0 +1,152 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
vector vHUDSlotNumPos[6] = {
|
||||
[168 / 255,72 / 128],
|
||||
[188 / 255,72 / 128],
|
||||
[208 / 255,72 / 128],
|
||||
[168 / 255,92 / 128],
|
||||
[188 / 255,92 / 128],
|
||||
[208 / 255,92 / 128]
|
||||
};
|
||||
|
||||
void HUD_DrawWeaponSelect_Forward(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (!pl.activeweapon) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pSeat->fHUDWeaponSelectTime < time) {
|
||||
pSeat->fHUDWeaponSelected = pl.activeweapon;
|
||||
sound(self, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
|
||||
} else {
|
||||
sound(self, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
|
||||
pSeat->fHUDWeaponSelected--;
|
||||
if (pSeat->fHUDWeaponSelected <= 0) {
|
||||
pSeat->fHUDWeaponSelected = g_weapons.length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
pSeat->fHUDWeaponSelectTime = time + 3;
|
||||
|
||||
if (!(pl.items & g_weapons[pSeat->fHUDWeaponSelected].id)) {
|
||||
HUD_DrawWeaponSelect_Forward();
|
||||
}
|
||||
}
|
||||
|
||||
void HUD_DrawWeaponSelect_Back(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (!pl.activeweapon) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pSeat->fHUDWeaponSelectTime < time) {
|
||||
pSeat->fHUDWeaponSelected = pl.activeweapon;
|
||||
sound(self, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE);
|
||||
} else {
|
||||
sound(self, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE);
|
||||
pSeat->fHUDWeaponSelected++;
|
||||
if (pSeat->fHUDWeaponSelected >= g_weapons.length) {
|
||||
pSeat->fHUDWeaponSelected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
pSeat->fHUDWeaponSelectTime = time + 3;
|
||||
|
||||
if (!(pl.items & g_weapons[pSeat->fHUDWeaponSelected].id)) {
|
||||
HUD_DrawWeaponSelect_Back();
|
||||
}
|
||||
}
|
||||
|
||||
void HUD_DrawWeaponSelect_Trigger(void)
|
||||
{
|
||||
sendevent("PlayerSwitchWeapon", "f", pSeat->fHUDWeaponSelected);
|
||||
sound(self, CHAN_ITEM, "common/wpn_select.wav", 0.5f, ATTN_NONE);
|
||||
pSeat->fHUDWeaponSelected = pSeat->fHUDWeaponSelectTime = 0;
|
||||
}
|
||||
|
||||
void HUD_DrawWeaponSelect_Last(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HUD_DrawWeaponSelect_Num(vector vPos, float fValue)
|
||||
{
|
||||
drawsubpic(vPos, [20,20], "sprites/640hud7.spr_0.tga", vHUDSlotNumPos[fValue], [20/255, 20/128], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
int Weapon_InSlotPos(int slot, int pos)
|
||||
{
|
||||
player pl = (player)self;
|
||||
for (int i = 1; i < g_weapons.length; i++) {
|
||||
if (g_weapons[i].slot == slot && g_weapons[i].slot_pos == pos) {
|
||||
if (pl.items & g_weapons[i].id) {
|
||||
return i;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void HUD_DrawWeaponSelect(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (!pl.activeweapon) {
|
||||
return;
|
||||
}
|
||||
if (pSeat->fHUDWeaponSelectTime < time) {
|
||||
if (pSeat->fHUDWeaponSelected) {
|
||||
sound(self, CHAN_ITEM, "common/wpn_hudoff.wav", 0.5, ATTN_NONE);
|
||||
pSeat->fHUDWeaponSelected = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
vector vSelectPos = video_mins + [16,16];
|
||||
|
||||
int wantslot = g_weapons[pSeat->fHUDWeaponSelected].slot;
|
||||
int wantpos = g_weapons[pSeat->fHUDWeaponSelected].slot_pos;
|
||||
int b;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int slot_selected = 0;
|
||||
vSelectPos[1] = video_mins[1] + 16;
|
||||
HUD_DrawWeaponSelect_Num(vSelectPos, i);
|
||||
vSelectPos[1] += 20;
|
||||
for (int x = 0; x < 32; x++) {
|
||||
if (i == wantslot) {
|
||||
slot_selected = TRUE;
|
||||
if (x == wantpos) {
|
||||
// Selected Sprite
|
||||
Weapons_HUDPic(pSeat->fHUDWeaponSelected, 1, vSelectPos);
|
||||
drawsubpic(vSelectPos, [170,45], "sprites/640hud3.spr_0.tga",
|
||||
[0,180/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
vSelectPos[1] += 50;
|
||||
} else if ((b=Weapon_InSlotPos(i, x)) != -1) {
|
||||
// Unselected Sprite
|
||||
Weapons_HUDPic(b, 0, vSelectPos);
|
||||
vSelectPos[1] += 50;
|
||||
}
|
||||
} else if (Weapon_InSlotPos(i, x) != -1) {
|
||||
HUD_DrawWeaponSelect_Num(vSelectPos, 5);
|
||||
vSelectPos[1] += 25;
|
||||
}
|
||||
}
|
||||
|
||||
if (slot_selected == TRUE) {
|
||||
vSelectPos[0] += 175;
|
||||
} else {
|
||||
vSelectPos[0] += 25;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,5 +15,10 @@ Comparable to worldspawn in SSQC in that it's mostly used for precaches
|
|||
*/
|
||||
void Client_Init(float apilevel, string enginename, float engineversion)
|
||||
{
|
||||
|
||||
precache_model("sprites/640hud1.spr");
|
||||
precache_model("sprites/640hud2.spr");
|
||||
precache_model("sprites/640hud3.spr");
|
||||
precache_model("sprites/640hud4.spr");
|
||||
precache_model("sprites/640hud5.spr");
|
||||
precache_model("sprites/640hud6.spr");
|
||||
}
|
||||
|
|
20
Source/client/valve/input.c
Normal file
20
Source/client/valve/input.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
void Game_Input(void)
|
||||
{
|
||||
if (input_buttons & INPUT_BUTTON0) {
|
||||
Weapons_Primary();
|
||||
} else if (input_buttons & INPUT_BUTTON4) {
|
||||
Weapons_Reload();
|
||||
} else if (input_buttons & INPUT_BUTTON3) {
|
||||
Weapons_Secondary();
|
||||
} else {
|
||||
Weapons_Release();
|
||||
}
|
||||
}
|
47
Source/client/valve/player.c
Normal file
47
Source/client/valve/player.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
void Player_ReadEntity(float flIsNew)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if ( flIsNew == TRUE ) {
|
||||
spawnfunc_player();
|
||||
|
||||
pl.classname = "player";
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.drawmask = MASK_ENGINE;
|
||||
pl.customphysics = Empty;
|
||||
setsize( pl, VEC_HULL_MIN, VEC_HULL_MAX );
|
||||
}
|
||||
|
||||
pl.modelindex = readshort();
|
||||
pl.origin[0] = readcoord();
|
||||
pl.origin[1] = readcoord();
|
||||
pl.origin[2] = readcoord();
|
||||
pl.pitch = readcoord() / 90;
|
||||
pl.angles[1] = readcoord();
|
||||
pl.angles[2] = readcoord();
|
||||
pl.velocity[0] = readcoord();
|
||||
pl.velocity[1] = readcoord();
|
||||
pl.velocity[2] = readcoord();
|
||||
pl.flags = readfloat();
|
||||
pl.activeweapon = readbyte();
|
||||
pl.items = readfloat();
|
||||
pl.health = readbyte();
|
||||
pl.armor = readbyte();
|
||||
pl.movetype = readfloat();
|
||||
pl.view_ofs[2] = readfloat();
|
||||
pl.viewzoom = readfloat();
|
||||
pl.a_ammo1 = readbyte();
|
||||
pl.a_ammo2 = readbyte();
|
||||
pl.a_ammo3 = readbyte();
|
||||
pl.w_attack_next = readfloat();
|
||||
pl.w_idle_next = readfloat();
|
||||
setorigin( pl, pl.origin );
|
||||
}
|
|
@ -8,29 +8,18 @@
|
|||
|
||||
void View_UpdateWeapon(entity vm, entity mflash)
|
||||
{
|
||||
/*if( aw < CS_WEAPON_COUNT ) {
|
||||
if ( pSeat->fLastWeapon != aw ) {
|
||||
pSeat->fLastWeapon = aw;
|
||||
if ( aw >= 1 ) {
|
||||
string wm;
|
||||
if (autocvar_skins_dir != "") {
|
||||
wm = sprintf("skins/%s/%s", autocvar_skins_dir, sViewModels[ aw - 1 ]);
|
||||
} else {
|
||||
wm = sprintf("models/%s", sViewModels[ aw - 1 ]);
|
||||
}
|
||||
setmodel( eViewModel, wm );
|
||||
player pl = (player)self;
|
||||
|
||||
if (pSeat->fLastWeapon != pl.activeweapon) {
|
||||
pSeat->fLastWeapon = pl.activeweapon;
|
||||
if (pl.activeweapon) {
|
||||
setmodel(vm, g_weapons[pl.activeweapon].vmodel());
|
||||
|
||||
if (getstati_punf(STAT_TEAM) == TEAM_CT) {
|
||||
setcustomskin(eViewModel, "", "geomset 0 2\n");
|
||||
} else {
|
||||
setcustomskin(eViewModel, "", "geomset 0 1\n");
|
||||
}
|
||||
|
||||
skel_delete( eMuzzleflash.skeletonindex );
|
||||
eMuzzleflash.skeletonindex = skel_create( eViewModel.modelindex );
|
||||
pSeat->fNumBones = skel_get_numbones( eMuzzleflash.skeletonindex ) + 1;
|
||||
pSeat->fEjectBone = pSeat->fNumBones + 1;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
skel_delete( mflash.skeletonindex );
|
||||
mflash.skeletonindex = skel_create( vm.modelindex );
|
||||
pSeat->fNumBones = skel_get_numbones( mflash.skeletonindex ) + 1;
|
||||
pSeat->fEjectBone = pSeat->fNumBones + 1;
|
||||
}
|
||||
Weapons_Draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,19 @@ void View_Init(void)
|
|||
precache_model(wm);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int s = seats.length; s-- > numclientseats;) {
|
||||
pSeat = &seats[s];
|
||||
if( !pSeat->eViewModel ) {
|
||||
pSeat->eViewModel = spawn();
|
||||
pSeat->eViewModel.classname = "vm";
|
||||
pSeat->eViewModel.renderflags = RF_DEPTHHACK;
|
||||
|
||||
pSeat->eMuzzleflash = spawn();
|
||||
pSeat->eMuzzleflash.classname = "mflash";
|
||||
pSeat->eMuzzleflash.renderflags = RF_ADDITIVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void View_CalcViewport(int s, float fWinWidth, float fWinHeight) {
|
||||
|
@ -97,7 +110,7 @@ Gives the angle a bit of an offset/punch/kick
|
|||
*/
|
||||
void View_AddPunchAngle( vector add )
|
||||
{
|
||||
pSeat->vPunchAngle += add;
|
||||
pSeat->vPunchAngle /*+*/= add;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -110,19 +123,12 @@ muzzleflash, dynamic lights and so on appear
|
|||
*/
|
||||
void View_DrawViewModel( void )
|
||||
{
|
||||
if( !pSeat->eViewModel ) {
|
||||
pSeat->eViewModel = spawn();
|
||||
pSeat->eViewModel.classname = "vm";
|
||||
pSeat->eViewModel.renderflags = RF_VIEWMODEL | RF_DEPTHHACK;
|
||||
|
||||
pSeat->eMuzzleflash = spawn();
|
||||
pSeat->eMuzzleflash.classname = "mflash";
|
||||
pSeat->eMuzzleflash.renderflags = RF_VIEWMODEL | RF_ADDITIVE;
|
||||
}
|
||||
entity eViewModel = pSeat->eViewModel;
|
||||
entity eMuzzleflash = pSeat->eMuzzleflash;
|
||||
|
||||
player pl = (player) self;
|
||||
|
||||
if ( getstatf( STAT_HEALTH ) <= 0 ) {
|
||||
if ( pl.health <= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,8 +142,10 @@ void View_DrawViewModel( void )
|
|||
processmodelevents( eViewModel.modelindex, eViewModel.frame, fBaseTime, eViewModel.frame1time, Event_ProcessModel );
|
||||
}
|
||||
|
||||
makevectors( '0 0 0');
|
||||
eViewModel.origin = '0 0 -1' + ( v_forward * ( pSeat->fBob * 0.4 ) )
|
||||
makevectors(view_angles);
|
||||
eViewModel.angles = view_angles;
|
||||
eViewModel.origin = pSeat->vPlayerOrigin + pl.view_ofs;
|
||||
eViewModel.origin += '0 0 -1' + ( v_forward * ( pSeat->fBob * 0.4 ) )
|
||||
+ ( v_forward * autocvar_v_gunofs[0] )
|
||||
+ ( v_right * autocvar_v_gunofs[1] )
|
||||
+ ( v_up * autocvar_v_gunofs[2] );
|
||||
|
@ -160,7 +168,7 @@ void View_DrawViewModel( void )
|
|||
}
|
||||
|
||||
// Only bother when zoomed out
|
||||
if ( getstatf( STAT_VIEWZOOM ) == 1.0f ) {
|
||||
if ( pl.viewzoom == 1.0f ) {
|
||||
// Update muzzleflash position and draw it
|
||||
if ( eMuzzleflash.alpha > 0.0f ) {
|
||||
makevectors(getproperty(VF_ANGLES));
|
||||
|
|
|
@ -12,8 +12,15 @@ const vector VEC_HULL_MAX = '16 16 36';
|
|||
const vector VEC_CHULL_MIN = '-16 -16 -18';
|
||||
const vector VEC_CHULL_MAX = '16 16 18';
|
||||
|
||||
#ifdef CSTRIKE
|
||||
const vector VEC_PLAYER_VIEWPOS = '0 0 20';
|
||||
const vector VEC_PLAYER_CVIEWPOS = '0 0 12';
|
||||
#endif
|
||||
|
||||
#ifdef VALVE
|
||||
const vector VEC_PLAYER_VIEWPOS = '0 0 24';
|
||||
const vector VEC_PLAYER_CVIEWPOS = '0 0 12';
|
||||
#endif
|
||||
|
||||
// Actually used by input_button etc.
|
||||
#define INPUT_BUTTON0 1
|
||||
|
|
|
@ -19,6 +19,9 @@ enum {
|
|||
EV_CHAT,
|
||||
EV_CHAT_TEAM,
|
||||
EV_CHAT_VOX,
|
||||
#ifdef VALVE
|
||||
EV_VIEWMODEL,
|
||||
#endif
|
||||
#ifdef CSTRIKE
|
||||
EV_RADIOMSG,
|
||||
EV_RADIOMSG2,
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
../gs-entbase/server/item_food.cpp
|
||||
../gs-entbase/server/item_suit.cpp
|
||||
../gs-entbase/server/path_corner.cpp
|
||||
../gs-entbase/server/path_track.cpp
|
||||
../gs-entbase/server/multi_manager.cpp
|
||||
../gs-entbase/server/monster_furniture.cpp
|
||||
../gs-entbase/server/monster_generic.cpp
|
||||
|
|
|
@ -89,9 +89,9 @@ void CBaseEntity::RendermodeUpdate(void)
|
|||
alpha = bound(0.001, ( m_renderamt / 255 ), 1.0);
|
||||
|
||||
if ( m_rendermode == RM_ADDITIVE ) {
|
||||
effects = EF_ADDITIVE; // QWSSQC: EF_FLAG2
|
||||
effects = EF_FLAG2; // SSQC: EF_ADDITIVE
|
||||
} else if ( m_rendermode == RM_GLOW ) {
|
||||
effects = EF_ADDITIVE | EF_FULLBRIGHT;
|
||||
effects = EF_FLAG2 | EF_FULLBRIGHT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void CBaseTrigger :: InitBrushTrigger ( void )
|
|||
setmodel( this, model );
|
||||
#ifdef GS_DEVELOPER
|
||||
alpha = 0.5f;
|
||||
effects = EF_ADDITIVE;
|
||||
effects = EF_FLAG2;
|
||||
#else
|
||||
modelindex = 0;
|
||||
model = "";
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
****/
|
||||
|
||||
//#define GS_DEVELOPER
|
||||
#define GS_DEVELOPER
|
||||
|
||||
.float gflags;
|
||||
|
||||
|
|
|
@ -209,10 +209,8 @@ void func_door_rotating::Touch(void)
|
|||
}
|
||||
|
||||
if (other.movetype == MOVETYPE_WALK) {
|
||||
if (other.absmin[2] <= maxs[2] - 2) {
|
||||
eActivator = other;
|
||||
Trigger();
|
||||
}
|
||||
eActivator = other;
|
||||
Trigger();
|
||||
}
|
||||
touch = __NULL__;
|
||||
}
|
||||
|
|
|
@ -64,9 +64,9 @@ void func_ladder :: func_ladder ( void )
|
|||
|
||||
#ifdef GS_DEVELOPER
|
||||
alpha = 0.5f;
|
||||
effects = EF_ADDITIVE;
|
||||
effects = EF_FLAG2;
|
||||
#else
|
||||
alpha = 0.0001f;
|
||||
effects = EF_NODRAW;
|
||||
//effects = EF_NODRAW;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -27,3 +27,5 @@ void func_wall :: Trigger ( void )
|
|||
frame = 1 - frame;
|
||||
}
|
||||
|
||||
CLASSEXPORT(func_tracktrain, func_wall)
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ void infodecal(void)
|
|||
self.texture = sprintf( "materials/%s", self.texture );
|
||||
}
|
||||
|
||||
self.texture = "";
|
||||
if (!self.texture) {
|
||||
remove(self);
|
||||
return;
|
||||
|
|
22
Source/gs-entbase/server/path_track.cpp
Normal file
22
Source/gs-entbase/server/path_track.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
class path_track:CBaseTrigger
|
||||
{
|
||||
float m_flSpeed;
|
||||
float m_flWait;
|
||||
|
||||
void() path_track;
|
||||
};
|
||||
|
||||
void path_track::path_track(void)
|
||||
{
|
||||
CBaseTrigger::CBaseTrigger();
|
||||
m_flSpeed = 100;
|
||||
m_flWait = 1.0f;
|
||||
}
|
|
@ -60,9 +60,10 @@ void trigger_push :: touch ( void )
|
|||
if ( other.solid != SOLID_NOT && other.solid != SOLID_BSP ) {
|
||||
if ( spawnflags & TP_ONCE ) {
|
||||
other.velocity = other.velocity + (m_flSpeed * m_vecMoveDir);
|
||||
if ( other.velocity[2] > 0 )
|
||||
if ( other.velocity[2] > 0 ) {
|
||||
other.flags &= ~FL_ONGROUND;
|
||||
remove( self );
|
||||
}
|
||||
Hide();
|
||||
} else {
|
||||
/*vector vecPush = m_flSpeed * m_vecMoveDir;
|
||||
if ( other.flags & FL_BASEVELOCITY ) {
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
|
||||
#define MATH_PI 3.1415926
|
||||
|
||||
float Math_Time(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
return 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
float Math_LerpAngle( float fStart, float fEnd, float fAmount ) {
|
||||
float shortest_angle = ( ( ( ( fEnd - fStart ) % 360 ) + 540 ) % 360 ) - 180;
|
||||
return shortest_angle * fAmount;
|
||||
|
@ -53,10 +62,6 @@ float Math_CRandom( void ) {
|
|||
}
|
||||
|
||||
#if defined(SSQC) || defined(CSQC)
|
||||
#ifdef SSQC
|
||||
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos, int iSkipArmor );
|
||||
#endif
|
||||
|
||||
//.vector basevelocity;
|
||||
int QPhysics_IsStuck( entity eTarget, vector vOffset, vector vecMins, vector vecMaxs )
|
||||
{
|
||||
|
|
|
@ -25,6 +25,8 @@ void m_init(void)
|
|||
localcmd("con_textsize -12\n");
|
||||
localcmd("scr_conalpha 1\n");
|
||||
localcmd("cl_idlefps 0\n");
|
||||
localcmd("gl_mindist 4\n"); // Thanks Valve for v_shotgun.mdl
|
||||
localcmd("_pext_infoblobs 1\n");
|
||||
|
||||
/* Hack! */
|
||||
localcmd("gl_font 0\n");
|
||||
|
|
|
@ -163,6 +163,7 @@ void games_init(void)
|
|||
CWidget fn_customgame;
|
||||
CFrame customgame_frMods;
|
||||
CModList customgame_lbMods;
|
||||
CScrollbar customgame_sbMods;
|
||||
|
||||
CMainButton customgame_btnActivate;
|
||||
CMainButton customgame_btnInstall;
|
||||
|
@ -177,7 +178,7 @@ void customgame_btnactivate_start(void)
|
|||
|
||||
gameinfo_current = nextgame;
|
||||
localcmd(sprintf("gamedir \"%s\"\n", games[nextgame].gamedir));
|
||||
localcmd("snd_restart\nwait\nmenu_restart\nmenu_customgame\n");
|
||||
localcmd("snd_restart\nwait\nvid_reload\nmenu_restart\nmenu_customgame\n");
|
||||
// TODO: Re-init important menu bits and bobs.
|
||||
|
||||
//m_shutdown();
|
||||
|
@ -186,7 +187,7 @@ void customgame_btnactivate_start(void)
|
|||
void customgame_btndeactivate_start(void)
|
||||
{
|
||||
localcmd("gamedir \"\"\n");
|
||||
localcmd("snd_restart\nwait\nmenu_restart\nmenu_customgame\n");
|
||||
localcmd("snd_restart\nwait\nvid_reload\nmenu_restart\nmenu_customgame\n");
|
||||
}
|
||||
|
||||
void customgame_btndone_start(void)
|
||||
|
@ -202,6 +203,10 @@ void customgame_btndone_start(void)
|
|||
header.SetHeader(HEAD_CUSTOM);
|
||||
header.SetExecute(customgame_btndone_end);
|
||||
}
|
||||
void customgame_sbmods_changed(int val)
|
||||
{
|
||||
customgame_lbMods.SetScroll(val);
|
||||
}
|
||||
|
||||
void menu_customgame_init(void)
|
||||
{
|
||||
|
@ -249,8 +254,15 @@ void menu_customgame_init(void)
|
|||
customgame_lbMods.SetPos(144,159);
|
||||
customgame_lbMods.SetSize(457,283);
|
||||
Widget_Add(fn_customgame, customgame_lbMods);
|
||||
|
||||
customgame_sbMods = spawn(CScrollbar);
|
||||
customgame_sbMods.SetPos(141+463,156);
|
||||
customgame_sbMods.SetItemheight(29);
|
||||
customgame_sbMods.SetHeight(289);
|
||||
customgame_sbMods.SetCallback(customgame_sbmods_changed);
|
||||
customgame_sbMods.SetMax(gameinfo_count);
|
||||
Widget_Add(fn_customgame, customgame_sbMods);
|
||||
|
||||
//customgame_lbMods.SetMax(gameinfo_count);
|
||||
}
|
||||
|
||||
void menu_customgame_draw(void)
|
||||
|
@ -258,21 +270,21 @@ void menu_customgame_draw(void)
|
|||
drawpic([g_menuofs[0]+45,g_menuofs[1]+45], g_bmp[HEAD_CUSTOM],[460,80], [1,1,1], 1.0f, 1);
|
||||
Widget_Draw(fn_customgame);
|
||||
|
||||
WLabel_Static(g_menuofs[0] + 155, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_TYPE], 11, 11, [1,1,1],
|
||||
WLabel_Static(155, 143, m_reslbl[IDS_MODLIST_TYPE], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 201, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_NAME], 11, 11, [1,1,1],
|
||||
WLabel_Static(201, 143, m_reslbl[IDS_MODLIST_NAME], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 321, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_VERSION], 11, 11, [1,1,1],
|
||||
WLabel_Static(321, 143, m_reslbl[IDS_MODLIST_VERSION], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 371, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_SIZE], 11, 11, [1,1,1],
|
||||
WLabel_Static(371, 143, m_reslbl[IDS_MODLIST_SIZE], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 421, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_RATING], 11, 11, [1,1,1],
|
||||
WLabel_Static(421, 143, m_reslbl[IDS_MODLIST_RATING], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 471, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_INSTALLED], 11, 11, [1,1,1],
|
||||
WLabel_Static(471, 143, m_reslbl[IDS_MODLIST_INSTALLED], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 521, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_SERVERS], 11, 11, [1,1,1],
|
||||
WLabel_Static(521, 143, m_reslbl[IDS_MODLIST_SERVERS], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 571, g_menuofs[1] + 143, m_reslbl[IDS_MODLIST_PLAYERS], 11, 11, [1,1,1],
|
||||
WLabel_Static(571, 143, m_reslbl[IDS_MODLIST_PLAYERS], 11, 11, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
}
|
||||
|
||||
|
|
|
@ -165,15 +165,15 @@ void menu_internetgames_draw(void)
|
|||
drawpic([g_menuofs[0]+45,g_menuofs[1]+45], g_bmp[HEAD_INETGAMES],[460,80], [1,1,1], 1.0f, 1);
|
||||
|
||||
/* Labels */
|
||||
WLabel_Static(g_menuofs[0] + 252, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_GAMESERVER], 10, 10, [1,1,1],
|
||||
WLabel_Static(252, 128, m_reslbl[IDS_SERVER_GAMESERVER], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 357, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_SPEED], 10, 10, [1,1,1],
|
||||
WLabel_Static(357, 128, m_reslbl[IDS_SERVER_SPEED], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 407, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_MAP], 10, 10, [1,1,1],
|
||||
WLabel_Static(407, 128, m_reslbl[IDS_SERVER_MAP], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 476, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_GAME], 10, 10, [1,1,1],
|
||||
WLabel_Static(476, 128, m_reslbl[IDS_SERVER_GAME], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 552, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_PLAYERS], 10, 10, [1,1,1],
|
||||
WLabel_Static(552, 128, m_reslbl[IDS_SERVER_PLAYERS], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
}
|
||||
|
||||
|
|
|
@ -135,15 +135,15 @@ void menu_langames_draw(void)
|
|||
drawpic([g_menuofs[0]+45,g_menuofs[1]+45], g_bmp[HEAD_LAN],[460,80], [1,1,1], 1.0f, 1);
|
||||
|
||||
/* Labels */
|
||||
WLabel_Static(g_menuofs[0] + 282, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_GAMESERVER], 10, 10, [1,1,1],
|
||||
WLabel_Static(282, 128, m_reslbl[IDS_SERVER_GAMESERVER], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 377, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_SPEED], 10, 10, [1,1,1],
|
||||
WLabel_Static(377, 128, m_reslbl[IDS_SERVER_SPEED], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 422, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_MAP], 10, 10, [1,1,1],
|
||||
WLabel_Static(422, 128, m_reslbl[IDS_SERVER_MAP], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 497, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_GAME], 10, 10, [1,1,1],
|
||||
WLabel_Static(497, 128, m_reslbl[IDS_SERVER_GAME], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
WLabel_Static(g_menuofs[0] + 572, g_menuofs[1] + 128, m_reslbl[IDS_SERVER_PLAYERS], 10, 10, [1,1,1],
|
||||
WLabel_Static(572, 128, m_reslbl[IDS_SERVER_PLAYERS], 10, 10, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,14 +55,15 @@ void CModList::Draw(void)
|
|||
}
|
||||
if (m_selected == i) {
|
||||
colo = ML_COL_2;
|
||||
drawfill([g_menuofs[0] + m_x, pos], [m_size[0], 29],
|
||||
drawfill([g_menuofs[0] + m_x, g_menuofs[1] + pos
|
||||
], [m_size[0], 29],
|
||||
[84/255,45/255,0], 1.0f);
|
||||
} else {
|
||||
colo = ML_COL_1;
|
||||
}
|
||||
|
||||
if (games[i].type != "") {
|
||||
WLabel_Static(m_x + 2, pos + 3, sprintf("%.8s...",games[i].type),
|
||||
WLabel_Static(m_x + 2, m_y + 3, sprintf("%.8s...",games[i].type),
|
||||
11, 11, colo, 1.0f, 0, font_arial);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ class CScrollbar:CWidget
|
|||
int m_scroll;
|
||||
int m_minus;
|
||||
int m_max;
|
||||
float m_itemheight;
|
||||
virtual void(int value) m_changed = 0;
|
||||
|
||||
int m_up_hover;
|
||||
|
@ -30,6 +31,7 @@ class CScrollbar:CWidget
|
|||
virtual void(int val) SetScroll;
|
||||
virtual void(int val) SetMax;
|
||||
virtual void(int val) SetHeight;
|
||||
virtual void(int val) SetItemheight;
|
||||
virtual void(void(int val) vFunc) SetCallback;
|
||||
};
|
||||
|
||||
|
@ -37,6 +39,7 @@ void CScrollbar::CScrollbar(void)
|
|||
{
|
||||
/* There's the physical length (t_length) and the actual length
|
||||
* (border, etc. ignored) */
|
||||
SetItemheight(15);
|
||||
SetHeight(128);
|
||||
}
|
||||
|
||||
|
@ -67,8 +70,8 @@ void CScrollbar::Draw(void)
|
|||
[16,16], [1,1,1], 1.0f, 0);
|
||||
}
|
||||
|
||||
barheight = m_theight * (m_theight / (m_max * 15));
|
||||
barstep = (m_scroll * 15) * (m_theight / (m_max * 15));
|
||||
barheight = m_theight * (m_theight / (m_max * m_itemheight));
|
||||
barstep = (m_scroll * m_itemheight) * (m_theight / (m_max * m_itemheight));
|
||||
|
||||
if (!m_hold) {
|
||||
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y+16], [16,m_theight], [0.25,0.25,0.25], 1.0f);
|
||||
|
@ -118,8 +121,8 @@ void CScrollbar::Input(float type, float x, float y, float devid)
|
|||
SetScroll(m_scroll + 1);
|
||||
}
|
||||
|
||||
barheight = m_theight * (m_theight / (m_max * 15));
|
||||
barstep = (m_scroll * 15) * (m_theight / (m_max * 15));
|
||||
barheight = m_theight * (m_theight / (m_max * m_itemheight));
|
||||
barstep = (m_scroll * m_itemheight) * (m_theight / (m_max * m_itemheight));
|
||||
|
||||
if (Util_CheckMouse(m_x, m_y + 16 + barstep, 16, barheight)) {
|
||||
m_hover = TRUE;
|
||||
|
@ -164,7 +167,7 @@ void CScrollbar::SetScroll(int val)
|
|||
|
||||
void CScrollbar::SetMax(int val)
|
||||
{
|
||||
m_minus = (m_height - 6) / 15;
|
||||
m_minus = (m_height - 6) / m_itemheight;
|
||||
m_max = val - m_minus;
|
||||
}
|
||||
|
||||
|
@ -174,6 +177,11 @@ void CScrollbar::SetHeight(int val)
|
|||
m_theight = m_height - 32;
|
||||
}
|
||||
|
||||
void CScrollbar::SetItemheight(int val)
|
||||
{
|
||||
m_itemheight = val;
|
||||
}
|
||||
|
||||
void CScrollbar::SetCallback(void(int val) vFunc)
|
||||
{
|
||||
m_changed = vFunc;
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
*
|
||||
****/
|
||||
|
||||
void Client_TriggerCamera( entity eTarget, vector vPos, vector vEndPos, float fResetTime )
|
||||
void Client_TriggerCamera(entity target, vector pos, vector end, float wait)
|
||||
{
|
||||
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
|
||||
WriteByte( MSG_MULTICAST, EV_CAMERATRIGGER );
|
||||
WriteCoord( MSG_MULTICAST, vPos_x );
|
||||
WriteCoord( MSG_MULTICAST, vPos_y );
|
||||
WriteCoord( MSG_MULTICAST, vPos_z );
|
||||
WriteCoord( MSG_MULTICAST, vEndPos_x );
|
||||
WriteCoord( MSG_MULTICAST, vEndPos_y );
|
||||
WriteCoord( MSG_MULTICAST, vEndPos_z );
|
||||
WriteFloat( MSG_MULTICAST, fResetTime );
|
||||
msg_entity = eTarget;
|
||||
multicast( '0 0 0', MULTICAST_ONE );
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CAMERATRIGGER);
|
||||
WriteCoord(MSG_MULTICAST, pos[0]);
|
||||
WriteCoord(MSG_MULTICAST, pos[1]);
|
||||
WriteCoord(MSG_MULTICAST, pos[2]);
|
||||
WriteCoord(MSG_MULTICAST, end[0]);
|
||||
WriteCoord(MSG_MULTICAST, end[1]);
|
||||
WriteCoord(MSG_MULTICAST, end[2]);
|
||||
WriteFloat(MSG_MULTICAST, wait);
|
||||
msg_entity = target;
|
||||
multicast([0,0,0], MULTICAST_ONE);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#pragma target fte
|
||||
#pragma progs_dat "../../cstrike/progs.dat"
|
||||
|
||||
#define SSQC
|
||||
#define QWSSQC
|
||||
#define CSTRIKE
|
||||
|
||||
#includelist
|
||||
../builtins.h
|
||||
../defs.h
|
||||
cstrike/defs.h
|
||||
../shared/cstrike/defs.h
|
||||
../math.h
|
||||
../materials.h
|
||||
../events.h
|
||||
../entities.h
|
||||
defs.h
|
||||
cstrike/defs.h
|
||||
cstrike/defsfields.h
|
||||
|
||||
../gs-entbase/server.src
|
||||
|
@ -65,8 +65,8 @@ cstrike/info_map_parameters.cpp
|
|||
|
||||
vox.c
|
||||
cstrike/ammo.c
|
||||
damage.c
|
||||
cstrike/traceattack.c
|
||||
cstrike/damage.c
|
||||
traceattack.c
|
||||
cstrike/rules.c
|
||||
cstrike/timer.c
|
||||
|
||||
|
|
|
@ -190,8 +190,6 @@ void Game_RunClientCommand( void ) {
|
|||
self.fInVIPZone = FALSE;
|
||||
|
||||
QPhysics_Run( self );
|
||||
|
||||
Input_Handle();
|
||||
}
|
||||
|
||||
void Game_SetNewParms(void)
|
||||
|
|
|
@ -23,7 +23,7 @@ void Damage_CastOrbituary( entity eAttacker, entity eTarget, float fWeapon, floa
|
|||
WriteByte( MSG_BROADCAST, fWeapon );
|
||||
WriteByte( MSG_BROADCAST, fHeadShot );
|
||||
msg_entity = self;
|
||||
multicast( '0 0 0', MULTICAST_ALL );
|
||||
multicast( [0,0,0], MULTICAST_ALL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -86,7 +86,7 @@ Damage_Apply
|
|||
Generic function that applies damage, pain and suffering
|
||||
=================
|
||||
*/
|
||||
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos, int iSkipArmor ) {
|
||||
void Damage_Apply( entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor ) {
|
||||
#ifdef CSTRIKE
|
||||
// Modify the damage based on the location
|
||||
if ( trace_surface_id == BODY_HEAD ) {
|
|
@ -106,8 +106,6 @@ void Effect_CreateFlash(entity targ);
|
|||
void BaseMelee_Draw( void );
|
||||
int BaseMelee_Attack( void );
|
||||
|
||||
void TraceAttack_FireBullets( int iShots, vector vPos );
|
||||
|
||||
void Ammo_AutoFill(float fWeapon);
|
||||
void Ammo_BuyPrimary(void);
|
||||
void Ammo_BuySecondary(void);
|
||||
|
@ -117,4 +115,6 @@ void Input_Handle( void );
|
|||
void Animation_PlayerTop( float fFrame );
|
||||
void Animation_PlayerTopTemp( float fFrame, float fTime );
|
||||
|
||||
void Damage_Apply( entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor );
|
||||
|
||||
#define NULL __NULL__
|
||||
|
|
|
@ -35,8 +35,8 @@ void Input_Handle( void ) {
|
|||
Weapon_Switch( SLOT_PRIMARY );
|
||||
} else if ( self.impulse == 4 ) {
|
||||
Weapon_Switch( SLOT_GRENADE );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( self.button5 ) {
|
||||
Player_UseDown();
|
||||
} else {
|
||||
|
|
|
@ -13,8 +13,10 @@ void Effect_Impact( int iType, vector vPos, vector vNormal );
|
|||
void Effect_CreateExplosion( vector vPos );
|
||||
void Footsteps_Update( void );
|
||||
|
||||
|
||||
void TraceAttack_FireBullets( int iShots, vector vPos );
|
||||
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip );
|
||||
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos, int iSkipArmor );
|
||||
void Damage_Apply( entity eTarget, entity eAttacker, float fDamage, vector vHitPos, int iSkipArmor );
|
||||
void Client_TriggerCamera( entity eTarget, vector vPos, vector vEndPos, float fResetTime );
|
||||
|
||||
entity eActivator;
|
||||
|
|
|
@ -51,6 +51,7 @@ void PutClientInServer(void)
|
|||
void PlayerPreThink(void)
|
||||
{
|
||||
Game_PlayerPreThink();
|
||||
Input_Handle();
|
||||
}
|
||||
|
||||
void PlayerPostThink(void)
|
||||
|
|
70
Source/server/spawn.c
Normal file
70
Source/server/spawn.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
float Spawn_PlayerRange(entity spot) {
|
||||
entity pl;
|
||||
float bestdist;
|
||||
float dist;
|
||||
|
||||
bestdist = 9999999;
|
||||
|
||||
for (pl = world; (pl = find(pl, classname, "player"));) {
|
||||
if (pl->health <= 0) {
|
||||
continue;
|
||||
}
|
||||
dist = vlen(spot.origin - pl.origin);
|
||||
if (dist < bestdist) {
|
||||
bestdist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return bestdist;
|
||||
}
|
||||
|
||||
entity Spawn_SelectRandom(string cname)
|
||||
{
|
||||
static entity lastspot;
|
||||
entity spot = lastspot;
|
||||
|
||||
for (int i = random(1, 5); i > 0; i--) {
|
||||
spot = find(spot, classname, cname);
|
||||
}
|
||||
|
||||
if (spot == __NULL__) {
|
||||
spot = find(spot, classname, cname);
|
||||
}
|
||||
|
||||
entity eFirstSpot = spot;
|
||||
do {
|
||||
if (spot) {
|
||||
if (Spawn_PlayerRange(spot) > 128) {
|
||||
if (spot.origin == [0,0,0]) {
|
||||
spot = find(spot, classname, cname);
|
||||
continue;
|
||||
}
|
||||
lastspot = spot;
|
||||
return spot;
|
||||
}
|
||||
}
|
||||
spot = find(spot, classname, cname);
|
||||
} while (spot != eFirstSpot);
|
||||
|
||||
if (!spot) {
|
||||
lastspot = spot;
|
||||
return spot;
|
||||
}
|
||||
|
||||
// We still haven't found one
|
||||
if (spot == __NULL__) {
|
||||
error(sprintf("Spawn_SelectRandom: no %s on level", cname));
|
||||
return world;
|
||||
}
|
||||
|
||||
lastspot = spot;
|
||||
return spot;
|
||||
}
|
|
@ -24,11 +24,18 @@ void TraceAttack_FireSingle( vector vPos, vector vAngle ) {
|
|||
TraceAttack_FireSingle( vPos, vAngle );
|
||||
iTotalPenetrations = 1;
|
||||
}
|
||||
|
||||
#ifdef CSTRIKE
|
||||
traceline( vPos, vPos + ( vAngle * wptTable[ self.weapon ].fRange ), MOVE_HITMODEL, self);
|
||||
|
||||
#else
|
||||
traceline( vPos, vPos + ( vAngle * 8196 ), MOVE_HITMODEL, self);
|
||||
#endif
|
||||
|
||||
if (trace_fraction != 1.0) {
|
||||
if ( trace_ent.takedamage == DAMAGE_YES ) {
|
||||
#ifdef CSTRIKE
|
||||
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( trace_ent.iBleeds == TRUE ) {
|
||||
|
@ -75,18 +82,25 @@ void TraceAttack_FireSingleLagged( vector vPos, vector vAngle ) {
|
|||
TraceAttack_FireSingle( vPos, vAngle );
|
||||
iTotalPenetrations = 1;
|
||||
}
|
||||
|
||||
#ifdef CSTRIKE
|
||||
traceline( vPos, vPos + ( vAngle * wptTable[ self.weapon ].fRange ), MOVE_LAGGED | MOVE_HITMODEL, self);
|
||||
|
||||
#else
|
||||
traceline( vPos, vPos + ( vAngle * 8196 ), MOVE_LAGGED | MOVE_HITMODEL, self);
|
||||
#endif
|
||||
|
||||
if (trace_fraction != 1.0) {
|
||||
if ( trace_ent.takedamage == DAMAGE_YES ) {
|
||||
#ifdef CSTRIKE
|
||||
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if ( trace_ent.iBleeds == TRUE ) {
|
||||
Effect_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal );
|
||||
} else {
|
||||
string sTexture = getsurfacetexture( trace_ent, getsurfacenearpoint( trace_ent, trace_endpos ) );
|
||||
|
||||
|
||||
switch( (float)hash_get( hashMaterials, sTexture ) ) {
|
||||
case 'G':
|
||||
case 'V':
|
||||
|
@ -128,14 +142,16 @@ Fire a given amount of shots
|
|||
void TraceAttack_FireBullets( int iShots, vector vPos ) {
|
||||
vector vDir;
|
||||
makevectors(self.v_angle);
|
||||
|
||||
|
||||
while ( iShots > 0 ) {
|
||||
iTotalPenetrations = 0;
|
||||
#ifdef CSTRIKE
|
||||
vDir = aim( self, 100000 ) + Math_CRandom()*self.fAccuracy*v_right + Math_CRandom()*self.fAccuracy*v_up;
|
||||
#else
|
||||
vDir = aim( self, 100000 );
|
||||
#endif
|
||||
TraceAttack_FireSingle( vPos, vDir );
|
||||
TraceAttack_FireSingleLagged( vPos, vDir );
|
||||
iShots--;
|
||||
}
|
||||
|
||||
dprint( sprintf( "[DEBUG] ACCURACY: %f, %d %d %d\n", self.fAccuracy, vDir_x, vDir_y, vDir_z ));
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
#pragma target fte
|
||||
#pragma progs_dat "../../valve/progs.dat"
|
||||
|
||||
#define SSQC
|
||||
#define QWSSQC
|
||||
#define VALVE
|
||||
|
||||
#includelist
|
||||
../builtins.h
|
||||
../defs.h
|
||||
valve/defs.h
|
||||
../math.h
|
||||
../materials.h
|
||||
../events.h
|
||||
|
@ -14,13 +15,36 @@
|
|||
defs.h
|
||||
|
||||
../gs-entbase/server.src
|
||||
valve/monster_rat.cpp
|
||||
|
||||
../shared/effects.c
|
||||
../shared/spraylogo.cpp
|
||||
../shared/pmove.c
|
||||
|
||||
../shared/valve/player.cpp
|
||||
valve/player.c
|
||||
../shared/pmove.c
|
||||
valve/spectator.c
|
||||
../shared/valve/items.h
|
||||
../shared/valve/crosshair.h
|
||||
../shared/valve/weapons.h
|
||||
../shared/valve/w_crowbar.c
|
||||
../shared/valve/w_glock.c
|
||||
../shared/valve/w_python.c
|
||||
../shared/valve/w_mp5.c
|
||||
../shared/valve/w_crossbow.c
|
||||
../shared/valve/w_shotgun.c
|
||||
../shared/valve/w_rpg.c
|
||||
../shared/valve/w_gauss.c
|
||||
../shared/valve/w_egon.c
|
||||
../shared/valve/w_hornetgun.c
|
||||
../shared/valve/w_handgrenade.c
|
||||
../shared/valve/w_tripmine.c
|
||||
../shared/valve/w_satchel.c
|
||||
../shared/valve/w_snark.c
|
||||
valve/items.cpp
|
||||
../shared/valve/weapons.c
|
||||
|
||||
spawn.c
|
||||
|
||||
valve/client.c
|
||||
client.c
|
||||
|
@ -28,9 +52,12 @@ client.c
|
|||
valve/server.c
|
||||
server.c
|
||||
|
||||
damage.c
|
||||
valve/damage.c
|
||||
traceattack.c
|
||||
vox.c
|
||||
|
||||
valve/input.c
|
||||
|
||||
valve/spawn.c
|
||||
footsteps.c
|
||||
entry.c
|
||||
|
|
|
@ -6,13 +6,16 @@
|
|||
*
|
||||
****/
|
||||
|
||||
|
||||
void Empty(void) {}
|
||||
|
||||
void Game_ClientConnect(void)
|
||||
{
|
||||
bprint(sprintf("%s connected\n", self.netname));
|
||||
bprint(PRINT_HIGH, sprintf("%s connected\n", self.netname));
|
||||
}
|
||||
void Game_ClientDisconnect(void)
|
||||
{
|
||||
bprint(sprintf("%s disconnected\n", self.netname));
|
||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", self.netname));
|
||||
}
|
||||
void Game_ClientKill(void)
|
||||
{
|
||||
|
@ -35,61 +38,127 @@ void Game_RunClientCommand(void)
|
|||
|
||||
void Game_DecodeChangeParms(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
self.angles[0] = parm4;
|
||||
self.angles[1] = parm5;
|
||||
self.angles[2] = parm6;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
}
|
||||
void Game_SetChangeParms(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = self.angles[0];
|
||||
parm5 = self.angles[1];
|
||||
parm6 = self.angles[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm10 = pl.items;
|
||||
parm11 = pl.activeweapon;
|
||||
}
|
||||
|
||||
void Game_PutClientInServer(void)
|
||||
{
|
||||
if ( cvar( "sv_playerslots" ) == 1 ) {
|
||||
entity spot;
|
||||
self.SendEntity = Player_SendEntity;
|
||||
|
||||
Game_DecodeChangeParms();
|
||||
|
||||
if (startspot) {
|
||||
setorigin(self, Landmark_GetSpot());
|
||||
self.fixangle = TRUE;
|
||||
} else {
|
||||
spot = find( world, classname, "info_player_start" );
|
||||
//self.origin = spot.origin;
|
||||
setorigin(self, spot.origin);
|
||||
self.angles = spot.angles;
|
||||
self.fixangle = TRUE;
|
||||
}
|
||||
if (self.classname != "player") {
|
||||
spawnfunc_player();
|
||||
}
|
||||
|
||||
self.classname = "player";
|
||||
self.health = self.max_health = 100;
|
||||
player pl = (player)self;
|
||||
|
||||
entity spot;
|
||||
|
||||
pl.classname = "player";
|
||||
pl.health = self.max_health = 100;
|
||||
//forceinfokey( self, "*dead", "0" );
|
||||
self.takedamage = DAMAGE_YES;
|
||||
self.solid = SOLID_SLIDEBOX;
|
||||
self.movetype = MOVETYPE_WALK;
|
||||
self.flags = FL_CLIENT;
|
||||
self.viewzoom = 1.0;
|
||||
setmodel( self, "models/player.mdl" );
|
||||
setsize( self, VEC_HULL_MIN, VEC_HULL_MAX );
|
||||
self.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
self.velocity = '0 0 0';
|
||||
self.frame = 1;
|
||||
forceinfokey( self, "*spec", "0" );
|
||||
pl.takedamage = DAMAGE_YES;
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.movetype = MOVETYPE_WALK;
|
||||
pl.flags = FL_CLIENT;
|
||||
pl.viewzoom = 1.0;
|
||||
setmodel(pl, "models/player.mdl");
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
pl.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
pl.velocity = [0,0,0];
|
||||
pl.frame = 1;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
pl.customphysics = Empty;
|
||||
pl.vPain = Player_Pain;
|
||||
pl.vDeath = Player_Death;
|
||||
forceinfokey(pl, "*spec", "0" );
|
||||
|
||||
if ( cvar( "sv_playerslots" ) == 1 ) {
|
||||
Game_DecodeChangeParms();
|
||||
if (startspot) {
|
||||
setorigin(pl, Landmark_GetSpot());
|
||||
} else {
|
||||
spot = find(world, classname, "info_player_start");
|
||||
setorigin(pl, spot.origin);
|
||||
pl.angles = spot.angles;
|
||||
pl.fixangle = TRUE;
|
||||
}
|
||||
} else {
|
||||
spot = Spawn_SelectRandom("info_player_deathmatch");
|
||||
setorigin(pl, spot.origin);
|
||||
pl.angles = spot.angles;
|
||||
pl.fixangle = TRUE;
|
||||
|
||||
pl.ammo_9mm = 68;
|
||||
Weapons_AddItem(pl, WEAPON_CROWBAR);
|
||||
Weapons_AddItem(pl, WEAPON_GLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void SV_SendChat(entity eSender, string sMessage, entity eEnt, float fType)
|
||||
{
|
||||
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
|
||||
WriteByte( MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM );
|
||||
WriteByte( MSG_MULTICAST, num_for_edict( eSender ) - 1 );
|
||||
WriteByte( MSG_MULTICAST, eSender.team );
|
||||
WriteString( MSG_MULTICAST, sMessage );
|
||||
if (eEnt) {
|
||||
msg_entity = eEnt;
|
||||
multicast( [0,0,0], MULTICAST_ONE );
|
||||
} else {
|
||||
multicast( [0,0,0], MULTICAST_ALL );
|
||||
}
|
||||
}
|
||||
|
||||
void Game_ParseClientCommand(string cmd)
|
||||
{
|
||||
tokenize( cmd );
|
||||
|
||||
/*if ( argv( 1 ) == "timeleft" ) {
|
||||
float fTimeLeft = cvar( "mp_timelimit" ) - ( time / 60 );
|
||||
Vox_Singlecast( self, sprintf( "we have %s minutes remaining", Vox_TimeToString( fTimeLeft ) ) );
|
||||
return;
|
||||
}*/
|
||||
|
||||
string chat = substring( cmd, 4, strlen( cmd ) - 4 );
|
||||
|
||||
// Players talk to players, spectators to spectators.
|
||||
if ( argv( 0 ) == "say" ) {
|
||||
localcmd( sprintf( "echo %s: %s\n", self.netname, chat ) );
|
||||
SV_SendChat( self, chat, world, 0 );
|
||||
return;
|
||||
} else if ( argv( 0 ) == "say_team" ) {
|
||||
localcmd( sprintf( "echo [TEAM %d] %s: %s\n", self.team, self.netname, chat ) );
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( eFind.team == self.team ) {
|
||||
SV_SendChat( self, chat, eFind, 1 );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
clientcommand(self, cmd);
|
||||
}
|
||||
|
||||
|
|
169
Source/server/valve/damage.c
Executable file
169
Source/server/valve/damage.c
Executable file
|
@ -0,0 +1,169 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
=================
|
||||
Damage_CastOrbituary
|
||||
|
||||
Sends a message to the clients to display a death message
|
||||
=================
|
||||
*/
|
||||
void Damage_CastOrbituary( entity eAttacker, entity eTarget, float fWeapon) {
|
||||
WriteByte( MSG_BROADCAST, SVC_CGAMEPACKET );
|
||||
WriteByte( MSG_BROADCAST, EV_ORBITUARY );
|
||||
WriteByte( MSG_BROADCAST, num_for_edict( eAttacker ) - 1 );
|
||||
WriteByte( MSG_BROADCAST, eAttacker.team );
|
||||
WriteByte( MSG_BROADCAST, num_for_edict( eTarget ) - 1 );
|
||||
WriteByte( MSG_BROADCAST, eTarget.team );
|
||||
WriteByte( MSG_BROADCAST, fWeapon );
|
||||
msg_entity = self;
|
||||
multicast( [0,0,0], MULTICAST_ALL );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Damage_Apply
|
||||
|
||||
Generic function that applies damage, pain and suffering
|
||||
=================
|
||||
*/
|
||||
void Damage_Apply(entity eTarget, entity eAttacker, float fDamage, vector vHitPos, int a)
|
||||
{
|
||||
// Apply the damage finally
|
||||
if ( eTarget.armor ) {
|
||||
float flArmor;
|
||||
float flNewDamage;
|
||||
|
||||
flNewDamage = fDamage * 0.2;
|
||||
flArmor = (fDamage - flNewDamage) * 0.5;
|
||||
|
||||
if (flArmor > eTarget.armor) {
|
||||
flArmor = eTarget.armor;
|
||||
flArmor *= (1/0.5);
|
||||
flNewDamage = fDamage - flArmor;
|
||||
eTarget.armor = 0;
|
||||
} else {
|
||||
eTarget.armor -= flArmor;
|
||||
}
|
||||
fDamage = flNewDamage;
|
||||
}
|
||||
|
||||
eTarget.health -= fDamage;
|
||||
eTarget.dmg_take = fDamage;
|
||||
eTarget.dmg_inflictor = eAttacker;
|
||||
|
||||
// Target is dead and a client....
|
||||
if (eTarget.health <= 0) {
|
||||
if (eTarget.flags & FL_CLIENT) {
|
||||
//eTarget.fDeaths++;
|
||||
//forceinfokey( eTarget, "*deaths", ftos( eTarget.fDeaths ) );
|
||||
}
|
||||
|
||||
if ((eTarget.flags & FL_CLIENT) && (eAttacker.flags & FL_CLIENT)) {
|
||||
eAttacker.frags++;
|
||||
Damage_CastOrbituary(eAttacker, eTarget, eAttacker.weapon );
|
||||
}
|
||||
}
|
||||
|
||||
entity eOld = self;
|
||||
self = eTarget;
|
||||
|
||||
if (self.health <= 0) {
|
||||
self.health = 0;
|
||||
self.vDeath(trace_surface_id);
|
||||
} else {
|
||||
self.vPain(trace_surface_id);
|
||||
}
|
||||
|
||||
self = eOld;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Damage_CheckAttack
|
||||
|
||||
This verifies that the entity is actually able to receive some damage,
|
||||
from a plain geographical standpoint
|
||||
=================
|
||||
*/
|
||||
float Damage_CheckAttack( entity eTarget, vector vAttackPos ) {
|
||||
if ( eTarget.movetype == MOVETYPE_PUSH ) {
|
||||
traceline( vAttackPos, 0.5 * ( eTarget.absmin + eTarget.absmax ), TRUE, self );
|
||||
|
||||
if ( trace_fraction == 1 ) {
|
||||
return TRUE;
|
||||
}
|
||||
if ( trace_ent == eTarget ) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
traceline( vAttackPos, eTarget.origin, TRUE, self );
|
||||
if ( trace_fraction == 1 ) {
|
||||
return TRUE;
|
||||
}
|
||||
traceline( vAttackPos, eTarget.origin + '15 15 0', TRUE, self );
|
||||
if ( trace_fraction == 1 ) {
|
||||
return TRUE;
|
||||
}
|
||||
traceline( vAttackPos, eTarget.origin + '-15 -15 0', TRUE, self );
|
||||
if ( trace_fraction == 1 ) {
|
||||
return TRUE;
|
||||
}
|
||||
traceline( vAttackPos, eTarget.origin + '-15 15 0', TRUE, self );
|
||||
if ( trace_fraction == 1 ) {
|
||||
return TRUE;
|
||||
}
|
||||
traceline( vAttackPos, eTarget.origin + '15 -15 0', TRUE, self );
|
||||
if ( trace_fraction == 1 ) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Damage_Radius
|
||||
|
||||
Even more pain and suffering, mostly used for explosives
|
||||
=================
|
||||
*/
|
||||
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip ) {
|
||||
for ( entity eDChain = world; ( eDChain = findfloat( eDChain, takedamage, DAMAGE_YES ) ); ) {
|
||||
vector vecRealPos;
|
||||
vecRealPos[0] = eDChain.absmin[0] + ( 0.5 * ( eDChain.absmax[0] - eDChain.absmin[0] ) );
|
||||
vecRealPos[1] = eDChain.absmin[1] + ( 0.5 * ( eDChain.absmax[1] - eDChain.absmin[1] ) );
|
||||
vecRealPos[2] = eDChain.absmin[2] + ( 0.5 * ( eDChain.absmax[2] - eDChain.absmin[2] ) );
|
||||
|
||||
float fDist = vlen( vOrigin - vecRealPos );
|
||||
//vector vPush;
|
||||
|
||||
if ( fDist > fRadius ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( Damage_CheckAttack( eDChain, vOrigin ) || iCheckClip == FALSE ) {
|
||||
float fDiff = vlen( vOrigin - vecRealPos );
|
||||
|
||||
fDiff = ( fRadius - fDiff ) / fRadius;
|
||||
fDamage = rint(fDamage * fDiff);
|
||||
|
||||
if ( fDiff > 0 ) {
|
||||
Damage_Apply( eDChain, eAttacker, fDamage, eDChain.origin, 0 );
|
||||
/*if ( eDChain.movetype != MOVETYPE_NONE ) {
|
||||
vPush = vectoangles( vecRealPos - vOrigin );
|
||||
makevectors( vPush );
|
||||
eDChain.velocity += ( v_forward * fDamage * 5 ) + ( v_up * fDamage * 2.5 );
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
1
Source/server/valve/defs.h
Normal file
1
Source/server/valve/defs.h
Normal file
|
@ -0,0 +1 @@
|
|||
void Damage_Apply( entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int bla);
|
35
Source/server/valve/input.c
Executable file
35
Source/server/valve/input.c
Executable file
|
@ -0,0 +1,35 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
=================
|
||||
Input_Handle
|
||||
|
||||
Handles impulse and whatnot
|
||||
=================
|
||||
*/
|
||||
void Input_Handle(void)
|
||||
{
|
||||
if (self.button0) {
|
||||
Weapons_Primary();
|
||||
} else if (self.button4) {
|
||||
Weapons_Reload();
|
||||
} else if (self.button3) {
|
||||
Weapons_Secondary();
|
||||
} else {
|
||||
Weapons_Release();
|
||||
}
|
||||
|
||||
if ( self.button5 ) {
|
||||
Player_UseDown();
|
||||
} else {
|
||||
Player_UseUp();
|
||||
}
|
||||
|
||||
self.impulse = 0;
|
||||
}
|
67
Source/server/valve/items.cpp
Normal file
67
Source/server/valve/items.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/* WEAPON ITEMS */
|
||||
class itemweapon:CBaseEntity
|
||||
{
|
||||
int id;
|
||||
void() itemweapon;
|
||||
virtual void() touch;
|
||||
virtual void(int i) setitem;
|
||||
|
||||
virtual void() Respawn;
|
||||
};
|
||||
|
||||
void itemweapon::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
if (Weapons_IsPresent((player)other, id) == TRUE) {
|
||||
return;
|
||||
}
|
||||
sound(other, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
Weapons_AddItem((player)other, id);
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
Hide();
|
||||
think = Respawn;
|
||||
nextthink = time + 30.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void itemweapon::setitem(int i)
|
||||
{
|
||||
id = i;
|
||||
m_oldModel = Weapons_GetWorldmodel(id);
|
||||
setmodel(this, m_oldModel);
|
||||
}
|
||||
|
||||
void itemweapon::Respawn(void)
|
||||
{
|
||||
solid = SOLID_TRIGGER;
|
||||
movetype = MOVETYPE_TOSS;
|
||||
setsize(this, [-24,-24,-16], [24,24,16]);
|
||||
setorigin(this, origin);
|
||||
|
||||
/* At some points, the item id might not yet be set */
|
||||
if (m_oldModel) {
|
||||
setmodel(this, m_oldModel);
|
||||
}
|
||||
|
||||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
void itemweapon::itemweapon(void)
|
||||
{
|
||||
CBaseEntity::CBaseEntity();
|
||||
Respawn();
|
||||
}
|
22
Source/server/valve/monster_rat.cpp
Normal file
22
Source/server/valve/monster_rat.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
class monster_rat:CBaseEntity
|
||||
{
|
||||
void() monster_rat;
|
||||
};
|
||||
|
||||
void monster_rat::monster_rat(void)
|
||||
{
|
||||
CBaseEntity::CBaseEntity();
|
||||
precache_model("models/bigrat.mdl");
|
||||
solid = SOLID_SLIDEBOX;
|
||||
movetype = MOVETYPE_WALK;
|
||||
setmodel(this, "models/bigrat.mdl");
|
||||
setorigin(this, origin);
|
||||
}
|
|
@ -1,3 +1,80 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
void Player_Pain(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Player_Death(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.health = pl.armor = pl.activeweapon = pl.items = 0;
|
||||
PutClientInServer();
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
UseWorkaround
|
||||
====================
|
||||
*/
|
||||
void UseWorkaround( entity eTarget )
|
||||
{
|
||||
eActivator = self;
|
||||
entity eOldSelf = self;
|
||||
self = eTarget;
|
||||
self.PlayerUse();
|
||||
self = eOldSelf;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Player_UseDown
|
||||
====================
|
||||
*/
|
||||
void Player_UseDown(void)
|
||||
{
|
||||
if ( self.health <= 0 ) {
|
||||
return;
|
||||
} else if ( !( self.gflags & GF_USE_RELEASED ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
vector vSource;
|
||||
|
||||
makevectors(self.v_angle);
|
||||
vSource = self.origin + self.view_ofs;
|
||||
traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self);
|
||||
|
||||
if (trace_ent.PlayerUse) {
|
||||
if (trace_ent.classname != "func_pushable") {
|
||||
self.gflags &= ~GF_USE_RELEASED;
|
||||
sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE );
|
||||
}
|
||||
|
||||
UseWorkaround(trace_ent);
|
||||
} else {
|
||||
sound( self, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE );
|
||||
self.gflags &= ~GF_USE_RELEASED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Player_UseUp
|
||||
====================
|
||||
*/
|
||||
void Player_UseUp( void ) {
|
||||
if ( !( self.gflags & GF_USE_RELEASED ) ) {
|
||||
self.gflags |= GF_USE_RELEASED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -6,27 +83,43 @@ Player_SendEntity
|
|||
*/
|
||||
float Player_SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
if (self.health <= 0 && ePEnt != self) {
|
||||
player pl = (player)self;
|
||||
if (pl.health <= 0 && ePEnt != pl) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WriteByte(MSG_ENTITY, ENT_PLAYER);
|
||||
WriteShort(MSG_ENTITY, self.modelindex);
|
||||
WriteCoord(MSG_ENTITY, self.origin[0]);
|
||||
WriteCoord(MSG_ENTITY, self.origin[1]);
|
||||
WriteCoord(MSG_ENTITY, self.origin[2]);
|
||||
WriteCoord(MSG_ENTITY, self.v_angle[0]);
|
||||
WriteCoord(MSG_ENTITY, self.angles[1]);
|
||||
WriteCoord(MSG_ENTITY, self.angles[2]);
|
||||
WriteCoord(MSG_ENTITY, self.velocity[0]);
|
||||
WriteCoord(MSG_ENTITY, self.velocity[1]);
|
||||
WriteCoord(MSG_ENTITY, self.velocity[2]);
|
||||
WriteFloat(MSG_ENTITY, self.flags);
|
||||
WriteFloat(MSG_ENTITY, self.pmove_flags);
|
||||
WriteByte(MSG_ENTITY, self.weapon);
|
||||
WriteByte(MSG_ENTITY, self.health);
|
||||
WriteFloat(MSG_ENTITY, self.movetype);
|
||||
WriteFloat(MSG_ENTITY, self.view_ofs[2]);
|
||||
WriteFloat(MSG_ENTITY, self.viewzoom);
|
||||
WriteShort(MSG_ENTITY, pl.modelindex);
|
||||
WriteCoord(MSG_ENTITY, pl.origin[0]);
|
||||
WriteCoord(MSG_ENTITY, pl.origin[1]);
|
||||
WriteCoord(MSG_ENTITY, pl.origin[2]);
|
||||
WriteCoord(MSG_ENTITY, pl.v_angle[0]);
|
||||
WriteCoord(MSG_ENTITY, pl.angles[1]);
|
||||
WriteCoord(MSG_ENTITY, pl.angles[2]);
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[0]);
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[1]);
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[2]);
|
||||
WriteFloat(MSG_ENTITY, pl.flags);
|
||||
WriteByte(MSG_ENTITY, pl.activeweapon);
|
||||
WriteFloat(MSG_ENTITY, pl.items);
|
||||
WriteByte(MSG_ENTITY, pl.health);
|
||||
WriteByte(MSG_ENTITY, pl.armor);
|
||||
WriteFloat(MSG_ENTITY, pl.movetype);
|
||||
WriteFloat(MSG_ENTITY, pl.view_ofs[2]);
|
||||
WriteFloat(MSG_ENTITY, pl.viewzoom);
|
||||
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo1);
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo2);
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo3);
|
||||
WriteFloat(MSG_ENTITY, pl.w_attack_next);
|
||||
WriteFloat(MSG_ENTITY, pl.w_idle_next);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Weapons_Draw(void);
|
||||
void CSEv_PlayerSwitchWeapon_f(float w)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.activeweapon = (int)w;
|
||||
Weapons_Draw();
|
||||
}
|
||||
|
|
|
@ -18,5 +18,7 @@ float Game_ConsoleCmd(string cmd)
|
|||
|
||||
void Game_Worldspawn(void)
|
||||
{
|
||||
|
||||
precache_file("decals.wad");
|
||||
precache_model("models/player.mdl");
|
||||
Weapons_Init();
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ void Animation_Print( string sWow ) {
|
|||
#ifdef CSQC
|
||||
print( sprintf( "[DEBUG] %s", sWow ) );
|
||||
#else
|
||||
bprint( sprintf( "SSQC: %s", sWow ) );
|
||||
bprint(PRINT_HIGH, sprintf( "SSQC: %s", sWow ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
28
Source/shared/cstrike/player.cpp
Normal file
28
Source/shared/cstrike/player.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
class player
|
||||
{
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
|
||||
vector netorigin;
|
||||
vector netvelocity;
|
||||
float netflags;
|
||||
|
||||
float activeweapon;
|
||||
float weapons;
|
||||
float lastweapon;
|
||||
|
||||
float health;
|
||||
float armor;
|
||||
float pitch;
|
||||
float viewzoom;
|
||||
|
||||
vector view_ofs;
|
||||
|
||||
#ifdef CSQC
|
||||
virtual void() gun_offset;
|
||||
virtual void() draw;
|
||||
virtual float() predraw;
|
||||
#endif
|
||||
};
|
|
@ -122,17 +122,17 @@ void Effect_Impact( int iType, vector vPos, vector vNormal ) {
|
|||
case IMPACT_EXPLOSION:
|
||||
break;
|
||||
case IMPACT_GLASS:
|
||||
pointparticles( DECAL_GLASS, vPos, vNormal, 1 );
|
||||
//pointparticles( DECAL_GLASS, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 );
|
||||
break;
|
||||
case IMPACT_WOOD:
|
||||
pointparticles( DECAL_SHOT, vPos, vNormal, 1 );
|
||||
//pointparticles( DECAL_SHOT, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_SMOKE_BROWN, vPos, vNormal, 1 );
|
||||
break;
|
||||
case IMPACT_METAL:
|
||||
pointparticles( DECAL_SHOT, vPos, vNormal, 1 );
|
||||
//pointparticles( DECAL_SHOT, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 );
|
||||
|
@ -141,7 +141,7 @@ void Effect_Impact( int iType, vector vPos, vector vNormal ) {
|
|||
pointparticles( PARTICLE_BLOOD, vPos, vNormal, 1 );
|
||||
break;
|
||||
case IMPACT_DEFAULT:
|
||||
pointparticles( DECAL_SHOT, vPos, vNormal, 1 );
|
||||
//pointparticles( DECAL_SHOT, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 );
|
||||
pointparticles( PARTICLE_SMOKE_GREY, vPos, vNormal, 1 );
|
||||
|
|
|
@ -6,10 +6,14 @@
|
|||
*
|
||||
****/
|
||||
|
||||
#define AIRCONTROL
|
||||
|
||||
#define PHY_JUMP_CHAINWINDOW 0.5
|
||||
#define PHY_JUMP_CHAIN 100
|
||||
#define PHY_JUMP_CHAINDECAY 50
|
||||
|
||||
#define FL_JUMPRELEASED 4096
|
||||
|
||||
/*FIXME: jumptime should use the time global, as time intervals are not predictable - decrement it based upon input_timelength*/
|
||||
.float jumptime;
|
||||
.float waterlevel;
|
||||
|
@ -29,10 +33,18 @@ void PMove_Init(void) {
|
|||
localcmd("serverinfo phy_airstepheight 18\n");
|
||||
localcmd("serverinfo phy_friction 4\n");
|
||||
localcmd("serverinfo phy_edgefriction 1\n");
|
||||
localcmd("serverinfo phy_accelerate 4\n");
|
||||
localcmd("serverinfo phy_stopspeed 75\n");
|
||||
localcmd("serverinfo phy_gravity 800\n");
|
||||
|
||||
#ifdef CSTRIKE
|
||||
localcmd("serverinfo phy_accelerate 4\n");
|
||||
localcmd("serverinfo phy_maxspeed 240\n");
|
||||
#endif
|
||||
|
||||
#ifdef VALVE
|
||||
localcmd("serverinfo phy_accelerate 8\n");
|
||||
localcmd("serverinfo phy_maxspeed 270\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -657,6 +669,28 @@ PMove_Run
|
|||
*/
|
||||
void PMove_Run(void)
|
||||
{
|
||||
|
||||
#ifdef VALVE
|
||||
|
||||
self.maxspeed = (self.flags & FL_CROUCHING) ? 135 : 270;
|
||||
|
||||
if (input_buttons & INPUT_BUTTON5) {
|
||||
input_movevalues *= 0.50;
|
||||
}
|
||||
|
||||
player pl = (player)self;
|
||||
|
||||
pl.w_attack_next -= input_timelength;
|
||||
pl.w_idle_next -= input_timelength;
|
||||
|
||||
if (pl.w_attack_next <= 0) {
|
||||
pl.w_attack_next = 0;
|
||||
}
|
||||
if (pl.w_idle_next <= 0) {
|
||||
pl.w_idle_next = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
PMove_WaterMove();
|
||||
|
||||
if (self.waterlevel >= 2) {
|
||||
|
|
262
Source/shared/valve/animations.c
Executable file
262
Source/shared/valve/animations.c
Executable file
|
@ -0,0 +1,262 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
.float baseframe_time;
|
||||
.float baseframe_old;
|
||||
.float fWasCrouching;
|
||||
|
||||
// For lerping, sigh
|
||||
#ifdef CSQC
|
||||
.float frame_last;
|
||||
.float baseframe_last;
|
||||
#else
|
||||
.float subblend2frac;
|
||||
#endif
|
||||
|
||||
void Animation_Print( string sWow ) {
|
||||
#ifdef CSQC
|
||||
print( sprintf( "[DEBUG] %s", sWow ) );
|
||||
#else
|
||||
bprint(PRINT_HIGH, sprintf( "SSQC: %s", sWow ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Animation_PlayerUpdate
|
||||
|
||||
Called every frame to update the animation sequences
|
||||
depending on what the player is doing
|
||||
=================
|
||||
*/
|
||||
void Animation_PlayerUpdate( void ) {
|
||||
self.basebone = 40;
|
||||
/*
|
||||
// TODO: Make this faster
|
||||
if ( self.baseframe_time < time ) {
|
||||
switch ( Weapon_GetAnimType( self.weapon ) ) {
|
||||
case ATYPE_AK47:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_AK47 : ANIM_AIM_AK47;
|
||||
break;
|
||||
case ATYPE_C4:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_C4 : ANIM_AIM_C4;
|
||||
break;
|
||||
case ATYPE_CARBINE:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_CARBINE : ANIM_AIM_CARBINE;
|
||||
break;
|
||||
case ATYPE_DUALPISTOLS:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_DUALPISTOLS : ANIM_AIM_DUALPISTOLS;
|
||||
break;
|
||||
case ATYPE_GRENADE:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_GRENADE : ANIM_AIM_GRENADE;
|
||||
break;
|
||||
case ATYPE_KNIFE:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_KNIFE : ANIM_AIM_KNIFE;
|
||||
break;
|
||||
case ATYPE_MP5:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_MP5 : ANIM_AIM_MP5;
|
||||
break;
|
||||
case ATYPE_ONEHAND:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_ONEHAND : ANIM_AIM_ONEHAND;
|
||||
break;
|
||||
case ATYPE_PARA:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_PARA : ANIM_AIM_PARA;
|
||||
break;
|
||||
case ATYPE_RIFLE:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_RIFLE : ANIM_AIM_RIFLE;
|
||||
break;
|
||||
case ATYPE_SHOTGUN:
|
||||
self.baseframe = self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_SHOTGUN : ANIM_AIM_SHOTGUN;
|
||||
break;
|
||||
}
|
||||
self.baseframe_old = self.baseframe;
|
||||
}
|
||||
|
||||
if ( !( self.flags & FL_ONGROUND ) ) {
|
||||
self.frame = ANIM_JUMP;
|
||||
} else if ( vlen( self.velocity ) == 0 ) {
|
||||
if ( self.flags & FL_CROUCHING ) {
|
||||
self.frame = ANIM_IDLE_CROUCH;
|
||||
} else {
|
||||
self.frame = ANIM_IDLE;
|
||||
}
|
||||
} else if ( vlen( self.velocity ) < 150 ) {
|
||||
if ( self.flags & FL_CROUCHING ) {
|
||||
self.frame = ANIM_RUN_CROUCH;
|
||||
} else {
|
||||
self.frame = ANIM_WALK;
|
||||
}
|
||||
} else if ( vlen( self.velocity ) > 150 ) {
|
||||
if ( self.flags & FL_CROUCHING ) {
|
||||
self.frame = ANIM_RUN_CROUCH;
|
||||
} else {
|
||||
self.frame = ANIM_RUN;
|
||||
}
|
||||
}*/
|
||||
|
||||
#ifdef CSQC
|
||||
// Lerp it down!
|
||||
if ( self.lerpfrac > 0 ) {
|
||||
self.lerpfrac -= frametime * 5;
|
||||
if ( self.lerpfrac < 0 ) {
|
||||
self.lerpfrac = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( self.baselerpfrac > 0 ) {
|
||||
self.baselerpfrac -= frametime * 5;
|
||||
if ( self.baselerpfrac < 0 ) {
|
||||
self.baselerpfrac = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( self.frame != self.frame_last ) {
|
||||
//Animation_Print( sprintf( "New Frame: %d, Last Frame: %d\n", self.frame, self.frame_last ));
|
||||
|
||||
// Move everything over to frame 2
|
||||
self.frame2time = self.frame1time;
|
||||
self.frame2 = self.frame_last;
|
||||
|
||||
// Set frame_last to avoid this being called again
|
||||
self.frame_last = self.frame;
|
||||
|
||||
self.lerpfrac = 1.0f;
|
||||
self.frame1time = 0.0f;
|
||||
}
|
||||
|
||||
if ( self.baseframe != self.baseframe_last ) {
|
||||
//Animation_Print( sprintf( "New Baseframe: %d, Last Baseframe: %d\n", self.baseframe, self.baseframe_last ) );
|
||||
|
||||
// Move everything over to frame 2
|
||||
self.baseframe2time = self.baseframe1time;
|
||||
self.baseframe2 = self.baseframe_last;
|
||||
|
||||
// Set frame_last to avoid this being called again
|
||||
self.baseframe_last = self.baseframe;
|
||||
|
||||
self.baselerpfrac = 1.0f;
|
||||
self.baseframe1time = 0.0f;
|
||||
}
|
||||
|
||||
self.bonecontrol1 = self.angles_x;
|
||||
#endif
|
||||
self.angles_x = self.angles_z = 0;
|
||||
|
||||
if ( !( self.flags & FL_ONGROUND ) ) {
|
||||
/*self.frame = ANIM_JUMP;*/
|
||||
}
|
||||
|
||||
// Force the code above to update if we switched positions
|
||||
if ( self.fWasCrouching != ( self.flags & FL_CROUCHING ) ) {
|
||||
self.baseframe_old = 0;
|
||||
self.baseframe_time = 0;
|
||||
self.fWasCrouching = ( self.flags & FL_CROUCHING );
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
// On the CSQC it's done in Player.c
|
||||
self.subblend2frac = self.v_angle_x / 90;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Animation_PlayerTop
|
||||
|
||||
Changes the animation sequence for the upper body part
|
||||
=================
|
||||
*/
|
||||
void Animation_PlayerTop( float fFrame ) {
|
||||
self.baseframe = fFrame;
|
||||
self.baseframe_old = fFrame;
|
||||
}
|
||||
|
||||
void Animation_PlayerTopTemp( float fFrame, float fTime ) {
|
||||
self.baseframe = fFrame;
|
||||
self.baseframe_time = time + fTime;
|
||||
}
|
||||
|
||||
void Animation_ShootWeapon( entity ePlayer ) {
|
||||
/*switch ( Weapon_GetAnimType( ePlayer.weapon ) ) {
|
||||
case ATYPE_AK47:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_AK47 : ANIM_SHOOT_AK47;
|
||||
break;
|
||||
case ATYPE_C4:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_C4 : ANIM_SHOOT_C4;
|
||||
break;
|
||||
case ATYPE_CARBINE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_CARBINE : ANIM_SHOOT_CARBINE;
|
||||
break;
|
||||
case ATYPE_DUALPISTOLS:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_DUALPISTOLS : ANIM_SHOOT_DUALPISTOLS;
|
||||
break;
|
||||
case ATYPE_GRENADE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_GRENADE : ANIM_SHOOT_GRENADE;
|
||||
break;
|
||||
case ATYPE_KNIFE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_KNIFE : ANIM_SHOOT_KNIFE;
|
||||
break;
|
||||
case ATYPE_MP5:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_MP5 : ANIM_SHOOT_MP5;
|
||||
break;
|
||||
case ATYPE_ONEHAND:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_ONEHAND : ANIM_SHOOT_ONEHAND;
|
||||
break;
|
||||
case ATYPE_PARA:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_PARA : ANIM_SHOOT_PARA;
|
||||
break;
|
||||
case ATYPE_RIFLE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_RIFLE : ANIM_SHOOT_RIFLE;
|
||||
break;
|
||||
case ATYPE_SHOTGUN:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_SHOOT_SHOTGUN : ANIM_SHOOT_SHOTGUN;
|
||||
break;
|
||||
}
|
||||
|
||||
ePlayer.baseframe_time = time + Weapon_GetFireRate( ePlayer.weapon );*/
|
||||
}
|
||||
|
||||
void Animation_ReloadWeapon( entity ePlayer ) {
|
||||
/*switch ( Weapon_GetAnimType( ePlayer.weapon ) ) {
|
||||
case ATYPE_AK47:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_AK47 : ANIM_RELOAD_AK47;
|
||||
break;
|
||||
case ATYPE_C4:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_C4 : ANIM_AIM_C4;
|
||||
break;
|
||||
case ATYPE_CARBINE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_CARBINE : ANIM_RELOAD_CARBINE;
|
||||
break;
|
||||
case ATYPE_DUALPISTOLS:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_DUALPISTOLS : ANIM_RELOAD_DUALPISTOLS;
|
||||
break;
|
||||
case ATYPE_GRENADE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_GRENADE : ANIM_AIM_GRENADE;
|
||||
break;
|
||||
case ATYPE_KNIFE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_KNIFE : ANIM_AIM_KNIFE;
|
||||
break;
|
||||
case ATYPE_MP5:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_MP5 : ANIM_RELOAD_MP5;
|
||||
break;
|
||||
case ATYPE_ONEHAND:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_ONEHAND : ANIM_RELOAD_ONEHAND;
|
||||
break;
|
||||
case ATYPE_PARA:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_PARA : ANIM_RELOAD_PARA;
|
||||
break;
|
||||
case ATYPE_RIFLE:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_RIFLE : ANIM_RELOAD_RIFLE;
|
||||
break;
|
||||
case ATYPE_SHOTGUN:
|
||||
ePlayer.baseframe = ePlayer.flags & FL_CROUCHING ? ANIM_CROUCH_RELOAD_SHOTGUN : ANIM_RELOAD_SHOTGUN;
|
||||
break;
|
||||
}
|
||||
|
||||
ePlayer.baseframe_time = time + Weapon_GetReloadTime( ePlayer.weapon );*/
|
||||
}
|
8
Source/shared/valve/crosshair.h
Normal file
8
Source/shared/valve/crosshair.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
typedef struct
|
||||
{
|
||||
string frame;
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
} crosshair_t;
|
23
Source/shared/valve/items.h
Normal file
23
Source/shared/valve/items.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
/* These are stored in the bitflag field */
|
||||
enumflags
|
||||
{
|
||||
ITEM_CROWBAR,
|
||||
ITEM_GLOCK,
|
||||
ITEM_PYTHON,
|
||||
ITEM_MP5,
|
||||
ITEM_CROSSBOW,
|
||||
ITEM_SHOTGUN,
|
||||
ITEM_RPG,
|
||||
ITEM_GAUSS,
|
||||
ITEM_EGON,
|
||||
ITEM_HORNETGUN,
|
||||
ITEM_HANDGRENADE,
|
||||
ITEM_TRIPMINE,
|
||||
ITEM_SATCHEL,
|
||||
ITEM_SNARK,
|
||||
ITEM_SUIT,
|
||||
ITEM_LONGJUMP,
|
||||
ITEM_HEALTHKIT,
|
||||
ITEM_BATTERY
|
||||
};
|
54
Source/shared/valve/player.cpp
Normal file
54
Source/shared/valve/player.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
class player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
float w_attack_next; /* When the weapon is done firing */
|
||||
float w_idle_next; /* When to play the next idle animation */
|
||||
|
||||
int a_ammo1; // Magazine/Clip
|
||||
int a_ammo2; // Rest in the inventory
|
||||
int a_ammo3; // Special ammo
|
||||
|
||||
float items;
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector view_ofs;
|
||||
|
||||
/* Weapon specific */
|
||||
int glock_mag;
|
||||
|
||||
#ifdef CSQC
|
||||
/* External model */
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
float pitch;
|
||||
float lastweapon;
|
||||
|
||||
/* Prediction */
|
||||
vector netorigin;
|
||||
vector netvelocity;
|
||||
float netflags;
|
||||
float net_w_attack_next; /* When the weapon is done firing */
|
||||
float net_w_idle_next; /* When to play the next idle animation */
|
||||
|
||||
virtual void() gun_offset;
|
||||
virtual void() draw;
|
||||
virtual float() predraw;
|
||||
#else
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
int ammo_m203_grenade;
|
||||
int ammo_bolt;
|
||||
int ammo_rocket;
|
||||
int ammo_uranium;
|
||||
int ammo_handgrenade;
|
||||
int ammo_satchel;
|
||||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
#endif
|
||||
};
|
181
Source/shared/valve/w_crossbow.c
Normal file
181
Source/shared/valve/w_crossbow.c
Normal file
|
@ -0,0 +1,181 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
CROSSBOW_IDLE1,
|
||||
CROSSBOW_IDLE2,
|
||||
CROSSBOW_FIDGET1,
|
||||
CROSSBOW_FIDGET2,
|
||||
CROSSBOW_FIRE1,
|
||||
CROSSBOW_FIRE2,
|
||||
CROSSBOW_FIRE3,
|
||||
CROSSBOW_RELOAD,
|
||||
CROSSBOW_DRAW1,
|
||||
CROSSBOW_DRAW2,
|
||||
CROSSBOW_HOLSTER1,
|
||||
CROSSBOW_HOLSTER2
|
||||
};
|
||||
|
||||
void w_crossbow_precache(void)
|
||||
{
|
||||
precache_model("models/v_crossbow.mdl");
|
||||
precache_model("models/w_crossbow.mdl");
|
||||
precache_model("models/p_crossbow.mdl");
|
||||
precache_sound("weapons/xbow_reload1.wav");
|
||||
precache_sound("weapons/xbow_fire1.wav");
|
||||
}
|
||||
string w_crossbow_vmodel(void)
|
||||
{
|
||||
return "models/v_crossbow.mdl";
|
||||
}
|
||||
string w_crossbow_wmodel(void)
|
||||
{
|
||||
return "models/w_crossbow.mdl";
|
||||
}
|
||||
string w_crossbow_pmodel(void)
|
||||
{
|
||||
return "models/p_crossbow.mdl";
|
||||
}
|
||||
string w_crossbow_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_crossbow_draw(void)
|
||||
{
|
||||
if (1/* has clip*/) {
|
||||
Weapons_ViewAnimation(CROSSBOW_DRAW1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_DRAW2);
|
||||
}
|
||||
}
|
||||
|
||||
void w_crossbow_holster(void)
|
||||
{
|
||||
if (1/* has clip*/) {
|
||||
Weapons_ViewAnimation(CROSSBOW_HOLSTER1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_HOLSTER2);
|
||||
}
|
||||
}
|
||||
void w_crossbow_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (1/* has clip*/) {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIRE1);
|
||||
Weapons_PlaySound(pl, CHAN_ITEM, "weapons/xbow_reload1.wav", 1, ATTN_NORM);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIRE3);
|
||||
}
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/xbow_fire1.wav", 1, ATTN_NORM);
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
pl.w_attack_next = Math_Time() + 0.75f;
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
}
|
||||
void w_crossbow_secondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.viewzoom = 0.2;
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
}
|
||||
pl.w_attack_next = Math_Time() + 0.5f;
|
||||
}
|
||||
void w_crossbow_reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_ITEM, "weapons/xbow_reload1.wav", 1, ATTN_NORM);
|
||||
Weapons_ViewAnimation(CROSSBOW_RELOAD);
|
||||
pl.w_attack_next = Math_Time() + 4.5f;
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
}
|
||||
void w_crossbow_release(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (random() < 0.75) {
|
||||
if (1/* has clip*/) {
|
||||
Weapons_ViewAnimation(CROSSBOW_IDLE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_IDLE2);
|
||||
}
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
} else {
|
||||
if (1/* has clip*/) {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIDGET1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIDGET2);
|
||||
}
|
||||
pl.w_idle_next = Math_Time() + 3.0f;
|
||||
}
|
||||
}
|
||||
void w_crossbow_crosshair(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [72/128,0], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_crossbow_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud5.spr_0.tga", [0,0], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud2.spr_0.tga", [0,0], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_crossbow =
|
||||
{
|
||||
ITEM_CROSSBOW,
|
||||
2,
|
||||
2,
|
||||
w_crossbow_draw,
|
||||
w_crossbow_holster,
|
||||
w_crossbow_primary,
|
||||
w_crossbow_secondary,
|
||||
w_crossbow_reload,
|
||||
w_crossbow_release,
|
||||
w_crossbow_crosshair,
|
||||
w_crossbow_precache,
|
||||
__NULL__,
|
||||
w_crossbow_vmodel,
|
||||
w_crossbow_wmodel,
|
||||
w_crossbow_pmodel,
|
||||
w_crossbow_deathmsg,
|
||||
w_crossbow_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_crossbow(void) {
|
||||
Weapons_InitItem(WEAPON_CROSSBOW);
|
||||
}
|
||||
#endif
|
||||
|
173
Source/shared/valve/w_crowbar.c
Normal file
173
Source/shared/valve/w_crowbar.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
CROWBAR_IDLE,
|
||||
CROWBAR_DRAW,
|
||||
CROWBAR_HOLSTER,
|
||||
CROWBAR_ATTACK1HIT,
|
||||
CROWBAR_ATTACK1MISS,
|
||||
CROWBAR_ATTACK2MISS,
|
||||
CROWBAR_ATTACK2HIT,
|
||||
CROWBAR_ATTACK3MISS,
|
||||
CROWBAR_ATTACK3HIT
|
||||
};
|
||||
|
||||
void w_crowbar_precache(void)
|
||||
{
|
||||
precache_sound("weapons/cbar_miss1.wav");
|
||||
precache_sound("weapons/cbar_hit1.wav");
|
||||
precache_sound("weapons/cbar_hit2.wav");
|
||||
precache_model("models/v_crowbar.mdl");
|
||||
precache_model("models/w_crowbar.mdl");
|
||||
precache_model("models/p_crowbar.mdl");
|
||||
}
|
||||
|
||||
string w_crowbar_vmodel(void)
|
||||
{
|
||||
return "models/v_crowbar.mdl";
|
||||
}
|
||||
string w_crowbar_wmodel(void)
|
||||
{
|
||||
return "models/w_crowbar.mdl";
|
||||
}
|
||||
string w_crowbar_pmodel(void)
|
||||
{
|
||||
return "models/p_crowbar.mdl";
|
||||
}
|
||||
string w_crowbar_deathmsg(void)
|
||||
{
|
||||
return "%s was assaulted by %s's Crowbar.";
|
||||
}
|
||||
|
||||
void w_crowbar_draw(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(CROWBAR_DRAW);
|
||||
#else
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, __NULL__, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_crowbar_holster(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(CROWBAR_HOLSTER);
|
||||
#endif
|
||||
}
|
||||
void w_crowbar_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
Weapons_MakeVectors();
|
||||
vector src = pl.origin + pl.view_ofs;
|
||||
traceline(src, src + (v_forward * 32), FALSE, pl);
|
||||
|
||||
int r = floor(random(0,3));
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(trace_fraction >= 1 ? CROWBAR_ATTACK1MISS:CROWBAR_ATTACK1HIT);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(trace_fraction >= 1 ? CROWBAR_ATTACK2MISS:CROWBAR_ATTACK2HIT);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(trace_fraction >= 1 ? CROWBAR_ATTACK3MISS:CROWBAR_ATTACK3HIT);
|
||||
}
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
pl.w_attack_next = 0.5f;
|
||||
} else {
|
||||
Weapons_PlaceDecal();
|
||||
pl.w_attack_next = 0.25f;
|
||||
}
|
||||
#else
|
||||
Weapons_MakeVectors();
|
||||
vector src = pl.origin + pl.view_ofs;
|
||||
traceline(src, src + (v_forward * 32), FALSE, pl);
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/cbar_miss1.wav", 1, ATTN_NORM);
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
pl.w_attack_next = 0.5f;
|
||||
} else {
|
||||
if (random() < 0.5) {
|
||||
Weapons_PlaySound(pl, 8, "weapons/cbar_hit1.wav", 1, ATTN_NORM);
|
||||
} else {
|
||||
Weapons_PlaySound(pl, 8, "weapons/cbar_hit2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
pl.w_attack_next = 0.25f;
|
||||
}
|
||||
#endif
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
void w_crowbar_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_crowbar_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_crowbar_release(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(CROWBAR_IDLE);
|
||||
pl.w_idle_next = 15.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_crowbar_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud4.spr_0.tga", [0,0], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud1.spr_0.tga", [0,0], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_crowbar =
|
||||
{
|
||||
ITEM_CROWBAR,
|
||||
0,
|
||||
0,
|
||||
w_crowbar_draw,
|
||||
w_crowbar_holster,
|
||||
w_crowbar_primary,
|
||||
w_crowbar_secondary,
|
||||
w_crowbar_reload,
|
||||
w_crowbar_release,
|
||||
__NULL__,
|
||||
w_crowbar_precache,
|
||||
__NULL__,
|
||||
w_crowbar_vmodel,
|
||||
w_crowbar_wmodel,
|
||||
w_crowbar_pmodel,
|
||||
w_crowbar_deathmsg,
|
||||
w_crowbar_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_crowbar(void) {
|
||||
Weapons_InitItem(WEAPON_CROWBAR);
|
||||
}
|
||||
#endif
|
117
Source/shared/valve/w_egon.c
Normal file
117
Source/shared/valve/w_egon.c
Normal file
|
@ -0,0 +1,117 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
EGON_IDLE1,
|
||||
EGON_FIDGET1,
|
||||
EGON_ALTFIREON,
|
||||
EGON_ALTFIRECYCLE,
|
||||
EGON_ALTFIREOFF,
|
||||
EGON_FIRE1,
|
||||
EGON_FIRE2,
|
||||
EGON_FIRE3,
|
||||
EGON_FIRE4,
|
||||
EGON_DRAW,
|
||||
EGON_HOLSTER
|
||||
};
|
||||
|
||||
void w_egon_precache(void)
|
||||
{
|
||||
precache_model("models/v_egon.mdl");
|
||||
precache_model("models/w_egon.mdl");
|
||||
precache_model("models/p_egon.mdl");
|
||||
}
|
||||
string w_egon_vmodel(void)
|
||||
{
|
||||
return "models/v_egon.mdl";
|
||||
}
|
||||
string w_egon_wmodel(void)
|
||||
{
|
||||
return "models/w_egon.mdl";
|
||||
}
|
||||
string w_egon_pmodel(void)
|
||||
{
|
||||
return "models/p_egon.mdl";
|
||||
}
|
||||
string w_egon_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_egon_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(EGON_DRAW);
|
||||
}
|
||||
|
||||
void w_egon_holster(void)
|
||||
{
|
||||
Weapons_ViewAnimation(EGON_HOLSTER);
|
||||
}
|
||||
void w_egon_primary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_egon_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_egon_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_egon_release(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_egon_crosshair(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [72/128,48/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_egon_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud5.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud2.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_egon =
|
||||
{
|
||||
ITEM_EGON,
|
||||
3,
|
||||
2,
|
||||
w_egon_draw,
|
||||
w_egon_holster,
|
||||
w_egon_primary,
|
||||
w_egon_secondary,
|
||||
w_egon_reload,
|
||||
w_egon_release,
|
||||
w_egon_crosshair,
|
||||
w_egon_precache,
|
||||
__NULL__,
|
||||
w_egon_vmodel,
|
||||
w_egon_wmodel,
|
||||
w_egon_pmodel,
|
||||
w_egon_deathmsg,
|
||||
w_egon_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_egon(void) {
|
||||
Weapons_InitItem(WEAPON_EGON);
|
||||
}
|
||||
#endif
|
146
Source/shared/valve/w_gauss.c
Normal file
146
Source/shared/valve/w_gauss.c
Normal file
|
@ -0,0 +1,146 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
GAUSS_IDLE1,
|
||||
GAUSS_IDLE2,
|
||||
GAUSS_FIDGET,
|
||||
GAUSS_SPINUP,
|
||||
GAUSS_SPIN,
|
||||
GAUSS_FIRE1,
|
||||
GAUSS_FIRE2,
|
||||
GAUSS_HOLSTER,
|
||||
GAUSS_DRAW
|
||||
};
|
||||
|
||||
void w_gauss_precache(void)
|
||||
{
|
||||
precache_model("models/v_gauss.mdl");
|
||||
precache_model("models/w_gauss.mdl");
|
||||
precache_model("models/p_gauss.mdl");
|
||||
}
|
||||
string w_gauss_vmodel(void)
|
||||
{
|
||||
return "models/v_gauss.mdl";
|
||||
}
|
||||
string w_gauss_wmodel(void)
|
||||
{
|
||||
return "models/w_gauss.mdl";
|
||||
}
|
||||
string w_gauss_pmodel(void)
|
||||
{
|
||||
return "models/p_gauss.mdl";
|
||||
}
|
||||
string w_gauss_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_gauss_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(GAUSS_DRAW);
|
||||
}
|
||||
|
||||
void w_gauss_holster(void)
|
||||
{
|
||||
Weapons_ViewAnimation(GAUSS_HOLSTER);
|
||||
}
|
||||
void w_gauss_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(GAUSS_FIRE2);
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/gauss2.wav", 1, ATTN_NORM);
|
||||
|
||||
pl.w_attack_next = Math_Time() + 0.2f;
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
}
|
||||
void w_gauss_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_gauss_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_gauss_release(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(random(0,3));
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(GAUSS_IDLE1);
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(GAUSS_IDLE2);
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(GAUSS_FIDGET);
|
||||
pl.w_idle_next = Math_Time() + 3.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void w_gauss_crosshair(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [48/128,48/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_gauss_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud5.spr_0.tga", [0,90/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud2.spr_0.tga", [0,90/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_gauss =
|
||||
{
|
||||
ITEM_GAUSS,
|
||||
3,
|
||||
1,
|
||||
w_gauss_draw,
|
||||
w_gauss_holster,
|
||||
w_gauss_primary,
|
||||
w_gauss_secondary,
|
||||
w_gauss_reload,
|
||||
w_gauss_release,
|
||||
w_gauss_crosshair,
|
||||
w_gauss_precache,
|
||||
__NULL__,
|
||||
w_gauss_vmodel,
|
||||
w_gauss_wmodel,
|
||||
w_gauss_pmodel,
|
||||
w_gauss_deathmsg,
|
||||
w_gauss_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_gauss(void) {
|
||||
Weapons_InitItem(WEAPON_GAUSS);
|
||||
}
|
||||
#endif
|
243
Source/shared/valve/w_glock.c
Normal file
243
Source/shared/valve/w_glock.c
Normal file
|
@ -0,0 +1,243 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
GLOCK_IDLE1,
|
||||
GLOCK_IDLE2,
|
||||
GLOCK_IDLE3,
|
||||
GLOCK_SHOOT,
|
||||
GLOCK_SHOOT_EMPTY,
|
||||
GLOCK_RELOAD_EMPTY,
|
||||
GLOCK_RELOAD,
|
||||
GLOCK_DRAW,
|
||||
GLOCK_HOLSTER
|
||||
};
|
||||
|
||||
void w_glock_precache(void)
|
||||
{
|
||||
precache_model("models/v_9mmhandgun.mdl");
|
||||
precache_model("models/w_9mmhandgun.mdl");
|
||||
precache_model("models/p_9mmhandgun.mdl");
|
||||
precache_sound("weapons/pl_gun3.wav");
|
||||
}
|
||||
string w_glock_vmodel(void)
|
||||
{
|
||||
return "models/v_9mmhandgun.mdl";
|
||||
}
|
||||
string w_glock_wmodel(void)
|
||||
{
|
||||
return "models/w_9mmhandgun.mdl";
|
||||
}
|
||||
string w_glock_pmodel(void)
|
||||
{
|
||||
return "models/p_9mmhandgun.mdl";
|
||||
}
|
||||
string w_glock_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_glock_pickup(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
pl.glock_mag = bound(0, pl.glock_mag + 18, 18);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_glock_draw(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
Weapons_ViewAnimation(GLOCK_DRAW);
|
||||
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, __NULL__);
|
||||
#endif
|
||||
}
|
||||
void w_glock_holster(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
Weapons_ViewAnimation(GLOCK_HOLSTER);
|
||||
#endif
|
||||
}
|
||||
void w_glock_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
#else
|
||||
if (!pl.glock_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs);
|
||||
|
||||
pl.glock_mag--;
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/pl_gun3.wav", 1, ATTN_NORM);
|
||||
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, __NULL__);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.3f;
|
||||
pl.w_idle_next = 5.0f;
|
||||
}
|
||||
void w_glock_secondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
#else
|
||||
if (!pl.glock_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs);
|
||||
|
||||
pl.glock_mag--;
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/pl_gun3.wav", 1, ATTN_NORM);
|
||||
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, __NULL__);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.2f;
|
||||
pl.w_idle_next = 5.0f;
|
||||
}
|
||||
void w_glock_reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 >= 18) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
Weapons_ViewAnimation(GLOCK_RELOAD);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_RELOAD_EMPTY);
|
||||
}
|
||||
#else
|
||||
if (pl.glock_mag >= 18) {
|
||||
return;
|
||||
}
|
||||
if (!pl.ammo_9mm) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::glock_mag, player::ammo_9mm, 18);
|
||||
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, __NULL__);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 2.0f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
void w_glock_release(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(random(0,3));
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(GLOCK_IDLE1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(GLOCK_IDLE2);
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(GLOCK_IDLE3);
|
||||
break;
|
||||
}
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
#endif
|
||||
}
|
||||
void w_glock_hud(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [0.1875,0], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmo1();
|
||||
HUD_DrawAmmo2();
|
||||
#endif
|
||||
}
|
||||
void w_glock_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud4.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud1.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_glock =
|
||||
{
|
||||
ITEM_GLOCK,
|
||||
1,
|
||||
0,
|
||||
w_glock_draw,
|
||||
w_glock_holster,
|
||||
w_glock_primary,
|
||||
w_glock_secondary,
|
||||
w_glock_reload,
|
||||
w_glock_release,
|
||||
w_glock_hud,
|
||||
w_glock_precache,
|
||||
w_glock_pickup,
|
||||
w_glock_vmodel,
|
||||
w_glock_wmodel,
|
||||
w_glock_pmodel,
|
||||
w_glock_deathmsg,
|
||||
w_glock_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_9mmhandgun(void) {
|
||||
Weapons_InitItem(WEAPON_GLOCK);
|
||||
}
|
||||
void weapon_glock(void) {
|
||||
Weapons_InitItem(WEAPON_GLOCK);
|
||||
}
|
||||
#endif
|
105
Source/shared/valve/w_handgrenade.c
Normal file
105
Source/shared/valve/w_handgrenade.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
HANDGRENADE_IDLE,
|
||||
HANDGRENADE_FIDGET,
|
||||
HANDGRENADE_PULLPIN,
|
||||
HANDGRENADE_THROW1,
|
||||
HANDGRENADE_THROW2,
|
||||
HANDGRENADE_THROW3,
|
||||
HANDGRENADE_HOLSTER,
|
||||
HANDGRENADE_DRAW
|
||||
};
|
||||
|
||||
void w_handgrenade_precache(void)
|
||||
{
|
||||
precache_model("models/v_grenade.mdl");
|
||||
precache_model("models/w_grenade.mdl");
|
||||
precache_model("models/p_grenade.mdl");
|
||||
}
|
||||
string w_handgrenade_vmodel(void)
|
||||
{
|
||||
return "models/v_grenade.mdl";
|
||||
}
|
||||
string w_handgrenade_wmodel(void)
|
||||
{
|
||||
return "models/w_grenade.mdl";
|
||||
}
|
||||
string w_handgrenade_pmodel(void)
|
||||
{
|
||||
return "models/p_grenade.mdl";
|
||||
}
|
||||
string w_handgrenade_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_handgrenade_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||
}
|
||||
|
||||
void w_handgrenade_holster(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_handgrenade_primary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_handgrenade_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_handgrenade_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_handgrenade_release(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_handgrenade_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud6.spr_0.tga", [0,0], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud3.spr_0.tga", [0,0], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_handgrenade =
|
||||
{
|
||||
ITEM_HANDGRENADE,
|
||||
4,
|
||||
0,
|
||||
w_handgrenade_draw,
|
||||
w_handgrenade_holster,
|
||||
w_handgrenade_primary,
|
||||
w_handgrenade_secondary,
|
||||
w_handgrenade_reload,
|
||||
w_handgrenade_release,
|
||||
__NULL__,
|
||||
w_handgrenade_precache,
|
||||
__NULL__,
|
||||
w_handgrenade_vmodel,
|
||||
w_handgrenade_wmodel,
|
||||
w_handgrenade_pmodel,
|
||||
w_handgrenade_deathmsg,
|
||||
w_handgrenade_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_handgrenade(void) {
|
||||
Weapons_InitItem(WEAPON_HANDGRENADE);
|
||||
}
|
||||
#endif
|
159
Source/shared/valve/w_hornetgun.c
Normal file
159
Source/shared/valve/w_hornetgun.c
Normal file
|
@ -0,0 +1,159 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
HORNETGUN_IDLE,
|
||||
HORNETGUN_FIDGET1,
|
||||
HORNETGUN_FIDGET2,
|
||||
HORNETGUN_HOLSTER,
|
||||
HORNETGUN_DRAW,
|
||||
HORNETGUN_SHOOT
|
||||
};
|
||||
|
||||
void w_hornetgun_precache(void)
|
||||
{
|
||||
precache_model("models/v_hgun.mdl");
|
||||
precache_model("models/w_hgun.mdl");
|
||||
precache_model("models/p_hgun.mdl");
|
||||
|
||||
precache_sound("agrunt/ag_fire1.wav");
|
||||
precache_sound("agrunt/ag_fire2.wav");
|
||||
precache_sound("agrunt/ag_fire3.wav");
|
||||
}
|
||||
void w_hornetgun_pickup(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
pl.ammo_hornet = 8;
|
||||
#endif
|
||||
}
|
||||
string w_hornetgun_vmodel(void)
|
||||
{
|
||||
return "models/v_hgun.mdl";
|
||||
}
|
||||
string w_hornetgun_wmodel(void)
|
||||
{
|
||||
return "models/w_hgun.mdl";
|
||||
}
|
||||
string w_hornetgun_pmodel(void)
|
||||
{
|
||||
return "models/p_hgun.mdl";
|
||||
}
|
||||
string w_hornetgun_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_hornetgun_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(HORNETGUN_DRAW);
|
||||
}
|
||||
void w_hornetgun_holster(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_hornetgun_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, sprintf("agrunt/ag_fire%d.wav", floor(random(1,4))), 1, ATTN_NORM);
|
||||
Weapons_ViewAnimation(HORNETGUN_SHOOT);
|
||||
pl.w_attack_next = Math_Time() + 0.25;
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
}
|
||||
void w_hornetgun_secondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, sprintf("agrunt/ag_fire%d.wav", floor(random(1,4))), 1, ATTN_NORM);
|
||||
Weapons_ViewAnimation(HORNETGUN_SHOOT);
|
||||
pl.w_attack_next = Math_Time() + 0.1;
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
}
|
||||
void w_hornetgun_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_hornetgun_release(void)
|
||||
{
|
||||
int r;
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = floor(random(0,3));
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(HORNETGUN_IDLE);
|
||||
pl.w_idle_next = Math_Time() + 0.95f;
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(HORNETGUN_FIDGET1);
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(HORNETGUN_FIDGET2);
|
||||
pl.w_idle_next = Math_Time() + 2.2f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
void w_hornetgun_crosshair(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [72/128,24/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_hornetgun_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud5.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud2.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_hornetgun =
|
||||
{
|
||||
ITEM_HORNETGUN,
|
||||
3,
|
||||
3,
|
||||
w_hornetgun_draw,
|
||||
w_hornetgun_holster,
|
||||
w_hornetgun_primary,
|
||||
w_hornetgun_secondary,
|
||||
w_hornetgun_reload,
|
||||
w_hornetgun_release,
|
||||
w_hornetgun_crosshair,
|
||||
w_hornetgun_precache,
|
||||
w_hornetgun_pickup,
|
||||
w_hornetgun_vmodel,
|
||||
w_hornetgun_wmodel,
|
||||
w_hornetgun_pmodel,
|
||||
w_hornetgun_deathmsg,
|
||||
w_hornetgun_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_hornetgun(void) {
|
||||
Weapons_InitItem(WEAPON_HORNETGUN);
|
||||
}
|
||||
#endif
|
190
Source/shared/valve/w_mp5.c
Normal file
190
Source/shared/valve/w_mp5.c
Normal file
|
@ -0,0 +1,190 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
.int mp5_mag;
|
||||
|
||||
enum
|
||||
{
|
||||
MP5_IDLE1,
|
||||
MP5_IDLE2,
|
||||
MP5_GRENADE,
|
||||
MP5_RELOAD,
|
||||
MP5_DRAW,
|
||||
MP5_FIRE1,
|
||||
MP5_FIRE2,
|
||||
MP5_FIRE3
|
||||
};
|
||||
|
||||
void w_mp5_precache(void)
|
||||
{
|
||||
precache_model("models/v_9mmar.mdl");
|
||||
precache_model("models/w_9mmar.mdl");
|
||||
precache_model("models/p_9mmar.mdl");
|
||||
precache_sound("weapons/hks1.wav");
|
||||
precache_sound("weapons/hks2.wav");
|
||||
precache_sound("weapons/glauncher.wav");
|
||||
}
|
||||
void w_mp5_pickup(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.mp5_mag = 25;
|
||||
}
|
||||
string w_mp5_vmodel(void)
|
||||
{
|
||||
return "models/v_9mmar.mdl";
|
||||
}
|
||||
string w_mp5_wmodel(void)
|
||||
{
|
||||
return "models/w_9mmar.mdl";
|
||||
}
|
||||
string w_mp5_pmodel(void)
|
||||
{
|
||||
return "models/p_9mmar.mdl";
|
||||
}
|
||||
string w_mp5_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_mp5_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(MP5_DRAW);
|
||||
}
|
||||
void w_mp5_holster(void)
|
||||
{
|
||||
Weapons_ViewAnimation(MP5_DRAW);
|
||||
}
|
||||
void w_mp5_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
if (random() < 0.5) {
|
||||
Weapons_ViewAnimation(MP5_FIRE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(MP5_FIRE2);
|
||||
}
|
||||
|
||||
Weapons_ViewPunchAngle([random(-2, 2),0,0]);
|
||||
#else
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs);
|
||||
|
||||
if (random() < 0.5) {
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/hks1.wav", 1, ATTN_NORM);
|
||||
} else {
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/hks2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.1f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
void w_mp5_secondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(MP5_GRENADE);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
#else
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/glauncher.wav", 1, ATTN_NORM);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
void w_mp5_reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(MP5_RELOAD);
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.5f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
void w_mp5_release(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (random() < 0.5) {
|
||||
Weapons_ViewAnimation(MP5_IDLE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(MP5_IDLE2);
|
||||
}
|
||||
|
||||
pl.w_idle_next = 15.0f;
|
||||
#endif
|
||||
}
|
||||
void w_mp5_crosshair(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [24/128,48/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_mp5_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud4.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud1.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_mp5 =
|
||||
{
|
||||
ITEM_MP5,
|
||||
2,
|
||||
0,
|
||||
w_mp5_draw,
|
||||
w_mp5_holster,
|
||||
w_mp5_primary,
|
||||
w_mp5_secondary,
|
||||
w_mp5_reload,
|
||||
w_mp5_release,
|
||||
w_mp5_crosshair,
|
||||
w_mp5_precache,
|
||||
w_mp5_pickup,
|
||||
w_mp5_vmodel,
|
||||
w_mp5_wmodel,
|
||||
w_mp5_pmodel,
|
||||
w_mp5_deathmsg,
|
||||
w_mp5_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_9mmAR(void) {
|
||||
Weapons_InitItem(WEAPON_MP5);
|
||||
}
|
||||
void weapon_mp5(void) {
|
||||
Weapons_InitItem(WEAPON_MP5);
|
||||
}
|
||||
#endif
|
||||
|
182
Source/shared/valve/w_python.c
Normal file
182
Source/shared/valve/w_python.c
Normal file
|
@ -0,0 +1,182 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
.int python_cylinder;
|
||||
|
||||
enum
|
||||
{
|
||||
PYTHON_IDLE1,
|
||||
PYTHON_FIDGET,
|
||||
PYTHON_FIRE1,
|
||||
PYTHON_RELOAD,
|
||||
PYTHON_HOLSTER,
|
||||
PYTHON_DRAW,
|
||||
PYTHON_IDLE2,
|
||||
PYTHON_IDLE3
|
||||
};
|
||||
|
||||
void w_python_precache(void)
|
||||
{
|
||||
precache_model("models/v_357.mdl");
|
||||
precache_model("models/w_357.mdl");
|
||||
precache_model("models/p_357.mdl");
|
||||
|
||||
precache_sound("weapons/357_shot1.wav");
|
||||
precache_sound("weapons/357_shot2.wav");
|
||||
}
|
||||
void w_python_pickup(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.python_cylinder = 6;
|
||||
}
|
||||
|
||||
string w_python_vmodel(void)
|
||||
{
|
||||
return "models/v_357.mdl";
|
||||
}
|
||||
string w_python_wmodel(void)
|
||||
{
|
||||
return "models/w_357.mdl";
|
||||
}
|
||||
string w_python_pmodel(void)
|
||||
{
|
||||
return "models/p_357.mdl";
|
||||
}
|
||||
string w_python_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_python_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(PYTHON_DRAW);
|
||||
}
|
||||
|
||||
void w_python_holster(void)
|
||||
{
|
||||
Weapons_ViewAnimation(PYTHON_HOLSTER);
|
||||
}
|
||||
void w_python_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(PYTHON_FIRE1);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
|
||||
if (random() < 0.5) {
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/357_shot1.wav", 1, ATTN_NORM);
|
||||
} else {
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/357_shot2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
pl.w_attack_next = Math_Time() + 0.75f;
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
}
|
||||
void w_python_secondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.viewzoom = 0.5;
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
}
|
||||
pl.w_attack_next = Math_Time() + 0.5f;
|
||||
}
|
||||
void w_python_reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
Weapons_ViewAnimation(PYTHON_RELOAD);
|
||||
pl.w_attack_next = Math_Time() + 3.25f;
|
||||
pl.w_idle_next = Math_Time() + 10.0f;
|
||||
}
|
||||
void w_python_release(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(random(0,3));
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(PYTHON_IDLE1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(PYTHON_IDLE2);
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(PYTHON_IDLE3);
|
||||
break;
|
||||
}
|
||||
|
||||
pl.w_idle_next = Math_Time() + 15.0f;
|
||||
}
|
||||
void w_python_crosshair(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [48/128,0], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_python_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud4.spr_0.tga", [0,90/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud1.spr_0.tga", [0,90/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_python =
|
||||
{
|
||||
ITEM_PYTHON,
|
||||
1,
|
||||
1,
|
||||
w_python_draw,
|
||||
w_python_holster,
|
||||
w_python_primary,
|
||||
w_python_secondary,
|
||||
w_python_reload,
|
||||
w_python_release,
|
||||
w_python_crosshair,
|
||||
w_python_precache,
|
||||
w_python_pickup,
|
||||
w_python_vmodel,
|
||||
w_python_wmodel,
|
||||
w_python_pmodel,
|
||||
w_python_deathmsg,
|
||||
w_python_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_357(void) {
|
||||
Weapons_InitItem(WEAPON_PYTHON);
|
||||
}
|
||||
void weapon_python(void) {
|
||||
Weapons_InitItem(WEAPON_PYTHON);
|
||||
}
|
||||
#endif
|
121
Source/shared/valve/w_rpg.c
Normal file
121
Source/shared/valve/w_rpg.c
Normal file
|
@ -0,0 +1,121 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
RPG_IDLE,
|
||||
RPG_FIDGET,
|
||||
RPG_RELOAD,
|
||||
RPG_FIRE2,
|
||||
RPG_HOLSTER1,
|
||||
RPG_DRAW1,
|
||||
RPG_HOLSTER2,
|
||||
RPG_DRAW_UL,
|
||||
RPG_IDLE_UL,
|
||||
RPG_FIDGET_UL,
|
||||
};
|
||||
|
||||
void w_rpg_precache(void)
|
||||
{
|
||||
precache_model("models/v_rpg.mdl");
|
||||
precache_model("models/w_rpg.mdl");
|
||||
precache_model("models/p_rpg.mdl");
|
||||
}
|
||||
string w_rpg_vmodel(void)
|
||||
{
|
||||
return "models/v_rpg.mdl";
|
||||
}
|
||||
string w_rpg_wmodel(void)
|
||||
{
|
||||
return "models/w_rpg.mdl";
|
||||
}
|
||||
string w_rpg_pmodel(void)
|
||||
{
|
||||
return "models/p_rpg.mdl";
|
||||
}
|
||||
string w_rpg_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_rpg_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(RPG_DRAW1);
|
||||
}
|
||||
|
||||
void w_rpg_holster(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_rpg_primary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_rpg_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_rpg_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_rpg_release(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void w_rpg_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud5.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud2.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_rpg_laser(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
Weapons_MakeVectors();
|
||||
vector src = pl.origin + pl.view_ofs;
|
||||
traceline(src, src + (v_forward * 8192), FALSE, pl);
|
||||
#ifdef CSQC
|
||||
// Draw laser at laserpos
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_rpg =
|
||||
{
|
||||
ITEM_RPG,
|
||||
3,
|
||||
0,
|
||||
w_rpg_draw,
|
||||
w_rpg_holster,
|
||||
w_rpg_primary,
|
||||
w_rpg_secondary,
|
||||
w_rpg_reload,
|
||||
w_rpg_release,
|
||||
w_rpg_laser,
|
||||
w_rpg_precache,
|
||||
__NULL__,
|
||||
w_rpg_vmodel,
|
||||
w_rpg_wmodel,
|
||||
w_rpg_pmodel,
|
||||
w_rpg_deathmsg,
|
||||
w_rpg_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_rpg(void) {
|
||||
Weapons_InitItem(WEAPON_RPG);
|
||||
}
|
||||
#endif
|
||||
|
109
Source/shared/valve/w_satchel.c
Normal file
109
Source/shared/valve/w_satchel.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
SATCHEL_IDLE,
|
||||
SATCHEL_FIDGET,
|
||||
SATCHEL_DRAW,
|
||||
SATCHEL_THROW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RADIO_IDLE,
|
||||
RADIO_FIDGET,
|
||||
RADIO_DRAW,
|
||||
RADIO_USE,
|
||||
RADIO_HOLSTER
|
||||
};
|
||||
|
||||
void w_satchel_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(SATCHEL_DRAW);
|
||||
}
|
||||
|
||||
void w_satchel_holster(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_satchel_primary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_satchel_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_satchel_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_satchel_release(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_satchel_precache(void)
|
||||
{
|
||||
|
||||
}
|
||||
string w_satchel_vmodel(void)
|
||||
{
|
||||
return "models/v_satchel.mdl";
|
||||
}
|
||||
string w_satchel_wmodel(void)
|
||||
{
|
||||
return "models/w_satchel.mdl";
|
||||
}
|
||||
string w_satchel_pmodel(void)
|
||||
{
|
||||
return "models/p_satchel.mdl";
|
||||
}
|
||||
string w_satchel_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_satchel_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud6.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud3.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
weapon_t w_satchel =
|
||||
{
|
||||
ITEM_SATCHEL,
|
||||
4,
|
||||
1,
|
||||
w_satchel_draw,
|
||||
w_satchel_holster,
|
||||
w_satchel_primary,
|
||||
w_satchel_secondary,
|
||||
w_satchel_reload,
|
||||
w_satchel_release,
|
||||
__NULL__,
|
||||
w_satchel_precache,
|
||||
__NULL__,
|
||||
w_satchel_vmodel,
|
||||
w_satchel_wmodel,
|
||||
w_satchel_pmodel,
|
||||
w_satchel_deathmsg,
|
||||
w_satchel_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_satchel(void) {
|
||||
Weapons_InitItem(WEAPON_SATCHEL);
|
||||
}
|
||||
#endif
|
154
Source/shared/valve/w_shotgun.c
Normal file
154
Source/shared/valve/w_shotgun.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
SHOTGUN_IDLE1,
|
||||
SHOTGUN_FIRE1,
|
||||
SHOTGUN_FIRE2,
|
||||
SHOTGUN_RELOAD,
|
||||
SHOTGUN_PUMP,
|
||||
SHOTGUN_START_RELOAD,
|
||||
SHOTGUN_DRAW,
|
||||
SHOTGUN_HOLSTER,
|
||||
SHOTGUN_IDLE2,
|
||||
SHOTGUN_IDLE3
|
||||
};
|
||||
|
||||
void w_shotgun_precache(void)
|
||||
{
|
||||
precache_model("models/v_shotgun.mdl");
|
||||
precache_model("models/w_shotgun.mdl");
|
||||
precache_model("models/p_shotgun.mdl");
|
||||
precache_sound("weapons/sbarrel1.wav");
|
||||
precache_sound("weapons/dbarrel1.wav");
|
||||
}
|
||||
string w_shotgun_vmodel(void)
|
||||
{
|
||||
return "models/v_shotgun.mdl";
|
||||
}
|
||||
string w_shotgun_wmodel(void)
|
||||
{
|
||||
return "models/w_shotgun.mdl";
|
||||
}
|
||||
string w_shotgun_pmodel(void)
|
||||
{
|
||||
return "models/p_shotgun.mdl";
|
||||
}
|
||||
string w_shotgun_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_shotgun_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(SHOTGUN_DRAW);
|
||||
}
|
||||
|
||||
void w_shotgun_holster(void)
|
||||
{
|
||||
Weapons_ViewAnimation(SHOTGUN_HOLSTER);
|
||||
}
|
||||
void w_shotgun_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/sbarrel1.wav", 1, ATTN_NORM);
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE1);
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
pl.w_attack_next = Math_Time() + 0.75;
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
}
|
||||
void w_shotgun_secondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/dbarrel1.wav", 1, ATTN_NORM);
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE2);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
pl.w_attack_next = Math_Time() + 1.5f;
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
}
|
||||
void w_shotgun_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_shotgun_release(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(random(0,3));
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(SHOTGUN_IDLE1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(SHOTGUN_IDLE2);
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(SHOTGUN_IDLE3);
|
||||
break;
|
||||
}
|
||||
|
||||
pl.w_idle_next = Math_Time() + 15.0f;
|
||||
}
|
||||
void w_shotgun_crosshair(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
static vector cross_pos;
|
||||
cross_pos = (video_res / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [48/128,24/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_shotgun_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud4.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud1.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_shotgun =
|
||||
{
|
||||
ITEM_SHOTGUN,
|
||||
2,
|
||||
1,
|
||||
w_shotgun_draw,
|
||||
w_shotgun_holster,
|
||||
w_shotgun_primary,
|
||||
w_shotgun_secondary,
|
||||
w_shotgun_reload,
|
||||
w_shotgun_release,
|
||||
w_shotgun_crosshair,
|
||||
w_shotgun_precache,
|
||||
__NULL__,
|
||||
w_shotgun_vmodel,
|
||||
w_shotgun_wmodel,
|
||||
w_shotgun_pmodel,
|
||||
w_shotgun_deathmsg,
|
||||
w_shotgun_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_shotgun(void) {
|
||||
Weapons_InitItem(WEAPON_SHOTGUN);
|
||||
}
|
||||
#endif
|
121
Source/shared/valve/w_snark.c
Normal file
121
Source/shared/valve/w_snark.c
Normal file
|
@ -0,0 +1,121 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
SNARK_IDLE,
|
||||
SNARK_FIDGET1,
|
||||
SNARK_FIDGET2,
|
||||
SNARK_HOLSTER,
|
||||
SNARK_DRAW,
|
||||
SNARK_THROW
|
||||
};
|
||||
|
||||
void w_snark_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(SNARK_DRAW);
|
||||
}
|
||||
|
||||
void w_snark_holster(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_snark_primary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_snark_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_snark_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_snark_release(void)
|
||||
{
|
||||
int r;
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = floor(random(0,3));
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(SNARK_IDLE);
|
||||
pl.w_idle_next = Math_Time() + 1.875f;
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(SNARK_FIDGET1);
|
||||
pl.w_idle_next = Math_Time() + 4.375f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(SNARK_FIDGET2);
|
||||
pl.w_idle_next = Math_Time() + 5.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
void w_snark_precache(void)
|
||||
{
|
||||
|
||||
}
|
||||
string w_snark_vmodel(void)
|
||||
{
|
||||
return "models/v_squeak.mdl";
|
||||
}
|
||||
string w_snark_wmodel(void)
|
||||
{
|
||||
return "models/w_squeak.mdl";
|
||||
}
|
||||
string w_snark_pmodel(void)
|
||||
{
|
||||
return "models/p_squeak.mdl";
|
||||
}
|
||||
string w_snark_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
void w_snark_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud6.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud3.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_snark =
|
||||
{
|
||||
ITEM_SNARK,
|
||||
4,
|
||||
3,
|
||||
w_snark_draw,
|
||||
w_snark_holster,
|
||||
w_snark_primary,
|
||||
w_snark_secondary,
|
||||
w_snark_reload,
|
||||
w_snark_release,
|
||||
__NULL__,
|
||||
w_snark_precache,
|
||||
__NULL__,
|
||||
w_snark_vmodel,
|
||||
w_snark_wmodel,
|
||||
w_snark_pmodel,
|
||||
w_snark_deathmsg,
|
||||
w_snark_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_snark(void) {
|
||||
Weapons_InitItem(WEAPON_SNARK);
|
||||
}
|
||||
#endif
|
127
Source/shared/valve/w_tripmine.c
Normal file
127
Source/shared/valve/w_tripmine.c
Normal file
|
@ -0,0 +1,127 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
enum
|
||||
{
|
||||
TRIPMINE_IDLE1,
|
||||
TRIPMINE_IDLE2,
|
||||
TRIPMINE_FIRE1,
|
||||
TRIPMINE_FIRE2,
|
||||
TRIPMINE_FIDGET,
|
||||
TRIPMINE_HOLSTER,
|
||||
TRIPMINE_DRAW,
|
||||
TRIPMINE_WORLD,
|
||||
TRIPMINE_GROUND,
|
||||
};
|
||||
|
||||
void w_tripmine_precache(void)
|
||||
{
|
||||
precache_model("models/v_tripmine.mdl");
|
||||
precache_model("models/w_tripmine.mdl");
|
||||
precache_model("models/p_tripmine.mdl");
|
||||
}
|
||||
string w_tripmine_vmodel(void)
|
||||
{
|
||||
return "models/v_tripmine.mdl";
|
||||
}
|
||||
string w_tripmine_wmodel(void)
|
||||
{
|
||||
return "models/w_tripmine.mdl";
|
||||
}
|
||||
string w_tripmine_pmodel(void)
|
||||
{
|
||||
return "models/p_tripmine.mdl";
|
||||
}
|
||||
string w_tripmine_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_tripmine_draw(void)
|
||||
{
|
||||
Weapons_ViewAnimation(TRIPMINE_DRAW);
|
||||
}
|
||||
void w_tripmine_holster(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_tripmine_primary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_tripmine_secondary(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_tripmine_reload(void)
|
||||
{
|
||||
|
||||
}
|
||||
void w_tripmine_release(void)
|
||||
{
|
||||
int r;
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > Math_Time()) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = floor(random(0,3));
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(TRIPMINE_IDLE1);
|
||||
pl.w_idle_next = Math_Time() + 3.0f;
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(TRIPMINE_IDLE2);
|
||||
pl.w_idle_next = Math_Time() + 2.0f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(TRIPMINE_FIDGET);
|
||||
pl.w_idle_next = Math_Time() + 3.333333f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void w_tripmine_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud6.spr_0.tga", [0,90/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hud3.spr_0.tga", [0,90/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_tripmine =
|
||||
{
|
||||
ITEM_TRIPMINE,
|
||||
4,
|
||||
2,
|
||||
w_tripmine_draw,
|
||||
w_tripmine_holster,
|
||||
w_tripmine_primary,
|
||||
w_tripmine_secondary,
|
||||
w_tripmine_reload,
|
||||
w_tripmine_release,
|
||||
__NULL__,
|
||||
w_tripmine_precache,
|
||||
__NULL__,
|
||||
w_tripmine_vmodel,
|
||||
w_tripmine_wmodel,
|
||||
w_tripmine_pmodel,
|
||||
w_tripmine_deathmsg,
|
||||
w_tripmine_hudpic
|
||||
};
|
||||
|
||||
#ifdef SSQC
|
||||
void weapon_tripmine(void) {
|
||||
Weapons_InitItem(WEAPON_TRIPMINE);
|
||||
}
|
||||
#endif
|
300
Source/shared/valve/weapons.c
Normal file
300
Source/shared/valve/weapons.c
Normal file
|
@ -0,0 +1,300 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
#ifdef SSQC
|
||||
void Decals_Init(void);
|
||||
#endif
|
||||
|
||||
weapon_t w_null = {};
|
||||
weapon_t g_weapons[] = {
|
||||
w_null,
|
||||
w_crowbar,
|
||||
w_glock,
|
||||
w_python,
|
||||
w_mp5,
|
||||
w_shotgun,
|
||||
w_crossbow,
|
||||
w_rpg,
|
||||
w_gauss,
|
||||
w_egon,
|
||||
w_hornetgun,
|
||||
w_handgrenade,
|
||||
w_satchel,
|
||||
w_tripmine,
|
||||
w_snark
|
||||
};
|
||||
|
||||
void Weapons_Init(void)
|
||||
{
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (g_weapons[i].precache != __NULL__) {
|
||||
g_weapons[i].precache();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
Decals_Init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_Draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
|
||||
pl.w_attack_next = Math_Time() + 0.5f;
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
|
||||
if (g_weapons[i].draw != __NULL__) {
|
||||
g_weapons[i].draw();
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_Holster(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
if (g_weapons[i].holster != __NULL__) {
|
||||
g_weapons[i].holster();
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_Primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
if (g_weapons[i].primary != __NULL__) {
|
||||
g_weapons[i].primary();
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_Secondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
if (g_weapons[i].secondary != __NULL__) {
|
||||
g_weapons[i].secondary();
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_Reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
if (g_weapons[i].reload != __NULL__) {
|
||||
g_weapons[i].reload();
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_Release(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
if (g_weapons[i].release != __NULL__) {
|
||||
g_weapons[i].release();
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_DrawCrosshair(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
if (g_weapons[i].crosshair != __NULL__) {
|
||||
g_weapons[i].crosshair();
|
||||
}
|
||||
}
|
||||
|
||||
string Weapons_GetViewmodel(int id)
|
||||
{
|
||||
if (g_weapons[id].vmodel != __NULL__) {
|
||||
return g_weapons[id].vmodel();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
string Weapons_GetWorldmodel(int id)
|
||||
{
|
||||
if (g_weapons[id].wmodel != __NULL__) {
|
||||
return g_weapons[id].wmodel();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
string Weapons_GetPlayermodel(int id)
|
||||
{
|
||||
if (g_weapons[id].pmodel != __NULL__) {
|
||||
return g_weapons[id].pmodel();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
string Weapons_GetDeathmessage(int id)
|
||||
{
|
||||
if (g_weapons[id].deathmsg != __NULL__) {
|
||||
return g_weapons[id].deathmsg();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
void Weapons_HUDPic(int id, int s, vector pos)
|
||||
{
|
||||
if (g_weapons[id].hudpic != __NULL__) {
|
||||
g_weapons[id].hudpic(s, pos);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Weapons_MakeVectors(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
makevectors(pl.v_angle);
|
||||
#else
|
||||
makevectors(view_angles);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_ViewAnimation(int i)
|
||||
{
|
||||
#ifdef CSQC
|
||||
View_PlayAnimation(i);
|
||||
#else
|
||||
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
|
||||
WriteByte( MSG_MULTICAST, EV_VIEWMODEL );
|
||||
WriteByte( MSG_MULTICAST, i );
|
||||
msg_entity = self;
|
||||
multicast( [0,0,0], MULTICAST_ONE );
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_ViewPunchAngle(vector add)
|
||||
{
|
||||
#ifdef CSQC
|
||||
View_AddPunchAngle(add);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_PlaySound(entity t, float ch, string s, float vol, float at)
|
||||
{
|
||||
#ifdef SSQC
|
||||
sound(t, ch, s, vol, at);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
entity g_decals;
|
||||
#define DECALS_MAX 16
|
||||
void Decals_Init(void)
|
||||
{
|
||||
entity nextdecal = spawn();
|
||||
g_decals = nextdecal;
|
||||
for ( int i = 0; i <= DECALS_MAX; i++ ) {
|
||||
nextdecal.classname = "decal";
|
||||
nextdecal.owner = spawn();
|
||||
|
||||
if ( i == DECALS_MAX ) {
|
||||
nextdecal.owner = g_decals;
|
||||
} else {
|
||||
nextdecal = nextdecal.owner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity Decals_Next(void)
|
||||
{
|
||||
entity ret = g_decals;
|
||||
g_decals = g_decals.owner;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Weapons_PlaceDecal(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
entity decal = Decals_Next();
|
||||
decal.think = infodecal;
|
||||
decal.texture = sprintf("{shot%d", floor(random(1,6)));
|
||||
decal.nextthink = time /*+ 0.1f*/;
|
||||
setorigin(decal, trace_endpos);
|
||||
#endif
|
||||
}
|
||||
void Weapons_PlaceBigDecal(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
entity decal = Decals_Next();
|
||||
decal.think = infodecal;
|
||||
decal.texture = sprintf("{bigshot%d", floor(random(1,6)));
|
||||
decal.nextthink = time /*+ 0.1f*/;
|
||||
setorigin(decal, trace_endpos);
|
||||
Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal);
|
||||
#endif
|
||||
}
|
||||
|
||||
int Weapons_IsPresent(player pl, int w)
|
||||
{
|
||||
if (pl.items & g_weapons[w].id) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
void Weapons_AddItem(player pl, int w)
|
||||
{
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
pl.items |= g_weapons[w].id;
|
||||
pl.activeweapon = w;
|
||||
|
||||
if (g_weapons[w].pickup != __NULL__) {
|
||||
g_weapons[w].pickup();
|
||||
}
|
||||
|
||||
Weapons_Draw();
|
||||
self = oldself;
|
||||
}
|
||||
|
||||
void Weapons_InitItem(int w)
|
||||
{
|
||||
itemweapon it = (itemweapon)self;
|
||||
spawnfunc_itemweapon();
|
||||
it.setitem(w);
|
||||
}
|
||||
|
||||
void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3)
|
||||
{
|
||||
/* Networked as bytes, since we don't need more. Clamp to avoid errors */
|
||||
pl.a_ammo1 = bound(0, a1, 255);
|
||||
pl.a_ammo2 = bound(0, a2, 255);
|
||||
pl.a_ammo3 = bound(0, a3, 255);
|
||||
}
|
||||
|
||||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max)
|
||||
{
|
||||
int iNeed = max - pl.(mag);
|
||||
int iHave = pl.(ammo);
|
||||
|
||||
if ( iNeed > iHave ) {
|
||||
pl.(mag) += iHave;
|
||||
pl.(ammo) = 0;
|
||||
} else {
|
||||
pl.(mag) += iNeed;
|
||||
pl.(ammo) -= iNeed;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
86
Source/shared/valve/weapons.h
Normal file
86
Source/shared/valve/weapons.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id; /* bitflag id */
|
||||
int slot;
|
||||
int slot_pos;
|
||||
|
||||
void() draw;
|
||||
void() holster;
|
||||
void() primary;
|
||||
void() secondary;
|
||||
void() reload;
|
||||
void() release;
|
||||
void() crosshair;
|
||||
|
||||
void() precache;
|
||||
void() pickup;
|
||||
string() vmodel;
|
||||
string() wmodel;
|
||||
string() pmodel;
|
||||
string() deathmsg;
|
||||
void(int, vector) hudpic;
|
||||
} weapon_t;
|
||||
|
||||
/* Weapon Indices for the weapon table */
|
||||
enum
|
||||
{
|
||||
WEAPON_NONE,
|
||||
WEAPON_CROWBAR,
|
||||
WEAPON_GLOCK,
|
||||
WEAPON_PYTHON,
|
||||
WEAPON_MP5,
|
||||
WEAPON_SHOTGUN,
|
||||
WEAPON_CROSSBOW,
|
||||
WEAPON_RPG,
|
||||
WEAPON_GAUSS,
|
||||
WEAPON_EGON,
|
||||
WEAPON_HORNETGUN,
|
||||
WEAPON_HANDGRENADE,
|
||||
WEAPON_SATCHEL,
|
||||
WEAPON_TRIPMINE,
|
||||
WEAPON_SNARK
|
||||
};
|
||||
|
||||
/* What the weapons do support and stuff */
|
||||
enum
|
||||
{
|
||||
AMMO_9MM,
|
||||
AMMO_357,
|
||||
AMMO_BUCKSHOT,
|
||||
AMMO_M203_GRENADE,
|
||||
AMMO_BOLT,
|
||||
AMMO_ROCKET,
|
||||
AMMO_URANIUM,
|
||||
AMMO_HANDGRENADE,
|
||||
AMMO_SATCHEL,
|
||||
AMMO_TRIPMINE,
|
||||
AMMO_SNARK,
|
||||
AMMO_HORNET
|
||||
};
|
||||
|
||||
void Weapons_DrawCrosshair(void);
|
||||
void Weapons_PlaceDecal(void);
|
||||
void Weapons_PlaceBigDecal(void);
|
||||
void Weapons_MakeVectors(void);
|
||||
void Weapons_ViewAnimation(int i);
|
||||
void Weapons_ViewPunchAngle(vector add);
|
||||
void Weapons_PlaySound(entity t, float ch, string s, float vol, float at);
|
||||
int Weapons_IsPresent(player pl, int w);
|
||||
|
||||
#ifdef SSQC
|
||||
void Weapons_InitItem(int w);
|
||||
void Weapons_AddItem(player pl, int w);
|
||||
string Weapons_GetWorldmodel(int id);
|
||||
void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3);
|
||||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max);
|
||||
#else
|
||||
void Weapons_HUDPic(int w, int s, vector pos);
|
||||
#endif
|
Binary file not shown.
BIN
cstrike/gfx.wad
Normal file
BIN
cstrike/gfx.wad
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
107
valve/default.cfg
Executable file
107
valve/default.cfg
Executable file
|
@ -0,0 +1,107 @@
|
|||
bind w +forward
|
||||
bind s +back
|
||||
bind a +moveleft
|
||||
bind d +moveright
|
||||
bind "0" "slot10"
|
||||
bind "1" "slot1"
|
||||
bind "2" "slot2"
|
||||
bind "3" "slot3"
|
||||
bind "4" "slot4"
|
||||
bind "5" "slot5"
|
||||
bind "6" "slot6"
|
||||
bind "7" "slot7"
|
||||
bind "8" "slot8"
|
||||
bind "9" "slot9"
|
||||
bind "q" "lastinv"
|
||||
bind "UPARROW" "+forward"
|
||||
bind "DOWNARROW" "+back"
|
||||
bind "LEFTARROW" "+left"
|
||||
bind "RIGHTARROW" "+right"
|
||||
bind MOUSE1 +attack
|
||||
bind MOUSE2 +attack2
|
||||
bind "MWHEELDOWN" "invnext"
|
||||
bind "MWHEELUP" "invprev"
|
||||
bind r +reload
|
||||
bind e +use
|
||||
bind n nightvision
|
||||
bind g drop
|
||||
bind TAB +showscores
|
||||
bind c radio3
|
||||
bind x radio2
|
||||
bind z radio1
|
||||
bind y messagemode
|
||||
bind u messagemode2
|
||||
bind t "impulse 201"
|
||||
|
||||
bind SPACE +jump
|
||||
bind CTRL +duck
|
||||
bind SHIFT +speed
|
||||
|
||||
bind b buy
|
||||
bind m chooseteam
|
||||
bind ESC togglemenu
|
||||
|
||||
// Game variables
|
||||
seta maxplayers 8
|
||||
seta mp_startmoney "800"
|
||||
seta mp_buytime 90
|
||||
seta mp_freezetime 6
|
||||
seta mp_c4timer 45
|
||||
seta mp_roundtime 5
|
||||
seta fcs_knifeonly 0
|
||||
seta fcs_swapteams 0
|
||||
seta fcs_nopickups 0
|
||||
seta fcs_reward_kill 300
|
||||
seta fcs_penalty_pain -150
|
||||
seta fcs_penalty_kill -1500
|
||||
seta fcs_maxmoney 16000
|
||||
seta fcs_fillweapons 0
|
||||
seta fcs_autoreload 0
|
||||
|
||||
// Movement Variables
|
||||
seta sv_maxspeed 240
|
||||
seta cl_forwardspeed 400
|
||||
seta cl_sidespeed 400
|
||||
seta cl_backspeed 400
|
||||
seta cl_movespeedkey 0.5
|
||||
seta sv_accelerate "5"
|
||||
seta pm_bunnyspeedcap "0"
|
||||
seta pm_stepdown 0
|
||||
|
||||
seta cl_bob 0
|
||||
seta v_bobcycle 0.8
|
||||
seta v_bob 0.01
|
||||
seta v_bobup 0.5
|
||||
seta r_particledesc default
|
||||
seta con_textsize "12"
|
||||
seta con_color "255 150 0"
|
||||
seta vgui_color "255 170 0"
|
||||
seta cross_color "0 255 0"
|
||||
|
||||
hostname "FreeCS Server"
|
||||
seta vid_conautoscale "1"
|
||||
|
||||
seta r_polygonoffset_submodel_offset "0"
|
||||
seta r_polygonoffset_submodel_factor "0"
|
||||
seta r_fullbrightSkins "0"
|
||||
seta r_fb_models "0"
|
||||
seta v_contentblend "0"
|
||||
seta com_nogamedirnativecode "0"
|
||||
seta cl_cursor_scale "1"
|
||||
seta r_shadow_realtime_world_shadows "0"
|
||||
seta r_shadow_realtime_dlight_shadows "0"
|
||||
seta r_imageexensions "tga bmp pcx"
|
||||
seta gl_blacklist_debug_glsl 0
|
||||
seta vid_conautoscale "1"
|
||||
seta scr_conalpha "1"
|
||||
seta scr_sshot_type "tga"
|
||||
seta con_notifylines "0"
|
||||
seta con_logcenterprint "0"
|
||||
seta maxplayers "8"
|
||||
seta lang "en_us"
|
||||
seta cfg_save_auto "1"
|
||||
seta r_meshpitch "1"
|
||||
seta gl_overbright "0"
|
||||
seta cl_idlefps "0"
|
||||
seta maxpitch "89"
|
||||
seta minpitch "-89"
|
BIN
valve/gfx.wad
BIN
valve/gfx.wad
Binary file not shown.
|
@ -29,8 +29,16 @@ varying vec3 light;
|
|||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
tex_c = v_texcoord;
|
||||
light = e_light_ambient + ( e_light_mul * dot( n, e_light_dir ) );
|
||||
|
||||
light = e_light_ambient + (e_light_mul * dot(n, e_light_dir));
|
||||
|
||||
#ifdef CHROME
|
||||
vec3 viewc = normalize(e_eyepos - v_position.xyz);
|
||||
float d = dot(n, viewc);
|
||||
vec3 reflected = n * 2 * d - viewc;
|
||||
tex_c.x = 0.5 + reflected.y * 0.5;
|
||||
tex_c.y = 0.5 - reflected.z * 0.5;
|
||||
#endif
|
||||
|
||||
if (light.r > 1.0f) {
|
||||
light.r = 1.0f;
|
||||
}
|
||||
|
|
BIN
valve/menu.dat
BIN
valve/menu.dat
Binary file not shown.
BIN
valve/particles/decal_glass.tga
Executable file
BIN
valve/particles/decal_glass.tga
Executable file
Binary file not shown.
BIN
valve/particles/decal_shot.tga
Executable file
BIN
valve/particles/decal_shot.tga
Executable file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue