Added impulse 100, also known as the flashlight

This commit is contained in:
Marco Cawthorne 2019-03-01 23:24:46 +01:00
parent 29ebe5775e
commit 0fd206bc2f
11 changed files with 84 additions and 34 deletions

View file

@ -177,13 +177,19 @@ void CSQC_UpdateView(float w, float h, float focus)
View_DrawViewModel(); View_DrawViewModel();
} }
// TODO: Move this someplace less... entry-ish. like into a pre-draw.
if (pl.flags & FL_FLASHLIGHT) {
traceline(getproperty(VF_ORIGIN), getproperty(VF_ORIGIN) + (v_forward * 9000), FALSE, self);
dynamiclight_add(trace_endpos, 128, [1,1,1]);
}
addentities(MASK_ENGINE); addentities(MASK_ENGINE);
setproperty(VF_MIN, video_mins); setproperty(VF_MIN, video_mins);
setproperty(VF_SIZE, video_res); setproperty(VF_SIZE, video_res);
setproperty(VF_ANGLES, view_angles + pSeat->vPunchAngle); setproperty(VF_ANGLES, view_angles + pSeat->vPunchAngle);
setproperty(VF_DRAWWORLD, 1); setproperty(VF_DRAWWORLD, 1);
renderscene(); renderscene();
pl.w_attack_next -= clframetime; pl.w_attack_next -= clframetime;
pl.w_idle_next -= clframetime; pl.w_idle_next -= clframetime;
@ -196,6 +202,7 @@ void CSQC_UpdateView(float w, float h, float focus)
View_DropPunchAngle(); View_DropPunchAngle();
Fade_Update((int)video_mins[0],(int)video_mins[1], (int)w, (int)h); Fade_Update((int)video_mins[0],(int)video_mins[1], (int)w, (int)h);
#ifdef CSTRIKE #ifdef CSTRIKE
Cstrike_PostDraw((int)video_mins[0],(int)video_mins[1], (int)w, (int)h); Cstrike_PostDraw((int)video_mins[0],(int)video_mins[1], (int)w, (int)h);
#endif #endif

View file

@ -34,10 +34,29 @@ const vector VEC_PLAYER_CVIEWPOS = [0,0,12];
#define INPUT_BUTTON7 0x00000040 #define INPUT_BUTTON7 0x00000040
#define INPUT_BUTTON8 0x00000080 #define INPUT_BUTTON8 0x00000080
#define FL_USERELEASED (1<<13) // engine reserved flags
#define FL_CROUCHING (1<<19) #define FL_FLY (1<<0)
#define FL_SEMI_TOGGLED (1<<15) #define FL_SWIM (1<<1)
#define FL_FROZEN (1<<17) #define FL_GLIMPSE (1<<2)
#define FL_REMOVEME (1<<18) #define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_ITEM (1<<8)
#define FL_ONGROUND (1<<9)
#define FL_PARTIALGROUND (1<<10)
#define FL_WATERJUMP (1<<11)
#define FL_JUMPRELEASED (1<<12)
#define FL_FINDABLE_NONSOLID (1<<14)
#define FLQW_LAGGEDMOVE (1<<16)
// FreeCS flags
#define FL_USERELEASED (1<<17)
#define FL_REMOVEME (1<<18)
#define FL_CROUCHING (1<<19)
#define FL_SEMI_TOGGLED (1<<20)
#define FL_FROZEN (1<<21)
#define FL_FLASHLIGHT (1<<21)
#define clamp(d,min,max) bound(min,d,max) #define clamp(d,min,max) bound(min,d,max)

View file

@ -23,7 +23,7 @@ void Effect_CreateSpark(vector pos, vector ang);
void Effect_BreakModel(vector mins, vector maxs,vector vel, float mat); void Effect_BreakModel(vector mins, vector maxs,vector vel, float mat);
string Util_FixModel(string mdl) string Util_FixModel(string mdl)
{ {
int c = tokenizebyseparator(mdl, "/", "\\ "); int c = tokenizebyseparator(mdl, "/", "\\ ");
string newpath = ""; string newpath = "";
@ -33,9 +33,5 @@ string Util_FixModel(string mdl)
// Kill the first / // Kill the first /
newpath = substring(newpath, 1, strlen(newpath)-1); newpath = substring(newpath, 1, strlen(newpath)-1);
#if 1
return newpath; return newpath;
#else
return mdl;
#endif
} }

View file

@ -6,7 +6,6 @@
* *
****/ ****/
void Empty(void) {} void Empty(void) {}
void Game_ClientConnect(void) void Game_ClientConnect(void)

View file

@ -31,6 +31,15 @@ void Game_Input(void)
Player_UseUp(); Player_UseUp();
} }
if (self.impulse == 100) {
if (self.flags & FL_FLASHLIGHT) {
self.flags &= ~FL_FLASHLIGHT;
} else {
self.flags |= FL_FLASHLIGHT;
}
sound (self, CHAN_ITEM, "items/flashlight1.wav", 1, ATTN_IDLE);
}
if (cvar("sv_cheats") == 1) { if (cvar("sv_cheats") == 1) {
player pl = (player)self; player pl = (player)self;
if (self.impulse == 101) { if (self.impulse == 101) {

View file

@ -1,23 +1,43 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/* These are stored in the bitflag field */ #define ITEM_CROWBAR 0x00000001
enumflags #define ITEM_GLOCK 0x00000002
{ #define ITEM_PYTHON 0x00000004
ITEM_CROWBAR, #define ITEM_MP5 0x00000008
ITEM_GLOCK, #define ITEM_CROSSBOW 0x00000010
ITEM_PYTHON, #define ITEM_SHOTGUN 0x00000020
ITEM_MP5, #define ITEM_RPG 0x00000040
ITEM_CROSSBOW, #define ITEM_GAUSS 0x00000080
ITEM_SHOTGUN,
ITEM_RPG, #define ITEM_EGON 0x00000100
ITEM_GAUSS, #define ITEM_HORNETGUN 0x00000200
ITEM_EGON, #define ITEM_HANDGRENADE 0x00000400
ITEM_HORNETGUN, #define ITEM_TRIPMINE 0x00000800
ITEM_HANDGRENADE, #define ITEM_SATCHEL 0x00001000
ITEM_TRIPMINE, #define ITEM_SNARK 0x00002000
ITEM_SATCHEL, #define ITEM_SUIT 0x00004000
ITEM_SNARK, #define ITEM_LONGJUMP 0x00008000
ITEM_SUIT,
ITEM_LONGJUMP, #define ITEM_HEALTHKIT 0x00010000
ITEM_HEALTHKIT, #define ITEM_BATTERY 0x00020000
ITEM_BATTERY #define ITEM_UNUSED19 0x00040000
}; #define ITEM_UNUSED20 0x00080000
#define ITEM_UNUSED21 0x00100000
#define ITEM_UNUSED22 0x00200000
#define ITEM_UNUSED23 0x00400000
#define ITEM_UNUSED24 0x00800000
#define ITEM_UNUSED25 0x01000000
#define ITEM_UNUSED26 0x02000000
#define ITEM_UNUSED27 0x04000000
#define ITEM_UNUSED28 0x08000000
#define ITEM_UNUSED29 0x10000000
#define ITEM_UNUSED30 0x20000000
#define ITEM_UNUSED31 0x40000000
#define ITEM_UNUSED32 0x80000000

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.