- Added everything needed for networked sprays

- Switched to custom pmove code (early, WIP) instead of the engine one, again
- Made nightvision compatible with splitscreen modes
- Player animation fixes
- Prediction fixes
- Fixed radius damage, so grenades and bombs should apply proper damage now
- Added func_wall_toggle
- Small entity fixes
This commit is contained in:
Marco Cawthorne 2019-01-03 02:26:39 +01:00
parent 32b6e85d28
commit 5fa7002844
81 changed files with 2113 additions and 1503 deletions

View file

@ -2249,7 +2249,7 @@ float(string name) iscachedpic = #316; /*
string(string name, optional float trywad) precache_pic = #317; /*
Forces the engine to load the named image. If trywad is specified, the specified name must any lack path and extension. */
void(string imagename, int width, int height, int *pixeldata) r_uploadimage = #0:r_uploadimage; /* Part of FTE_CSQC_RAWIMAGES
void(string imagename, int width, int height, void *data, optional int datasize, int format) r_uploadimage = #0:r_uploadimage; /* Part of FTE_CSQC_RAWIMAGES
Updates a texture with the specified rgba data. Will be created if needed. */
int*(string filename, __out int width, __out int height) r_readimage = #0:r_readimage; /* Part of FTE_CSQC_RAWIMAGES

View file

@ -99,6 +99,7 @@ struct
vector vPlayerOrigin;
vector vPlayerOriginOld;
vector vPlayerVelocity;
float fPlayerFlags;
// Camera Fields
//entity ePlayerEnt;
@ -169,6 +170,8 @@ float clframetime;
float fWeaponEventPlayer;
.float fWeaponLast;
.float fWeaponBoneID;
.float health;
.float oldhealth;
void Animation_ShootWeapon( entity ePlayer );
void Animation_ReloadWeapon( entity ePlayer );
@ -177,3 +180,7 @@ void CSQC_DrawText( vector vPos, string sString, vector vSize, vector vColor, fl
drawfont = fFont;
drawstring( vPos, sString, vSize, vColor, fAlpha, fFlags );
}
#if defined(CSQC)
int(float playernum, string keyname, optional void *outptr, int size) getplayerkeyblob = #0;
#endif

View file

@ -30,7 +30,7 @@ var int iLineScroll = 0;
float fChatTime;
float fChatAlpha;
string sMSGBuffer[ CHAT_LINES ];
string sMSGBuffer[CHAT_LINES];
/*
=================
@ -39,27 +39,27 @@ CSQC_Parse_Print
Receives a message and sorts it into the chat messagebuffer
=================
*/
void CSQC_Parse_Print(string sMessage, float fLevel ) {
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 (fLevel != PRINT_CHAT) {
sMessage = sprintf("^xF80%s", sMessage);
}
if ( iLineScroll < ( CHAT_LINES - 1 ) ) {
sMSGBuffer[ iLineScroll + 1 ] = 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 ];
for (int i = 0; i < (CHAT_LINES - 1); i++) {
sMSGBuffer[i] = sMSGBuffer[i + 1];
}
sMSGBuffer[ CHAT_LINES - 1 ] = sMessage;
sMSGBuffer[CHAT_LINES - 1] = sMessage;
}
fChatTime = time + CHAT_TIME;
fChatAlpha = 1.0f;
// Log to console
localcmd( sprintf( "echo \"%s\"\n", sMessage ) );
localcmd(sprintf("echo \"%s\"\n", sMessage));
}
/*
@ -69,29 +69,29 @@ CSQC_DrawChat
Just prints whatever is in the chat buffer and removes lines after some time.
=================
*/
void CSQC_DrawChat( void ) {
vector vChatPos = vVideoMins + [ 16, vVideoResolution_y - 128 ];
void CSQC_DrawChat(void) {
vector vChatPos = vVideoMins + [16, vVideoResolution_y - 128];
// Remove messages after a fChatTime has passed
if ( fChatTime < time ) {
if (fChatTime < time) {
fChatAlpha -= frametime;
} else {
fChatAlpha = 1.0f;
}
if ( fChatAlpha > 0.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 );
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 ] );
string sDraw = sMSGBuffer[0];
for (int i = 1; i < CHAT_LINES; i++) {
sDraw = sprintf("%s\n%s\n", sDraw, sMSGBuffer[i]);
}
drawtextfield( vChatPos, [vVideoResolution_x - 32, CHAT_LINES * 12 ], 1, sDraw );
drawtextfield(vChatPos, [vVideoResolution_x - 32, CHAT_LINES * 12], 1, sDraw);
#endif
}
}
@ -106,30 +106,30 @@ Read centerprints from a buffer and display them with alpha and whatnot
float fCenterPrintAlpha;
float fCenterPrintTime;
float fCenterPrintLines;
string sCenterPrintBuffer[ 18 ];
string sCenterPrintBuffer[18];
void CSQC_DrawCenterprint( void ) {
if ( fCenterPrintAlpha <= 0 ) {
void CSQC_DrawCenterprint(void) {
if (fCenterPrintAlpha <= 0) {
return;
}
vector vCenterPrintPos;
if ( fCenterPrintTime > time ) {
if (fCenterPrintTime > time) {
fCenterPrintAlpha = 1;
} else {
fCenterPrintAlpha -= frametime;
if ( fCenterPrintAlpha < 0 ) {
if (fCenterPrintAlpha < 0) {
fCenterPrintAlpha = 0;
}
}
vCenterPrintPos_y = vVideoMins_y + ( vVideoResolution_y / 2 ) - ( fCenterPrintLines - 4 ) - 69;
vCenterPrintPos_y = vVideoMins_y + (vVideoResolution_y / 2) - (fCenterPrintLines - 4) - 69;
for ( int i = 0; i < ( fCenterPrintLines ); i++ ) {
vCenterPrintPos_x = vVideoMins_x + ( vVideoResolution_x / 2 ) - ( stringwidth( sCenterPrintBuffer[ i ], TRUE, '12 12' ) / 2 );
drawstring( vCenterPrintPos, sCenterPrintBuffer[ i ], '12 12', '1 1 1', fCenterPrintAlpha, 0 );
for (int i = 0; i < (fCenterPrintLines); i++) {
vCenterPrintPos_x = vVideoMins_x + (vVideoResolution_x / 2) - (stringwidth(sCenterPrintBuffer[i], TRUE, '12 12') / 2);
drawstring(vCenterPrintPos, sCenterPrintBuffer[i], '12 12', '1 1 1', fCenterPrintAlpha, 0);
vCenterPrintPos_y += 8;
}
}
@ -143,11 +143,11 @@ 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" );
float CSQC_Parse_CenterPrint(string sMessage) {
fCenterPrintLines = tokenizebyseparator(sMessage, "\n");
for( int i = 0; i < ( fCenterPrintLines ); i++ ) {
sCenterPrintBuffer[ i ] = sprintf( "^xF80%s", argv( i ) );
for(int i = 0; i < (fCenterPrintLines); i++) {
sCenterPrintBuffer[i] = sprintf("^xF80%s", argv(i));
}
fCenterPrintAlpha = 1;
@ -156,27 +156,27 @@ float CSQC_Parse_CenterPrint( string sMessage ) {
return TRUE;
}
void CSQC_CalcViewport( int s, float fWinWidth, float fWinHeight ) {
void CSQC_CalcViewport(int s, float fWinWidth, float fWinHeight) {
//FIXME: this is awkward. renderscene internally rounds to pixels.
//on the other hand, drawpic uses linear filtering and multisample and stuff.
//this means that there can be a pixel or so difference between scene and 2d.
//as a general rule, you won't notice unless there's some big drawfills.
switch ( numclientseats ) {
switch (numclientseats) {
case 3:
if ( !s ) {
if (!s) {
case 2:
vVideoResolution = [ fWinWidth, fWinHeight * 0.5 ];
vVideoMins = [ 0, ( s & 1 ) * vVideoResolution_y ];
vVideoResolution = [fWinWidth, fWinHeight * 0.5];
vVideoMins = [0, (s & 1) * vVideoResolution_y];
break;
}
s++;
case 4:
vVideoResolution = [ fWinWidth, fWinHeight ] * 0.5;
vVideoMins = [ (s&1) * vVideoResolution_x, ( s / 2i ) * vVideoResolution_y ];
vVideoResolution = [fWinWidth, fWinHeight] * 0.5;
vVideoMins = [(s&1) * vVideoResolution_x, (s / 2i) * vVideoResolution_y];
break;
default:
vVideoResolution = [ fWinWidth, fWinHeight ];
vVideoMins = [ 0, 0 ];
vVideoResolution = [fWinWidth, fWinHeight];
vVideoMins = [0, 0];
break;
}
}
@ -188,121 +188,123 @@ CSQC_UpdateView
Entry point for drawing on the client
=================
*/
void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
void CSQC_UpdateView(float fWinWidth, float fWinHeight, float fGameFocus) {
float needcursor;
int s;
vVideoResolution_x = fWinWidth;
vVideoResolution_y = fWinHeight;
clearscene();
setproperty( VF_DRAWENGINESBAR, 0 );
setproperty( VF_DRAWCROSSHAIR, 0 );
setproperty(VF_DRAWENGINESBAR, 0);
setproperty(VF_DRAWCROSSHAIR, 0);
//just in case...
if ( numclientseats > seats.length ) {
if (numclientseats > seats.length) {
numclientseats = seats.length;
}
for ( s = seats.length; s-- > numclientseats; ) {
pSeat = &seats[ s ];
for (s = seats.length; s-- > numclientseats;) {
pSeat = &seats[s];
pSeat->fVGUI_Display = VGUI_MOTD;
pSeat->ePlayer = world;
}
for ( s = numclientseats; s-- > 0; ) {
pSeat = &seats[ s ];
setproperty( VF_ACTIVESEAT, (float)s );
pSeat->ePlayer = self = findfloat( world, entnum, player_localentnum );
if ( self ) {
Player_Predict();
for (s = numclientseats; s-- > 0;) {
pSeat = &seats[s];
CSQC_CalcViewport(s, fWinWidth, fWinHeight);
setproperty(VF_ACTIVESEAT, (float)s);
pSeat->ePlayer = self = findfloat(world, entnum, player_localentnum);
if (self) {
Player_PreUpdate();
}
}
pSeat->vPlayerOrigin = self.origin;
pSeat->vPlayerVelocity = self.velocity;
pSeat->fPlayerFlags = self.flags;
addentities( MASK_ENGINE );
// Render 3D Game Loop
for ( s = 0; s < numclientseats; s++ ) {
pSeat = &seats[ s ];
setproperty( VF_ACTIVESEAT, (float)s );
// Render 3D Game Loop
Nightvision_PreDraw();
// Don't hide the player entity
if ( autocvar_cl_thirdperson == TRUE && getstatf( STAT_HEALTH ) ) {
setproperty( VF_VIEWENTITY, (float)0 );
if (autocvar_cl_thirdperson == TRUE && getstatf(STAT_HEALTH)) {
setproperty(VF_VIEWENTITY, (float)0);
} else {
setproperty( VF_VIEWENTITY, (float)player_localentnum );
setproperty(VF_VIEWENTITY, (float)player_localentnum);
}
setproperty( VF_AFOV, cvar( "fov" ) * ( getstatf( STAT_VIEWZOOM ) ) );
setsensitivityscaler( ( getstatf( STAT_VIEWZOOM ) ) );
setproperty(VF_AFOV, cvar("fov") * (getstatf(STAT_VIEWZOOM)));
setsensitivityscaler((getstatf(STAT_VIEWZOOM)));
View_Stairsmooth();
// When Cameratime is active, draw on the forced coords instead
if ( pSeat->fCameraTime > time ) {
setproperty( VF_ORIGIN, pSeat->vCameraPos ) ;
if (pSeat->fCameraTime > time) {
setproperty(VF_ORIGIN, pSeat->vCameraPos);
setproperty(VF_CL_VIEWANGLES, pSeat->vCameraAngle);
} else {
if ( getstatf( STAT_HEALTH ) ) {
if ( autocvar_cl_thirdperson == TRUE ) {
makevectors( view_angles );
vector vStart = [ pSeat->vPlayerOrigin[0], pSeat->vPlayerOrigin[1], pSeat->vPlayerOrigin[2] + 16 ] + ( v_right * 4 );
vector vEnd = vStart + ( v_forward * -48 ) + '0 0 16' + ( v_right * 4 );
traceline( vStart, vEnd, FALSE, self );
setproperty( VF_ORIGIN, trace_endpos + ( v_forward * 5 ) );
if (getstatf(STAT_HEALTH)) {
if (autocvar_cl_thirdperson == TRUE ) {
makevectors(view_angles);
vector vStart = [pSeat->vPlayerOrigin[0], pSeat->vPlayerOrigin[1], pSeat->vPlayerOrigin[2] + 16] + (v_right * 4);
vector vEnd = vStart + (v_forward * -48) + '0 0 16' + (v_right * 4);
traceline(vStart, vEnd, FALSE, self);
setproperty(VF_ORIGIN, trace_endpos + (v_forward * 5));
} else {
setproperty( VF_ORIGIN, pSeat->vPlayerOrigin + [ 0, 0, getstatf( STAT_VIEWHEIGHT ) ] );
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin + [0, 0, getstatf(STAT_VIEWHEIGHT)]);
}
} else {
setproperty( VF_ORIGIN, pSeat->vPlayerOrigin );
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin);
}
View_DrawViewModel();
}
CSQC_CalcViewport( s, fWinWidth, fWinHeight );
setproperty( VF_MIN, vVideoMins );
setproperty( VF_SIZE, vVideoResolution );
setproperty( VF_ANGLES, view_angles + pSeat->vPunchAngle );
setproperty( VF_DRAWWORLD, 1 );
renderscene();
}
// Render Overlays, such as the HUD
for ( s = 0; s < numclientseats; s++ ) {
pSeat = &seats[ s ];
setproperty( VF_ACTIVESEAT, (float)s );
CSQC_CalcViewport( s, fWinWidth, fWinHeight );
Fade_Update ( vVideoMins[0],vVideoMins[1], fWinWidth, fWinHeight );
View_DropPunchAngle();
Nightvision_PostDraw();
if( fGameFocus == TRUE ) {
addentities(MASK_ENGINE);
setproperty(VF_MIN, vVideoMins);
setproperty(VF_SIZE, vVideoResolution);
setproperty(VF_ANGLES, view_angles + pSeat->vPunchAngle);
setproperty(VF_DRAWWORLD, 1);
renderscene();
View_DropPunchAngle();
Fade_Update((int)vVideoMins[0],(int)vVideoMins[1], (int)fWinWidth, (int)fWinHeight);
Nightvision_PostDraw((int)vVideoMins[0],(int)vVideoMins[1], (int)fWinWidth, (int)fWinHeight);
if(fGameFocus == TRUE) {
// The spectator sees things... differently
if ( getplayerkeyvalue( player_localnum, "*spec" ) != "0" ) {
if (getplayerkeyvalue(player_localnum, "*spec") != "0") {
VGUI_DrawSpectatorHUD();
} else {
HUD_Draw();
}
HUD_DrawOrbituaries();
HUD_DrawVoice();
CSQC_DrawChat();
// Don't even try to draw centerprints and VGUI menus when scores are shown
if ( pSeat->iShowScores == TRUE || getstatf( STAT_GAMESTATE ) == GAME_OVER ) {
if (pSeat->iShowScores == TRUE || getstatf(STAT_GAMESTATE) == GAME_OVER) {
VGUI_Scores_Show();
} else {
} else {
CSQC_DrawCenterprint();
needcursor |= CSQC_VGUI_Draw();
}
}
if (self) {
Player_ResetPrediction();
}
}
pSeat = (void*)0x70000000i;
if ( needcursor ) {
setcursormode( TRUE, "gfx/cursor", '0 0 0', 1.0f );
if (needcursor) {
setcursormode(TRUE, "gfx/cursor", '0 0 0', 1.0f);
} else {
setcursormode( FALSE, "gfx/cursor", '0 0 0', 1.0f );
setcursormode(FALSE, "gfx/cursor", '0 0 0', 1.0f);
}
Sound_ProcessWordQue();
}
@ -313,6 +315,6 @@ CSQC_UpdateViewLoading
Doesn't really do anything useful yet
=================
*/
void CSQC_UpdateViewLoading( float fWinWidth, float fWinHeight, float fGameFocus ) {
drawfill( [ 0, 0 ], [ fWinWidth, fWinHeight ], [ 1, 1, 1 ], 1, 0 );
void CSQC_UpdateViewLoading(float fWinWidth, float fWinHeight, float fGameFocus) {
drawfill([0, 0], [fWinWidth, fWinHeight], [1, 1, 1], 1, 0);
}

View file

@ -64,29 +64,31 @@ void CSQC_Ent_Update( float flIsNew ) {
self.solid = SOLID_SLIDEBOX;
self.predraw = Player_PreDraw;
self.drawmask = MASK_ENGINE;
self.pmove_frame = servercommandframe;
self.customphysics = Empty;
setsize( self, VEC_HULL_MIN, VEC_HULL_MAX );
}
self.modelindex = readbyte();
self.modelindex = readshort();
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
self.flUpAngle = readcoord() / 90;
self.angles_y = readcoord();
self.angles_z = readcoord();
self.velocity_x = readshort();
self.velocity_y = readshort();
self.velocity_z = readshort();
self.velocity_x = readcoord();
self.velocity_y = readcoord();
self.velocity_z = readcoord();
self.flags = readfloat();
self.pmove_flags = readfloat();
self.weapon = readbyte();
if ( self.flags & FL_CROUCHING ) {
setsize( self, VEC_CHULL_MIN, VEC_CHULL_MAX );
} else {
setsize( self, VEC_HULL_MIN, VEC_HULL_MAX );
}
self.health = readbyte();
self.movetype = readfloat();
setorigin( self, self.origin );
if (self.health < self.oldhealth) {
Animation_PlayerTopTemp( ANIM_GUT_FLINCH, 0.1f );
}
self.oldhealth = self.health;
} else if ( fEntType == ENT_AMBIENTSOUND ) {
self.origin_x = readcoord();
self.origin_y = readcoord();
@ -102,22 +104,7 @@ void CSQC_Ent_Update( float flIsNew ) {
Effect_AnimatedSprite( self.origin, readfloat(), readfloat(), readfloat(), readfloat(), readfloat() );
} else if ( fEntType == ENT_SPRAY ) {
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
self.angles_x = readcoord();
self.angles_y = readcoord();
self.angles_z = readcoord();
self.color_x = 1.0f - ( readbyte() / 255 );
self.color_y = 1.0f - ( readbyte() / 255 );
self.color_z = 1.0f - ( readbyte() / 255 );
string sLogo = readstring();
self.classname = sprintf( "spray_%s", sLogo );
self.predraw = Effect_Spraypaint;
self.drawmask = MASK_ENGINE;
Spraylogo_Parse();
} else if ( fEntType == ENT_DECAL ) {
string decalname = "";
string decalshader = "";

View file

@ -31,102 +31,103 @@ CSQC_ConsoleCommand_Init
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" );
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("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("buy");
registercommand("chooseteam");
registercommand("lastinv");
registercommand("invnext");
registercommand("invprev");
registercommand("+showscores");
registercommand("-showscores");
registercommand("nightvision");
registercommand("drop");
registercommand( "radio1" );
registercommand( "radio2" );
registercommand( "radio3" );
registercommand("radio1");
registercommand("radio2");
registercommand("radio3");
registercommand( "glock" );
registercommand( "usp" );
registercommand( "p228" );
registercommand( "deagle" );
registercommand( "fn57" );
registercommand( "elites" );
registercommand( "m3" );
registercommand( "xm1014" );
registercommand( "tmp" );
registercommand( "mac10" );
registercommand( "mp5" );
registercommand( "ump45" );
registercommand( "p90" );
registercommand( "ak47" );
registercommand( "m4a1" );
registercommand( "sg552" );
registercommand( "aug" );
registercommand( "scout" );
registercommand( "sg550" );
registercommand( "awp" );
registercommand( "g3sg1" );
registercommand( "m249" );
registercommand("glock");
registercommand("usp");
registercommand("p228");
registercommand("deagle");
registercommand("fn57");
registercommand("elites");
registercommand("m3");
registercommand("xm1014");
registercommand("tmp");
registercommand("mac10");
registercommand("mp5");
registercommand("ump45");
registercommand("p90");
registercommand("ak47");
registercommand("m4a1");
registercommand("sg552");
registercommand("aug");
registercommand("scout");
registercommand("sg550");
registercommand("awp");
registercommand("g3sg1");
registercommand("m249");
registercommand( "primammo" );
registercommand( "buyammo1" );
registercommand( "secammo" );
registercommand( "buyammo2" );
registercommand("primammo");
registercommand("buyammo1");
registercommand("secammo");
registercommand("buyammo2");
registercommand( "vest" );
registercommand( "vesthelm" );
registercommand( "flash" );
registercommand( "hegren" );
registercommand( "vsgren" );
registercommand( "defuser" );
registercommand( "nvg" );
registercommand("vest");
registercommand("vesthelm");
registercommand("flash");
registercommand("hegren");
registercommand("vsgren");
registercommand("defuser");
registercommand("nvg");
registercommand( "coverme" );
registercommand( "takepoint" );
registercommand( "holdpos" );
registercommand( "regroup" );
registercommand( "followme" );
registercommand( "takingfire" );
registercommand( "go" );
registercommand( "fallback" );
registercommand( "sticktog" );
registercommand( "getinpos" );
registercommand( "stormfront" );
registercommand( "report" );
registercommand( "roger" );
registercommand( "enemyspot" );
registercommand( "needbackup" );
registercommand( "sectorclear" );
registercommand( "inposition" );
registercommand( "reportingin" );
registercommand( "getout" );
registercommand( "negative" );
registercommand( "enemydown" );
registercommand("coverme");
registercommand("takepoint");
registercommand("holdpos");
registercommand("regroup");
registercommand("followme");
registercommand("takingfire");
registercommand("go");
registercommand("fallback");
registercommand("sticktog");
registercommand("getinpos");
registercommand("stormfront");
registercommand("report");
registercommand("roger");
registercommand("enemyspot");
registercommand("needbackup");
registercommand("sectorclear");
registercommand("inposition");
registercommand("reportingin");
registercommand("getout");
registercommand("negative");
registercommand("enemydown");
}
/*
@ -136,363 +137,279 @@ CSQC_ConsoleCommand
Can interject cmds and create new ones
=================
*/
float CSQC_ConsoleCommand( string sCMD ) {
int s = (float)getproperty( VF_ACTIVESEAT ); //the engine will hide the p1 etc commands... which is fun...
pSeat = &seats[ s ];
float CSQC_ConsoleCommand(string sCMD) {
int s = (float)getproperty(VF_ACTIVESEAT); //the engine will hide the p1 etc commands... which is fun...
pSeat = &seats[s];
tokenize( sCMD );
tokenize(sCMD);
switch ( argv( 0 ) ) {
switch (argv(0)) {
case "lastinv":
HUD_DrawWeaponSelect_Last();
return TRUE;
break;
case "slot1":
localcmd( "impulse 1\n" );
return TRUE;
localcmd("impulse 1\n");
break;
case "slot2":
localcmd( "impulse 2\n" );
return TRUE;
localcmd("impulse 2\n");
break;
case "slot3":
localcmd( "impulse 3\n" );
return TRUE;
localcmd("impulse 3\n");
break;
case "slot4":
localcmd( "impulse 4\n" );
return TRUE;
localcmd("impulse 4\n");
break;
case "slot5":
localcmd( "impulse 5\n" );
return TRUE;
localcmd("impulse 5\n");
break;
case "slot6":
localcmd( "impulse 6\n" );
return TRUE;
localcmd("impulse 6\n");
break;
case "slot7":
localcmd( "impulse 7\n" );
return TRUE;
localcmd("impulse 7\n");
break;
case "slot8":
localcmd( "impulse 8\n" );
return TRUE;
localcmd("impulse 8\n");
break;
case "slot9":
localcmd( "impulse 9\n" );
return TRUE;
localcmd("impulse 9\n");
break;
case "slot10":
localcmd( "impulse 10\n" );
return TRUE;
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 );
return TRUE;
HUD_AddOrbituaries(player_localnum, TEAM_T, player_localnum, TEAM_CT, floor(random(1, CS_WEAPON_COUNT)), FALSE);
break;
case "minimap":
pSeat.iMapExpand = 1 - pSeat.iMapExpand;
return TRUE;
break;
case "overview_test":
pSeat.iOverview = 1 - pSeat.iOverview;
return TRUE;
break;
case "vox_test":
Sound_PlayVOX( sCMD );
return TRUE;
Sound_PlayVOX(sCMD);
break;
case "+attack2":
iInputAttack2 = TRUE;
return TRUE;
break;
case "-attack2":
iInputAttack2 = FALSE;
return TRUE;
break;
case "+reload":
iInputReload = TRUE;
return TRUE;
break;
case "-reload":
iInputReload = FALSE;
return TRUE;
break;
case "+use":
iInputUse = TRUE;
return TRUE;
break;
case "-use":
iInputUse = FALSE;
return TRUE;
break;
case "+duck":
iInputDuck = TRUE;
return TRUE;
break;
case "-duck":
iInputDuck = FALSE;
return TRUE;
break;
case "buy":
if( getstatf( STAT_BUYZONE ) == TRUE ) {
if(getstatf(STAT_BUYZONE) == TRUE) {
pSeat->fVGUI_Display = VGUI_BM_MAIN;
}
return TRUE;
break;
case "chooseteam":
pSeat->fVGUI_Display = VGUI_TEAMSELECT;
return TRUE;
break;
case "invnext":
HUD_DrawWeaponSelect_Back();
return TRUE;
break;
case "invprev":
HUD_DrawWeaponSelect_Forward();
return TRUE;
break;
case "+showscores":
pSeat->iShowScores = TRUE;
return TRUE;
break;
case "-showscores":
pSeat->iShowScores = FALSE;
return TRUE;
break;
case "nightvision":
Nightvision_Toggle();
return TRUE;
break;
case "drop":
sendevent( "WeaponDrop", "" );
return TRUE;
sendevent("WeaponDrop", "");
break;
case "glock":
sendevent( "PlayerBuyWeapon", "f", WEAPON_GLOCK18 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_GLOCK18);
break;
case "usp":
sendevent( "PlayerBuyWeapon", "f", WEAPON_USP45 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_USP45);
break;
case "p228":
sendevent( "PlayerBuyWeapon", "f", WEAPON_P228 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_P228);
break;
case "deagle":
sendevent( "PlayerBuyWeapon", "f", WEAPON_DEAGLE );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_DEAGLE);
break;
case "fn57":
sendevent( "PlayerBuyWeapon", "f", WEAPON_FIVESEVEN );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_FIVESEVEN);
break;
case "elites":
sendevent( "PlayerBuyWeapon", "f", WEAPON_ELITES );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_ELITES);
break;
case "m3":
sendevent( "PlayerBuyWeapon", "f", WEAPON_M3 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_M3);
break;
case "xm1014":
sendevent( "PlayerBuyWeapon", "f", WEAPON_XM1014 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_XM1014);
break;
case "tmp":
sendevent( "PlayerBuyWeapon", "f", WEAPON_TMP );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_TMP);
break;
case "mac10":
sendevent( "PlayerBuyWeapon", "f", WEAPON_MAC10 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_MAC10);
break;
case "mp5":
sendevent( "PlayerBuyWeapon", "f", WEAPON_MP5 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_MP5);
break;
case "ump45":
sendevent( "PlayerBuyWeapon", "f", WEAPON_UMP45 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_UMP45);
break;
case "p90":
sendevent( "PlayerBuyWeapon", "f", WEAPON_P90 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_P90);
break;
case "ak47":
sendevent( "PlayerBuyWeapon", "f", WEAPON_AK47 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_AK47);
break;
case "m4a1":
sendevent( "PlayerBuyWeapon", "f", WEAPON_M4A1 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_M4A1);
break;
case "sg552":
sendevent( "PlayerBuyWeapon", "f", WEAPON_SG552 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_SG552);
break;
case "aug":
sendevent( "PlayerBuyWeapon", "f", WEAPON_AUG );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_AUG);
break;
case "scout":
sendevent( "PlayerBuyWeapon", "f", WEAPON_SCOUT );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_SCOUT);
break;
case "sg550":
sendevent( "PlayerBuyWeapon", "f", WEAPON_SG550 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_SG550);
break;
case "awp":
sendevent( "PlayerBuyWeapon", "f", WEAPON_AWP );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_AWP);
break;
case "g3sg1":
sendevent( "PlayerBuyWeapon", "f", WEAPON_G3SG1 );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_G3SG1);
break;
case "m249":
sendevent( "PlayerBuyWeapon", "f", WEAPON_PARA );
return TRUE;
sendevent("PlayerBuyWeapon", "f", WEAPON_PARA);
break;
case "buyammo1":
case "primammo":
sendevent( "GamePlayerBuyAmmo", "f", 0 );
return TRUE;
sendevent("GamePlayerBuyAmmo", "f", 0);
break;
case "buyammo2":
case "secammo":
sendevent( "GamePlayerBuyAmmo", "f", 1 );
return TRUE;
sendevent("GamePlayerBuyAmmo", "f", 1);
break;
case "vest":
sendevent( "PlayerBuyEquipment", "f", 0 );
return TRUE;
sendevent("PlayerBuyEquipment", "f", 0);
break;
case "vesthelm":
sendevent( "PlayerBuyEquipment", "f", 1 );
return TRUE;
sendevent("PlayerBuyEquipment", "f", 1);
break;
case "flash":
sendevent( "PlayerBuyEquipment", "f", 2 );
return TRUE;
sendevent("PlayerBuyEquipment", "f", 2);
break;
case "hegren":
sendevent( "PlayerBuyEquipment", "f", 3 );
return TRUE;
sendevent("PlayerBuyEquipment", "f", 3);
break;
case "vsgren":
sendevent( "PlayerBuyEquipment", "f", 4 );
return TRUE;
sendevent("PlayerBuyEquipment", "f", 4);
break;
case "defuser":
sendevent( "PlayerBuyEquipment", "f", 5 );
return TRUE;
sendevent("PlayerBuyEquipment", "f", 5);
break;
case "nvg":
sendevent( "PlayerBuyEquipment", "f", 6 );
return TRUE;
sendevent("PlayerBuyEquipment", "f", 6);
break;
case "coverme":
sendevent( "RadioMessage", "f", RADIO_CT_COVERME );
return TRUE;
sendevent("RadioMessage", "f", RADIO_CT_COVERME);
break;
case "takepoint":
sendevent( "RadioMessage", "f", RADIO_CT_POINT );
return TRUE;
sendevent("RadioMessage", "f", RADIO_CT_POINT);
break;
case "takepoint":
sendevent( "RadioMessage", "f", RADIO_POSITION );
return TRUE;
sendevent("RadioMessage", "f", RADIO_POSITION);
break;
case "regroup":
sendevent( "RadioMessage", "f", RADIO_REGROUP );
return TRUE;
sendevent("RadioMessage", "f", RADIO_REGROUP);
break;
case "followme":
sendevent( "RadioMessage", "f", RADIO_FOLLOWME );
return TRUE;
sendevent("RadioMessage", "f", RADIO_FOLLOWME);
break;
case "takingfire":
sendevent( "RadioMessage", "f", RADIO_FIREASSIS );
return TRUE;
sendevent("RadioMessage", "f", RADIO_FIREASSIS);
break;
case "go":
sendevent( "RadioMessage", "f", RADIO_GO );
return TRUE;
sendevent("RadioMessage", "f", RADIO_GO);
break;
case "fallback":
sendevent( "RadioMessage", "f", RADIO_FALLBACK );
return TRUE;
sendevent("RadioMessage", "f", RADIO_FALLBACK);
break;
case "sticktog":
sendevent( "RadioMessage", "f", RADIO_STICKTOG );
return TRUE;
sendevent("RadioMessage", "f", RADIO_STICKTOG);
break;
case "getinpos":
sendevent( "RadioMessage", "f", RADIO_COM_GETINPOS );
return TRUE;
sendevent("RadioMessage", "f", RADIO_COM_GETINPOS);
break;
case "stormfront":
sendevent( "RadioMessage", "f", RADIO_STORMFRONT );
return TRUE;
sendevent("RadioMessage", "f", RADIO_STORMFRONT);
break;
case "report":
sendevent( "RadioMessage", "f", RADIO_COM_REPORTIN );
return TRUE;
sendevent("RadioMessage", "f", RADIO_COM_REPORTIN);
break;
case "roger":
sendevent( "RadioMessage", "f", RADIO_ROGER );
return TRUE;
sendevent("RadioMessage", "f", RADIO_ROGER);
break;
case "enemyspot":
sendevent( "RadioMessage", "f", RADIO_CT_ENEMYS );
return TRUE;
sendevent("RadioMessage", "f", RADIO_CT_ENEMYS);
break;
case "needbackup":
sendevent( "RadioMessage", "f", RADIO_CT_BACKUP );
return TRUE;
sendevent("RadioMessage", "f", RADIO_CT_BACKUP);
break;
case "sectorclear":
sendevent( "RadioMessage", "f", RADIO_CLEAR );
return TRUE;
sendevent("RadioMessage", "f", RADIO_CLEAR);
break;
case "inposition":
sendevent( "RadioMessage", "f", RADIO_CT_INPOS );
return TRUE;
sendevent("RadioMessage", "f", RADIO_CT_INPOS);
break;
case "reportingin":
sendevent( "RadioMessage", "f", RADIO_CT_REPORTINGIN );
return TRUE;
sendevent("RadioMessage", "f", RADIO_CT_REPORTINGIN);
break;
case "getout":
sendevent( "RadioMessage", "f", RADIO_GETOUT );
return TRUE;
sendevent("RadioMessage", "f", RADIO_GETOUT);
break;
case "negative":
sendevent( "RadioMessage", "f", RADIO_NEGATIVE );
return TRUE;
sendevent("RadioMessage", "f", RADIO_NEGATIVE);
break;
case "enemydown":
sendevent( "RadioMessage", "f", RADIO_ENEMYDOWN );
return TRUE;
sendevent("RadioMessage", "f", RADIO_ENEMYDOWN);
break;
case "radio1":
VGUI_Radio_Toggle( VGUI_RADIO1 );
return TRUE;
VGUI_Radio_Toggle(VGUI_RADIO1);
break;
case "radio2":
VGUI_Radio_Toggle( VGUI_RADIO2 );
return TRUE;
VGUI_Radio_Toggle(VGUI_RADIO2);
break;
case "radio3":
VGUI_Radio_Toggle( VGUI_RADIO3 );
return TRUE;
VGUI_Radio_Toggle(VGUI_RADIO3);
break;
default:
return FALSE;
}
return FALSE;
return TRUE;
}
/*
@ -502,13 +419,13 @@ CSQC_Parse_Event
Whenever we call a SVC_CGAMEPACKET on the SSQC, this is being run
=================
*/
void CSQC_Parse_Event( void ) {
int s = (float)getproperty( VF_ACTIVESEAT ); //always 0, unless it was sent with a MULTICAST_ONE or MULTICAST_ONE_R to p2+
pSeat = &seats[ s ];
void CSQC_Parse_Event(void) {
int s = (float)getproperty(VF_ACTIVESEAT); //always 0, unless it was sent with a MULTICAST_ONE or MULTICAST_ONE_R to p2+
pSeat = &seats[s];
float fHeader = readbyte();
if ( fHeader == EV_WEAPON_DRAW ) {
if (fHeader == EV_WEAPON_DRAW) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
@ -516,8 +433,8 @@ void CSQC_Parse_Event( void ) {
pSeat = &seats[s];
break;
}
Weapon_Draw( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_WEAPON_PRIMARYATTACK ) {
Weapon_Draw(getstatf(STAT_ACTIVEWEAPON));
} else if (fHeader == EV_WEAPON_PRIMARYATTACK) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
@ -525,8 +442,8 @@ void CSQC_Parse_Event( void ) {
pSeat = &seats[s];
break;
}
Weapon_PrimaryAttack( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_WEAPON_SECONDARYATTACK ) {
Weapon_PrimaryAttack(getstatf(STAT_ACTIVEWEAPON));
} else if (fHeader == EV_WEAPON_SECONDARYATTACK) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
@ -534,8 +451,8 @@ void CSQC_Parse_Event( void ) {
pSeat = &seats[s];
break;
}
Weapon_SecondaryAttack( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_WEAPON_RELOAD ) {
Weapon_SecondaryAttack(getstatf(STAT_ACTIVEWEAPON));
} else if (fHeader == EV_WEAPON_RELOAD) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
@ -543,8 +460,8 @@ void CSQC_Parse_Event( void ) {
pSeat = &seats[s];
break;
}
Weapon_Reload( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_MODELGIB ) {
Weapon_Reload(getstatf(STAT_ACTIVEWEAPON));
} else if (fHeader == EV_MODELGIB) {
vector vPos;
vPos_x = readcoord();
vPos_y = readcoord();
@ -556,8 +473,8 @@ void CSQC_Parse_Event( void ) {
vSize_z = readcoord();
float fStyle = readbyte();
Effect_BreakModel( vPos, vSize, '0 0 0', fStyle );
} else if ( fHeader == EV_CAMERATRIGGER ) {
Effect_BreakModel(vPos, vSize, '0 0 0', fStyle);
} else if (fHeader == EV_CAMERATRIGGER) {
pSeat->vCameraPos.x = readcoord();
pSeat->vCameraPos.y = readcoord();
pSeat->vCameraPos.z = readcoord();
@ -567,13 +484,13 @@ void CSQC_Parse_Event( void ) {
pSeat->vCameraAngle.z = readcoord();
pSeat->fCameraTime = time + readfloat();
} else if ( fHeader == EV_RADIOMSG ) {
Radio_PlayMessage( readbyte() );
} else if ( fHeader == EV_RADIOMSG2 ) {
Radio_PlayPlayerMessage( readbyte(), readbyte() );
} else if ( fHeader == EV_ORBITUARY ) {
HUD_AddOrbituaries( readbyte(), readbyte(), readbyte(), readbyte(), readbyte(), readbyte());
} else if ( fHeader == EV_IMPACT ) {
} else if (fHeader == EV_RADIOMSG) {
Radio_PlayMessage(readbyte());
} else if (fHeader == EV_RADIOMSG2) {
Radio_PlayPlayerMessage(readbyte(), readbyte());
} else if (fHeader == EV_ORBITUARY) {
HUD_AddOrbituaries(readbyte(), readbyte(), readbyte(), readbyte(), readbyte(), readbyte());
} else if (fHeader == EV_IMPACT) {
int iType;
vector vOrigin, vNormal;
@ -586,16 +503,16 @@ void CSQC_Parse_Event( void ) {
vNormal_y = readcoord();
vNormal_z = readcoord();
Effect_Impact( iType, vOrigin, vNormal );
} else if ( fHeader == EV_EXPLOSION ) {
Effect_Impact(iType, vOrigin, vNormal);
} else if (fHeader == EV_EXPLOSION) {
vector vExploPos;
vExploPos_x = readcoord();
vExploPos_y = readcoord();
vExploPos_z = readcoord();
Effect_CreateExplosion( vExploPos );
} else if ( fHeader == EV_SPARK ) {
Effect_CreateExplosion(vExploPos);
} else if (fHeader == EV_SPARK) {
vector vSparkPos, vSparkAngle;
vSparkPos_x = readcoord();
@ -606,32 +523,32 @@ void CSQC_Parse_Event( void ) {
vSparkAngle_y = readcoord();
vSparkAngle_z = readcoord();
Effect_CreateSpark( vSparkPos, vSparkAngle );
} else if ( fHeader == EV_SMOKE ) {
Effect_CreateSpark(vSparkPos, vSparkAngle);
} else if (fHeader == EV_SMOKE) {
vector vSmokePos;
vSmokePos_x = readcoord();
vSmokePos_y = readcoord();
vSmokePos_z = readcoord();
Effect_CreateSmoke( vSmokePos );
} else if ( fHeader == EV_FLASH ) {
Effect_CreateSmoke(vSmokePos);
} else if (fHeader == EV_FLASH) {
pSeat->fFlashTime = 3.0f;
pSeat->fFlashAlpha = 1.0f;
} else if ( fHeader == EV_CHAT ) {
} else if (fHeader == EV_CHAT) {
float fSender = readbyte();
float fTeam = readbyte();
string sMessage = readstring();
CSQC_Parse_Print( sprintf( "%s%s^xF80: %s", HUD_GetChatColorHEX( fTeam ), getplayerkeyvalue( fSender, "name" ), sMessage ), PRINT_CHAT );
} else if ( fHeader == EV_CHAT_TEAM ) {
CSQC_Parse_Print(sprintf("%s%s^xF80: %s", HUD_GetChatColorHEX(fTeam), 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( "%s%s^xF80: %s", HUD_GetChatColorHEXTeam( fTeam2 ), getplayerkeyvalue( fSender2, "name" ), sMessage2 ), PRINT_CHAT );
} else if ( fHeader == EV_CHAT_VOX ) {
Sound_PlayVOX( readstring() );
CSQC_Parse_Print(sprintf("%s%s^xF80: %s", HUD_GetChatColorHEXTeam(fTeam2), getplayerkeyvalue(fSender2, "name"), sMessage2), PRINT_CHAT);
} else if (fHeader == EV_CHAT_VOX) {
Sound_PlayVOX(readstring());
} else if (fHeader == EV_FADE) {
Fade_Parse();
}
@ -644,44 +561,49 @@ CSQC_InputEvent
Updates all our input related globals for use in other functions
=================
*/
float CSQC_InputEvent( float fEventType, float fKey, float fCharacter, float fDeviceID ) {
if ( fEventType == IE_KEYDOWN ) {
if ( fKey == K_MOUSE1 ) {
fMouseClick = 1;
} else {
fInputKeyDown = 1;
}
float CSQC_InputEvent(float fEventType, float fKey, float fCharacter, float fDeviceID) {
switch(fEventType) {
case IE_KEYDOWN:
if (fKey == K_MOUSE1) {
fMouseClick = 1;
} else {
fInputKeyDown = 1;
}
fInputKeyCode = fKey;
fInputKeyASCII = fCharacter;
} else if ( fEventType == IE_KEYUP ) {
if ( fKey == K_MOUSE1 ) {
fMouseClick = 0;
} else {
fInputKeyDown = 0;
}
fInputKeyCode = 0;
fInputKeyASCII = 0;
} else if ( fEventType == IE_MOUSEABS ) {
vMousePos_x = fKey;
vMousePos_y = fCharacter;
} else if ( fEventType == IE_MOUSEDELTA ) {
vMousePos_x += fKey;
vMousePos_y += fCharacter;
if ( vMousePos_x < 0 ) {
vMousePos_x = 0;
} else if ( vMousePos_x > vVideoResolution_x ) {
vMousePos_x = vVideoResolution_x;
}
if ( vMousePos_y < 0 ) {
vMousePos_y = 0;
} else if ( vMousePos_y > vVideoResolution_y ) {
vMousePos_y = vVideoResolution_y;
}
} else {
return FALSE;
fInputKeyCode = fKey;
fInputKeyASCII = fCharacter;
break;
case IE_KEYUP:
if (fKey == K_MOUSE1) {
fMouseClick = 0;
} else {
fInputKeyDown = 0;
}
fInputKeyCode = 0;
fInputKeyASCII = 0;
break;
case IE_MOUSEABS:
vMousePos_x = fKey;
vMousePos_y = fCharacter;
break;
case IE_MOUSEDELTA:
vMousePos_x += fKey;
vMousePos_y += fCharacter;
if (vMousePos_x < 0) {
vMousePos_x = 0;
} else if (vMousePos_x > vVideoResolution_x) {
vMousePos_x = vVideoResolution_x;
}
if (vMousePos_y < 0) {
vMousePos_y = 0;
} else if (vMousePos_y > vVideoResolution_y) {
vMousePos_y = vVideoResolution_y;
}
break;
default:
return TRUE;
}
return FALSE;
}
@ -693,48 +615,47 @@ CSQC_Input_Frame
Hijacks and controls what input globals are being sent to the server
=================
*/
void CSQC_Input_Frame( void ) {
int s = (float)getproperty( VF_ACTIVESEAT );
pSeat = &seats[ s ];
void CSQC_Input_Frame(void) {
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &seats[s];
// If we are inside a VGUI, don't let the client do stuff outside
if ( ( pSeat->fVGUI_Display != VGUI_NONE ) ) {
if ((pSeat->fVGUI_Display != VGUI_NONE)) {
fInputSendNext = time + 0.2;
} else if ( ( pSeat->fHUDWeaponSelected ) && ( input_buttons & INPUT_BUTTON0 ) ) {
} else if ((pSeat->fHUDWeaponSelected) && (input_buttons & INPUT_BUTTON0)) {
HUD_DrawWeaponSelect_Trigger();
input_buttons = 0;
fInputSendNext = time + 0.2;
}
if ( fInputSendNext > time ) {
if (fInputSendNext > time) {
input_impulse = 0;
input_buttons = 0;
return;
}
if ( input_impulse == 101 ) {
print( "This aint Half-Life.\n" );
if (input_impulse == 101) {
print("This aint Half-Life.\n");
input_impulse = 0;
}
if ( input_impulse == 201 ) {
tokenize( cvar_string( "cl_logocolor" ) );
sendevent( "EffectSpray", "sfff", autocvar_cl_logofile, stof( argv( 0 ) ), stof( argv( 1 ) ), stof( argv( 2 ) ) );
if (input_impulse == 201) {
sendevent("Spraylogo", "");
}
if ( iInputAttack2 == TRUE ) {
if (iInputAttack2 == TRUE) {
input_buttons |= INPUT_BUTTON3;
}
if ( iInputReload == TRUE ) {
if (iInputReload == TRUE) {
input_buttons |= INPUT_BUTTON4;
}
if ( iInputUse == TRUE ) {
if (iInputUse == TRUE) {
input_buttons |= INPUT_BUTTON5;
}
if ( iInputDuck == TRUE ) {
if (iInputDuck == TRUE) {
input_buttons|= INPUT_BUTTON8;
}

View file

@ -76,8 +76,8 @@ Nightvision_PostDraw
Called after rendering the frame in Draw.c
=================
*/
void Nightvision_PostDraw( void ) {
void Nightvision_PostDraw(int x, int y, int w, int h ) {
if ( iNightVision == TRUE ) {
drawfill( '0 0', vVideoResolution, '0 0.5 0', 1, DRAWFLAG_ADDITIVE );
drawfill( [x,y], [w,h], '0 0.5 0', 1, DRAWFLAG_ADDITIVE );
}
}

View file

@ -26,13 +26,14 @@
void Player_PreUpdate(void);
void Player_PostUpdate(void);
void Player_ResetPrediction(void);
.float pmove_frame;
.vector netorigin;
.vector netangles;
.vector netvelocity;
.float netflags;
.float netpmove_flags;
string sPModels[CS_WEAPON_COUNT - 1] = {
@ -74,14 +75,6 @@ string sPModels[CS_WEAPON_COUNT - 1] = {
//.float basesubblendfrac; // legs part.
.float subblend2frac; // Up/Down
static float Player_Gun_PreDraw (void)
{
self.entnum = self.owner.entnum; //so this entity gets its RF_EXTERNALMODEL flag rewritten as needed
addentity(self);
self.entnum = 0; //so that findfloat won't find the wrong thing.
return PREDRAW_NEXT;
}
void Player_Gun_Offset(void)
{
vector v1, v2;
@ -104,8 +97,6 @@ void Player_Draw (void)
self.eGunModel = spawn();
self.eGunModel.classname = "pmodel";
self.eGunModel.owner = self;
self.eGunModel.predraw = Player_Gun_PreDraw;
self.eGunModel.drawmask = MASK_ENGINE;
}
self.subblend2frac = self.flUpAngle;
@ -160,19 +151,26 @@ void Player_Draw (void)
}
}
s /= 400;
if (a < -180)
/* Clamp */
if (a < -180) {
a += 360;
if (a > 180)
}
if (a > 180) {
a -= 360;
if (a > 120)
}
if (a > 120) {
a = 120;
if (a < -120)
}
if (a < -120) {
a = -120;
//self.bonecontrol1 = self.bonecontrol2 = self.bonecontrol3 = self.bonecontrol4 = (a)/150;///4;
self.angles[1] -= a;
self.angles[0] = 0;
}
/* Turn torso */
self.subblendfrac = (a)/-120;
/* Correct the legs */
self.angles[1] -= a;
}
/*
@ -185,61 +183,21 @@ Responsible for player appearance/interpolation.
*/
float Player_PreDraw(void)
{
/* Run animations regardless of rendering the player */
Player_Draw();
Player_Gun_Offset();
addentity(self);
if (autocvar_cl_thirdperson == TRUE || self.entnum != player_localentnum) {
addentity(self);
addentity(self.eGunModel);
} else {
removeentity(self);
removeentity(self.eGunModel);
}
return PREDRAW_NEXT;
}
/*
=================
Player_Predict
Runs before every frame is rendered.
Responsible for local player prediction.
=================
*/
void Player_Predict(void)
{
// Don't predict if we're frozen/paused FIXME: FTE doesn't have serverkey_float yet!
if (serverkey(SERVERKEY_PAUSESTATE) == "1" || ((getstati(STAT_GAMESTATE) == GAME_FREEZE) && (getstati(STAT_HEALTH) > 0))) {
pSeat->vPlayerOrigin = self.origin;
self.netorigin = pSeat->vPlayerOrigin;
self.velocity = '0 0 0';
self.netvelocity = self.velocity;
self.netpmove_flags = 0;
} else {
Player_PreUpdate();
}
if (autocvar_cl_smoothstairs && self.flags & FL_ONGROUND) {
pSeat->vPlayerOriginOld = pSeat->vPlayerOrigin;
if ((self.jumptime <= 0) && (self.origin[2] - pSeat->vPlayerOriginOld[2] > 0)) {
pSeat->vPlayerOriginOld[2] += clframetime * 150;
if (pSeat->vPlayerOriginOld[2] > self.origin[2]) {
pSeat->vPlayerOriginOld[2] = self.origin[2];
}
if (self.origin[2] - pSeat->vPlayerOriginOld[2] > 18) {
pSeat->vPlayerOriginOld[2] = self.origin[2] - 18;
}
pSeat->vPlayerOrigin[2] += pSeat->vPlayerOriginOld[2] - self.origin[2];
} else {
pSeat->vPlayerOriginOld[2] = self.origin[2];
}
pSeat->vPlayerVelocity = self.velocity;
pSeat->vPlayerOrigin = [self.origin[0], self.origin[1], pSeat->vPlayerOriginOld[2]];
} else {
pSeat->vPlayerOrigin = self.origin;
pSeat->vPlayerVelocity = self.velocity;
}
Player_PostUpdate();
}
/*
=================
Player_Preupdate
@ -251,42 +209,32 @@ Propagate our pmove state to whatever the current frame before its stomped on (s
void Player_PreUpdate(void)
{
self.netorigin = self.origin;
self.netangles = self.angles;
self.netvelocity = self.velocity;
self.netflags = self.flags;
self.netpmove_flags = self.pmove_flags;
if (getplayerkeyvalue(self.entnum - 1, "*spec") == "0") {
self.movetype = MOVETYPE_WALK;
} else {
self.movetype = MOVETYPE_NOCLIP;
}
//we want to predict an exact copy of the data in the new packet
/*for (; self.pmove_frame <= servercommandframe; self.pmove_frame++) {
float flSuccess = getinputstate(self.pmove_frame);*/
for (int i = servercommandframe + 1; i <= clientcommandframe; i++) {
float flSuccess = getinputstate(i);
for ( int i = servercommandframe + 1; i <= clientcommandframe; i++ ) {
float flSuccess = getinputstate( i );
if (flSuccess == FALSE) {
continue;
}
// Partial frames are the worst
if (input_timelength == 0) {
break;
}
QPhysics_Run(self);
}
//we now have self.pmove_flags set properly...
self.movetype = MOVETYPE_NONE;
}
void Player_PostUpdate(void)
void Player_ResetPrediction(void)
{
self.origin = self.netorigin;
self.angles = self.netangles;
self.velocity = self.netvelocity;
self.flags = self.netflags;
self.pmove_flags = self.netpmove_flags;
self.pmove_frame = servercommandframe + 1;
setorigin( self, self.origin );
//self.pmove_frame = servercommandframe + 1;
}

View file

@ -58,7 +58,11 @@ string sViewModels[ CS_WEAPON_COUNT - 1 ] = {
void View_Init(void)
{
string wm;
for ( int i = 0; i < ( CS_WEAPON_COUNT - 1 ); i++ ) {
wm = sprintf("models/%s", sViewModels[i]);
precache_model(wm);
}
}
/*
@ -278,6 +282,34 @@ void View_DrawViewModel( void ) {
}
}
void View_Stairsmooth(void)
{
vector currentpos = pSeat->vPlayerOrigin;
vector endpos = currentpos;
static vector oldpos;
/* Have we gone up since last frame? */
if ( ( pSeat->fPlayerFlags & FL_ONGROUND ) && ( endpos[2] - oldpos[2] > 0 ) ) {
endpos[2] = oldpos[2] += (frametime * 150);
if ( endpos[2] > currentpos[2] ) {
endpos[2] = currentpos[2];
}
if ( currentpos[2] - endpos[2] > 18 ) {
endpos[2] = currentpos[2] - 18;
}
}
// Teleport hack
if ( fabs( currentpos[2] - oldpos[2] ) > 64 ) {
endpos[2] = currentpos[2];
}
//setproperty(VF_ORIGIN, endpos);
pSeat->vPlayerOrigin = endpos;
oldpos = endpos;
}
/*
====================
View_PlayAnimation

View file

@ -43,8 +43,11 @@ Defs.h
../Shared/Equipment.c
../Shared/Animations.c
../Shared/pmove.c
../gs-entbase/client/fade.cpp
../Shared/spraylogo.cpp
Overview.c
Player.c
View.c

View file

@ -346,8 +346,8 @@ float Game_GetMaxSpeed( entity eTarget ) {
}
if ( eTarget.flags & FL_CROUCHING ) {
return ( cvar( "sv_maxspeed" ) * Weapon_GetSpeedM(weap) * 0.5 );
return ( serverkeyfloat("phy_maxspeed") * Weapon_GetSpeedM(weap) * 0.5 );
} else {
return cvar( "sv_maxspeed" ) * Weapon_GetSpeedM(weap);
return serverkeyfloat("phy_maxspeed") * Weapon_GetSpeedM(weap);
}
}

View file

@ -85,79 +85,19 @@ int QPhysics_IsStuck( entity eTarget, vector vOffset, vector vecMins, vector vec
return trace_startsolid;
}
void QPhysics_Jump ( entity eTarget )
{
if ( !( eTarget.flags & FL_ONGROUND ) ) {
return;
}
if ( !( eTarget.flags & FL_JUMPRELEASED ) ) {
return;
}
eTarget.velocity_z = eTarget.velocity_z + 270;
}
void PMove_Run (void)
void QPhysics_Run ( entity eTarget )
{
int iFixCrouch = FALSE;
float flFallVel = ( eTarget.flags & FL_ONGROUND ) ? 0 : -eTarget.velocity_z;
// We didn't get any basevelocity this frame, remove the flag
/*if ( vlen( eTarget.basevelocity ) ) {
eTarget.flags -= ( eTarget.flags & FL_BASEVELOCITY );
}*/
if ( input_buttons & INPUT_BUTTON8 ) {
eTarget.flags |= FL_CROUCHING;
} else {
// If we aren't holding down duck anymore and 'attempt' to stand up, prevent it
if ( eTarget.flags & FL_CROUCHING ) {
if ( QPhysics_IsStuck( eTarget, '0 0 36', VEC_HULL_MIN, VEC_HULL_MAX ) == FALSE ) {
eTarget.flags -= ( eTarget.flags & FL_CROUCHING );
iFixCrouch = TRUE;
}
} else {
eTarget.flags -= ( eTarget.flags & FL_CROUCHING );
}
}
if ( input_buttons & INPUT_BUTTON2 ) {
QPhysics_Jump( eTarget );
input_buttons -= ( input_buttons & INPUT_BUTTON2 );
eTarget.flags -= ( eTarget.flags & FL_JUMPRELEASED );
eTarget.flags -= ( eTarget.flags & FL_ONGROUND );
} else {
eTarget.flags |= FL_JUMPRELEASED;
}
if ( eTarget.flags & FL_CROUCHING ) {
setsize( eTarget, VEC_CHULL_MIN, VEC_CHULL_MAX );
#ifdef SSQC
eTarget.view_ofs = VEC_PLAYER_CVIEWPOS;
#endif
} else {
setsize( eTarget, VEC_HULL_MIN, VEC_HULL_MAX );
if ( iFixCrouch && QPhysics_IsStuck( eTarget, '0 0 0', VEC_HULL_MIN, VEC_HULL_MAX ) ) {
for ( int i = 0; i < 36; i++ ) {
eTarget.origin_z += 1;
if ( QPhysics_IsStuck( eTarget, '0 0 0', eTarget.mins, eTarget.maxs ) == FALSE ) {
break;
}
}
}
setorigin( eTarget, eTarget.origin );
#ifdef SSQC
eTarget.view_ofs = VEC_PLAYER_VIEWPOS;
#endif
}
eTarget.maxspeed = Game_GetMaxSpeed( eTarget );
runstandardplayerphysics( eTarget );
#ifdef SSQC
//runstandardplayerphysics( eTarget );
PMove_Run();
#ifdef SSQC
if ( ( eTarget.flags & FL_ONGROUND ) && eTarget.movetype == MOVETYPE_WALK && ( flFallVel > 580 )) {
float fFallDamage = ( flFallVel - 580 ) * ( 100 / ( 1024 - 580 ) );
Damage_Apply( eTarget, world, fFallDamage, eTarget.origin, FALSE );
}
#endif
#endif
}
#endif

View file

@ -133,7 +133,7 @@ float m_consolecommand(string cmd)
m_display();
break;
default:
return FALSE;
return TRUE;
}
return TRUE;
return FALSE;
}

View file

@ -25,7 +25,7 @@ void ac_btndone_start(void)
}
void ac_btncancel_start(void)
{
static void ac_btnadvanced_end(void) {
static void ac_btncancel_end(void) {
g_menupage = PAGE_CUSTOMIZE;
}
localsound("../media/launch_dnmenu1.wav");
@ -34,7 +34,7 @@ void ac_btncancel_start(void)
header.m_lerp = 0.0f;
header.m_visible = TRUE;
header.SetHeader(HEAD_ADVANCED);
header.SetExecute(ac_btnadvanced_end);
header.SetExecute(ac_btncancel_end);
}
void menu_advancedcustomize_init(void)

View file

@ -1,11 +1,52 @@
void menu_chatrooms_init(void)
CWidget fn_chatrooms;
CMainButton cr_btnJoin;
CMainButton cr_btnCreateRoom;
CMainButton cr_btnCancel;
void cr_btncancel_start(void)
{
static void cr_btncancel_end(void) {
g_menupage = PAGE_MULTIPLAYER;
}
localsound("../media/launch_dnmenu1.wav");
header.SetStartEndPos(45,45,50,236);
header.SetStartEndSize(460,80,156,26);
header.m_lerp = 0.0f;
header.m_visible = TRUE;
header.SetHeader(HEAD_MULTI);
header.SetExecute(cr_btncancel_end);
}
void menu_chatrooms_init(void)
{
fn_chatrooms = spawn(CWidget);
cr_btnJoin = spawn(CMainButton);
cr_btnJoin.SetImage(BTN_JOIN);
//cr_btnJoin.SetExecute(cr_btncancel_start);
cr_btnJoin.SetPos(50,140);
Widget_Add(fn_chatrooms, cr_btnJoin);
cr_btnCreateRoom = spawn(CMainButton);
cr_btnCreateRoom.SetImage(BTN_CREATEROOM);
//cr_btnCreateRoom.SetExecute(cr_btncancel_start);
cr_btnCreateRoom.SetPos(50,172);
Widget_Add(fn_chatrooms, cr_btnCreateRoom);
cr_btnCancel = spawn(CMainButton);
cr_btnCancel.SetImage(BTN_CANCEL);
cr_btnCancel.SetExecute(cr_btncancel_start);
cr_btnCancel.SetPos(50,204);
Widget_Add(fn_chatrooms, cr_btnCancel);
}
void menu_chatrooms_draw(void)
{
Widget_Draw(fn_chatrooms);
drawpic([g_menuofs[0]+45,g_menuofs[1]+45], g_bmp[HEAD_ROOMS],[460,80], [1,1,1], 1.0f, 1);
}
void menu_chatrooms_input(float evtype, float scanx, float chary, float devid)
{
Widget_Input(fn_chatrooms, evtype, scanx, chary, devid);
}

View file

@ -93,7 +93,7 @@ void menu_customize_init(void)
cz_psSpray.SetMax(g_sprayscount);
cz_psSpray.SetPics(g_sprays);
cz_psSpray.SetValueS("logo");
Widget_Add(fn_customize, cz_psSpray);
//Widget_Add(fn_customize, cz_psSpray);
cz_psModel = spawn(CPictureSwitch);
cz_psModel.SetPos(410,160);
@ -102,7 +102,7 @@ void menu_customize_init(void)
cz_psModel.SetPics(g_models);
cz_psModel.SetMax(g_modelcount);
cz_psSpray.SetValueS("model");
Widget_Add(fn_customize, cz_psModel);
//Widget_Add(fn_customize, cz_psModel);
}
void menu_customize_draw(void)

View file

@ -80,6 +80,20 @@ void mp_btnlan_start(void)
header.SetExecute(mp_btnlan_end);
}
void mp_btnchatrooms_start(void)
{
static void mp_btnchatrooms_end(void) {
g_menupage = PAGE_CHATROOMS;
}
localsound("../media/launch_upmenu1.wav");
header.SetStartEndPos(50,239,45,45);
header.SetStartEndSize(156,26,460,80);
header.m_lerp = 0.0f;
header.m_visible = TRUE;
header.SetHeader(HEAD_ROOMS);
header.SetExecute(mp_btnchatrooms_end);
}
void mp_btncustomize_start(void)
{
static void mp_btncustomize_end(void) {
@ -119,7 +133,7 @@ void menu_multiplayer_init(void)
mp_btnChat = spawn(CMainButton);
mp_btnChat.SetImage(BTN_CHATROOMS);
//mp_btnChat.SetExecute(btn_console);
mp_btnChat.SetExecute(mp_btnchatrooms_start);
mp_btnChat.SetPos(50,236);
Widget_Add(fn_multiplayer, mp_btnChat);

View file

@ -301,8 +301,6 @@ void CBot::RunAI( void )
button6 = input_buttons & INPUT_BUTTON6; //unused
//button7 = input_buttons & INPUT_BUTTON7; //sprint
movement = input_movevalues;
//runplayerphysics();
}
/*

View file

@ -77,7 +77,7 @@ Called when a spectator leaves the game
=================
*/
void SpectatorDisconnect( void ) {
Effect_RemoveSpray( self );
Spray_RemoveAll( self );
}
/*
@ -92,7 +92,7 @@ void ClientDisconnect( void ) {
self.health = 0;
Rules_CountPlayers();
Rules_DeathCheck();
Effect_RemoveSpray( self );
Spray_RemoveAll( self );
}
void DecodeChangeParms(void)

View file

@ -1,28 +1,10 @@
/*
Copyright 2016-2018 Marco "eukara" Hladik
MIT LICENSE
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/*
=================
@ -257,21 +239,34 @@ Even more pain and suffering, mostly used for explosives
=================
*/
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip ) {
entity eDChain = findradius( vOrigin, fRadius );
while( eDChain ) {
if ( eDChain.takedamage == DAMAGE_YES ) {
if ( Damage_CheckAttack( eDChain, vOrigin ) || iCheckClip == FALSE ) {
float fDiff = vlen( vOrigin - eDChain.origin );
fDiff = ( fRadius - fDiff ) / fRadius;
fDamage = fDamage * fDiff;
if ( fDiff > 0 ) {
Damage_Apply( eDChain, eAttacker, fDamage, eDChain.origin, TRUE );
}
}
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, TRUE );
/*if ( eDChain.movetype != MOVETYPE_NONE ) {
vPush = vectoangles( vecRealPos - vOrigin );
makevectors( vPush );
eDChain.velocity += ( v_forward * fDamage * 5 ) + ( v_up * fDamage * 2.5 );
}*/
}
}
eDChain = eDChain.chain;
}
}

View file

@ -1,28 +1,10 @@
/*
Copyright 2016-2018 Marco "eukara" Hladik
MIT LICENSE
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
enum {
HOSTAGE_IDLE,
@ -31,48 +13,49 @@ enum {
};
enum {
A_WALK,
A_WALKSCARED,
A_RUN,
A_RUNSCARED,
A_RUNLOOK,
A_180LEFT,
A_180RIGHT,
A_FLINCH,
A_PAIN,
A_PAINLEFT,
A_PAINRIGHT,
A_PAINLEGLEFT,
A_PAINLEGRIGHT,
A_IDLE1,
A_IDLE2,
A_IDLE3,
A_IDLE4,
A_IDLE5,
A_IDLE6,
A_SCARED_END,
A_SCARED1,
A_SCARED2,
A_SCARED3,
A_PANIC,
A_FEAR1,
A_FEAR2,
A_CRY,
A_SCI1,
A_SCI2,
A_SCI3,
A_DIE_SIMPLE,
A_DIE_FORWARD1,
A_DIE_FORWARD2,
A_DIE_BACKWARD,
A_DIE_HEADSHOT,
A_DIE_GUTSHOT,
A_LYING1,
A_LYING2,
A_DEADSIT,
A_DEADTABLE1,
A_DEADTABLE2,
A_DEADTABLE3
HOSA_WALK,
HOSA_WALKSCARED,
HOSA_RUN,
HOSA_RUNSCARED,
HOSA_RUNLOOK,
HOSA_180LEFT,
HOSA_180RIGHT,
HOSA_FLINCH,
HOSA_PAIN,
HOSA_PAINLEFT,
HOSA_PAINRIGHT,
HOSA_PAINLEGLEFT,
HOSA_PAINLEGRIGHT,
HOSA_IDLE1,
HOSA_IDLE2,
HOSA_IDLE3,
HOSA_IDLE4,
HOSA_IDLE5,
HOSA_IDLE6,
HOSA_SCARED_END,
HOSA_SCARED1,
HOSA_SCARED2,
HOSA_SCARED3,
HOSA_SCARED4,
HOSA_PANIC,
HOSA_FEAR1,
HOSA_FEAR2,
HOSA_CRY,
HOSA_SCI1,
HOSA_SCI2,
HOSA_SCI3,
HOSA_DIE_SIMPLE,
HOSA_DIE_FORWARD1,
HOSA_DIE_FORWARD2,
HOSA_DIE_BACKWARD,
HOSA_DIE_HEADSHOT,
HOSA_DIE_GUTSHOT,
HOSA_LYING1,
HOSA_LYING2,
HOSA_DEADSIT,
HOSA_DEADTABLE1,
HOSA_DEADTABLE2,
HOSA_DEADTABLE3
};
/*
@ -82,13 +65,13 @@ hostage_waypoint
Spawns a new waypoint for the hostage
=================
*/
entity hostage_waypoint( void ) {
entity hostage_waypoint(void) {
entity ePoint = spawn();
setorigin( ePoint, self.eUser.origin );
setsize( ePoint, self.mins, self.maxs );
setorigin(ePoint, self.eUser.origin);
setsize(ePoint, self.mins, self.maxs);
ePoint.classname = "remove_me";
ePoint.movetype = MOVETYPE_TOSS;
//setmodel( ePoint, "models/chick.mdl" ); // Visual feedback...
//setmodel(ePoint, "models/chick.mdl"); // Visual feedback...
return ePoint;
}
@ -99,9 +82,9 @@ hostage_waypoint_needed
Determines when we need to spawn a new waypoint
=================
*/
float hostage_waypoint_needed( void ) {
float hostage_waypoint_needed(void) {
float fState;
if ( self.eUser.movement == self.movement ) {
if (self.eUser.movement == self.movement) {
fState = FALSE;
} else {
fState = TRUE;
@ -119,8 +102,8 @@ hostage_pain
Called whenever a hostage is shot
=================
*/
void hostage_pain( int iHitBody ) {
self.frame = A_PAIN + floor( random( 0, 5 ) );
void hostage_pain(int iHitBody) {
self.frame = HOSA_FLINCH + floor(random(0, 6));
}
/*
@ -130,15 +113,15 @@ hostage_die
hosdown.wav
=================
*/
void hostage_die( int iHitBody ) {
Radio_BroadcastMessage( RADIO_HOSDOWN );
self.frame = A_DIE_SIMPLE + floor( random( 0, 6 ) );
void hostage_die(int iHitBody) {
Radio_BroadcastMessage(RADIO_HOSDOWN);
self.frame = HOSA_DIE_SIMPLE + floor(random(0, 6));
self.solid = SOLID_NOT;
self.takedamage = DAMAGE_NO;
if ( other.eTargetPoint != other.eUser ) {
remove( other.eTargetPoint );
if (other.eTargetPoint != other.eUser) {
remove(other.eTargetPoint);
}
}
@ -149,13 +132,13 @@ hostage_use
Whenever a hostage is 'used'
=================
*/
void hostage_use( void ) {
if ( eActivator.team == TEAM_CT ) {
if ( ( self.eUser == world ) ) {
void hostage_use(void) {
if (eActivator.team == TEAM_CT) {
if ((self.eUser == world)) {
// Only give cash to the CT for using it for the first time
if ( self.iHasBeenUsed == FALSE ) {
Money_AddMoney( eActivator, 150 );
sound( self, CHAN_VOICE, sprintf( "hostage/hos%d.wav", random( 1, 6 ) ), 1.0, ATTN_IDLE );
if (self.iHasBeenUsed == FALSE) {
Money_AddMoney(eActivator, 150);
sound(self, CHAN_VOICE, sprintf("hostage/hos%d.wav", random(1, 6)), 1.0, ATTN_IDLE);
self.iHasBeenUsed = TRUE;
}
@ -174,45 +157,45 @@ hostage_physics
Run every frame
=================
*/
void hostage_physics( void ) {
void hostage_physics(void) {
input_movevalues = '0 0 0';
input_impulse = 0;
input_buttons = 0;
// Are we meant to follow someone and AREN'T dead?
if ( ( self.eUser != world ) && ( self.health > 0 ) ) {
if ((self.eUser != world) && (self.health > 0) ) {
// Which direction we have to face
vector vEndAngle = vectoangles( self.eTargetPoint.origin - self.origin );
vector vEndAngle = vectoangles(self.eTargetPoint.origin - self.origin);
// Slowly turn towards target
float fTurn = Math_LerpAngle( self.v_angle_y, vEndAngle_y, frametime * 4 );
float fTurn = Math_LerpAngle(self.v_angle_y, vEndAngle_y, frametime * 4);
self.v_angle_y += fTurn;
self.v_angle_y = Math_FixDelta( self.v_angle_y );
self.v_angle_y = Math_FixDelta(self.v_angle_y);
// Is the waypoint close? if so, remove and go set the next one!
float fDist1 = vlen( self.eTargetPoint.origin - self.origin );
float fDist1 = vlen(self.eTargetPoint.origin - self.origin);
if ( fDist1 < 100 && self.eTargetPoint != self.eUser ) {
if (fDist1 < 100 && self.eTargetPoint != self.eUser) {
entity eTemp = self.eTargetPoint;
if ( self.eTargetPoint.eTargetPoint ) {
if (self.eTargetPoint.eTargetPoint) {
self.eTargetPoint = self.eTargetPoint.eTargetPoint;
} else {
self.eTargetPoint = self.eUser;
}
remove( eTemp ); // Delete the old waypoint
remove(eTemp); // Delete the old waypoint
}
// Don't switch states so often
if( self.fAttackFinished < time ) {
if(self.fAttackFinished < time) {
// Here we check the distance of us and the player, then choosing if we should walk/run etc.
float fDist = vlen( self.eUser.origin - self.origin );
float fDist = vlen(self.eUser.origin - self.origin);
if ( fDist < 130 ) {
if (fDist < 130) {
self.style = HOSTAGE_IDLE;
self.fAttackFinished = time + 0.1;
} else if ( fDist < 200 ) {
} else if (fDist < 200) {
self.style = HOSTAGE_WALK;
self.fAttackFinished = time + 0.4;
} else {
@ -220,8 +203,8 @@ void hostage_physics( void ) {
self.fAttackFinished = time + 0.1;
// We only ever need to create waypoints when we run
if ( hostage_waypoint_needed() == TRUE ) {
if ( self.eTargetPoint == self.eUser ) {
if (hostage_waypoint_needed() == TRUE) {
if (self.eTargetPoint == self.eUser) {
// Create the first waypoint
self.eTargetPoint = hostage_waypoint();
self.eLastCreated = self.eTargetPoint;
@ -234,21 +217,21 @@ void hostage_physics( void ) {
}
}
if ( fTurn > 0.01 ) {
self.frame = A_180LEFT;
} else if ( fTurn < -0.01 ){
self.frame = A_180RIGHT;
if (fTurn > 0.01) {
self.frame = HOSA_180LEFT;
} else if (fTurn < -0.01){
self.frame = HOSA_180RIGHT;
} else {
self.frame = A_IDLE1;
self.frame = HOSA_IDLE1;
}
// Decide speed and stuff
if ( self.style == HOSTAGE_WALK ) {
self.frame = A_WALK;
if (self.style == HOSTAGE_WALK) {
self.frame = HOSA_WALK;
input_movevalues_x = 160;
} else if ( self.style == HOSTAGE_RUN ) {
} else if (self.style == HOSTAGE_RUN) {
input_movevalues_x = 320;
self.frame = A_RUN;
self.frame = HOSA_RUN;
} else {
input_movevalues_x = 0;
}
@ -258,7 +241,7 @@ void hostage_physics( void ) {
input_angles = self.v_angle;
self.movetype = MOVETYPE_WALK;
runstandardplayerphysics( self );
runstandardplayerphysics(self);
Footsteps_Update();
self.angles = self.v_angle;
@ -272,18 +255,18 @@ SPAWN: hostage_entity
Entry function for the hostages.
=================
*/
void hostage_entity( void ) {
void hostage_entity(void) {
static void hostage_entity_respawn( void ) {
self.v_angle_x = Math_FixDelta ( self.angles_x );
self.v_angle_y = Math_FixDelta ( self.angles_y );
self.v_angle_z = Math_FixDelta ( self.angles_z );
static void hostage_entity_respawn(void) {
self.v_angle_x = Math_FixDelta (self.angles_x);
self.v_angle_y = Math_FixDelta (self.angles_y);
self.v_angle_z = Math_FixDelta (self.angles_z);
setorigin( self, self.origin );
setorigin(self, self.origin);
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_NONE;
setmodel( self, self.model );
setsize( self, VEC_HULL_MIN + '0 0 36', VEC_HULL_MAX + '0 0 36' );
setmodel(self, self.model);
setsize(self, VEC_HULL_MIN + '0 0 36', VEC_HULL_MAX + '0 0 36');
self.customphysics = hostage_physics;
self.eUser = world;
@ -296,24 +279,24 @@ void hostage_entity( void ) {
self.vDeath = hostage_die;
self.style = HOSTAGE_IDLE;
self.frame = A_IDLE1;
self.frame = HOSA_IDLE1;
self.health = 100;
self.velocity = '0 0 0';
self.iHasBeenUsed = FALSE;
}
// Path hack
if ( self.model == "/models/hostage.mdl" ) {
if (self.model == "/models/hostage.mdl") {
self.model = "";
}
if ( !self.model ) {
if (!self.model) {
self.model = "models/hostage.mdl";
}
precache_model( self.model );
precache_model(self.model);
hostage_entity_respawn();
iHostagesMax = iHostagesMax + 1; // Increase the global count of hostages
Entities_InitRespawnable( hostage_entity_respawn );
Entities_InitRespawnable(hostage_entity_respawn);
}

View file

@ -38,6 +38,10 @@ void Footsteps_Update( void ) {
float fVol;
string sMaterial = "";
string sTexture = "";
if (self.flags & FL_CROUCHING) {
return;
}
if ( ( self.movetype == MOVETYPE_WALK ) && ( self.flags & FL_ONGROUND ) ) {
if ( ( self.velocity_x == 0 && self.velocity_y == 0 ) || self.fStepTime > time ) {

View file

@ -657,4 +657,6 @@ void worldspawn( void ) {
iBombRadius = 1024;
localcmd(sprintf("serverinfo slots %d\n", cvar("sv_playerslots")));
localcmd("teamplay 1\n");
PMove_Init();
}

View file

@ -41,20 +41,23 @@ float Player_SendEntity( entity ePEnt, float fChanged ) {
if ( self.health <= 0 && ePEnt != self ) {
return FALSE;
}
WriteByte( MSG_ENTITY, ENT_PLAYER );
WriteByte( MSG_ENTITY, self.modelindex );
WriteShort( MSG_ENTITY, self.modelindex );
WriteCoord( MSG_ENTITY, self.origin_x );
WriteCoord( MSG_ENTITY, self.origin_y );
WriteCoord( MSG_ENTITY, self.origin_z );
WriteCoord( MSG_ENTITY, self.v_angle_x );
WriteCoord( MSG_ENTITY, self.angles_y );
WriteCoord( MSG_ENTITY, self.angles_z );
WriteShort( MSG_ENTITY, self.velocity_x );
WriteShort( MSG_ENTITY, self.velocity_y );
WriteShort( MSG_ENTITY, self.velocity_z );
WriteCoord( MSG_ENTITY, self.velocity_x );
WriteCoord( MSG_ENTITY, self.velocity_y );
WriteCoord( MSG_ENTITY, self.velocity_z );
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 );
return TRUE;
}
@ -64,11 +67,12 @@ Player_Pain
=================
*/
void Player_Pain( int iHitBody ) {
/*
if ( iHitBody == BODY_HEAD ) {
Animation_PlayerTopTemp( ANIM_HEAD_FLINCH, 0.1f );
Animation_PlayerTopTemp( ANIM_HEAD_FLINCH, 0.25f );
} else {
Animation_PlayerTopTemp( ANIM_GUT_FLINCH, 0.1f );
}
Animation_PlayerTopTemp( ANIM_GUT_FLINCH, 0.25f );
}*/
sound( self, CHAN_VOICE, sPainSounds[ floor( random() * 5 ) ], 1, ATTN_IDLE );
self.velocity = '0 0 0';

View file

@ -1,28 +1,10 @@
/*
Copyright 2016-2018 Marco "eukara" Hladik
MIT LICENSE
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
int iTotalPenetrations;
@ -44,6 +26,57 @@ void TraceAttack_FireSingle( vector vPos, vector vAngle ) {
}
traceline( vPos, vPos + ( vAngle * wptTable[ self.weapon ].fRange ), MOVE_HITMODEL, self);
if (trace_fraction != 1.0) {
if ( trace_ent.takedamage == DAMAGE_YES ) {
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE );
}
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':
Effect_Impact( IMPACT_METAL, trace_endpos, trace_plane_normal );
break;
case 'M':
case 'P':
Effect_Impact( IMPACT_METAL, trace_endpos, trace_plane_normal );
break;
case 'D':
case 'W':
Effect_Impact( IMPACT_WOOD, trace_endpos, trace_plane_normal );
break;
case 'Y':
Effect_Impact( IMPACT_GLASS, trace_endpos, trace_plane_normal );
break;
case 'N':
Effect_Impact( IMPACT_DEFAULT, trace_endpos, trace_plane_normal );
break;
case 'T':
default:
Effect_Impact( IMPACT_DEFAULT, trace_endpos, trace_plane_normal );
break;
}
//TraceAttack_Penetrate( trace_endpos + ( v_forward * 2 ), vAngle );
}
}
}
void TraceAttack_FireSingleLagged( vector vPos, vector vAngle ) {
static void TraceAttack_Penetrate( vector vPos, vector vAngle ) {
if ( iTotalPenetrations > 0 ) {
return;
}
TraceAttack_FireSingle( vPos, vAngle );
iTotalPenetrations = 1;
}
traceline( vPos, vPos + ( vAngle * wptTable[ self.weapon ].fRange ), MOVE_LAGGED | MOVE_HITMODEL, self);
if (trace_fraction != 1.0) {
if ( trace_ent.takedamage == DAMAGE_YES ) {
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE );
@ -100,6 +133,7 @@ void TraceAttack_FireBullets( int iShots, vector vPos ) {
iTotalPenetrations = 0;
vDir = aim( self, 100000 ) + Math_CRandom()*self.fAccuracy*v_right + Math_CRandom()*self.fAccuracy*v_up;
TraceAttack_FireSingle( vPos, vDir );
TraceAttack_FireSingleLagged( vPos, vDir );
iShots--;
}

View file

@ -44,7 +44,8 @@ Money.c
../Shared/Weapons.c
../Shared/Effects.c
../Shared/Equipment.c
../Shared/spraylogo.cpp
../Shared/pmove.c
Vox.c
Ammo.c
Damage.c
@ -72,9 +73,11 @@ EntHostage.c
../gs-entbase/server/func_door.cpp
../gs-entbase/server/func_door_rotating.cpp
../gs-entbase/server/func_illusionary.cpp
../gs-entbase/server/func_ladder.cpp
//../gs-entbase/server/func_ladder.cpp
FuncLadder.c
../gs-entbase/server/func_train.cpp
../gs-entbase/server/func_wall.cpp
../gs-entbase/server/func_wall_toggle.cpp
../gs-entbase/server/func_conveyor.cpp
../gs-entbase/server/func_rotating.cpp
../gs-entbase/server/light.cpp

View file

@ -24,95 +24,6 @@
OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef SSQC
void Effect_RemoveSpray( entity eOwner ) {
for ( entity eFind = world; ( eFind = find( eFind, classname, "spray" ) ); ) {
if ( eFind.owner == self ) {
remove( eFind );
}
}
}
void Effect_Spraypaint( string sLogo, float fR, float fG, float fB ) {
static float Effect_Spraypaint_Send( entity ePVSEnt, float fChanged ) {
WriteByte( MSG_ENTITY, ENT_SPRAY );
WriteCoord( MSG_ENTITY, self.origin_x );
WriteCoord( MSG_ENTITY, self.origin_y );
WriteCoord( MSG_ENTITY, self.origin_z );
WriteCoord( MSG_ENTITY, self.angles_x );
WriteCoord( MSG_ENTITY, self.angles_y );
WriteCoord( MSG_ENTITY, self.angles_z );
WriteByte( MSG_ENTITY, self.color_x );
WriteByte( MSG_ENTITY, self.color_y );
WriteByte( MSG_ENTITY, self.color_z );
WriteString( MSG_ENTITY, self.model );
return TRUE;
}
vector vSrc;
vector vEnd;
makevectors( self.v_angle );
if ( self.health <= 0 ) {
return;
}
vSrc = self.origin + self.view_ofs;
vEnd = vSrc + v_forward * 128;
traceline( vSrc, vEnd, 0, self );
// Found a wall
if ( trace_fraction != 1.0f ) {
Effect_RemoveSpray( self );
entity eSpray = spawn();
eSpray.classname = "spray";
eSpray.owner = self;
eSpray.solid = SOLID_NOT;
eSpray.color_x = fR;
eSpray.color_y = fG;
eSpray.color_z = fB;
eSpray.model = sLogo;
setorigin( eSpray, trace_endpos );
// Align it
vector vSprayAngles = self.v_angle;
vSprayAngles_x *= -1;
makevectors( vSprayAngles );
vector vCoplanar = v_forward - ( v_forward * trace_plane_normal ) * trace_plane_normal;
if ( trace_plane_normal_z == 0 ) {
vCoplanar = '0 0 1';
}
eSpray.angles = vectoangles( vCoplanar, trace_plane_normal );
eSpray.SendEntity = Effect_Spraypaint_Send;
eSpray.SendFlags = 1;
sound( self, CHAN_VOICE, "player/sprayer.wav", 1.0, ATTN_NORM );
}
#else
float Effect_Spraypaint( void ) {
makevectors( self.angles );
float surf = getsurfacenearpoint(world, self.origin);
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
//vector fixedty = dotproduct(
adddecal( self.classname, self.origin, v_up / 32, t_dir / 32, self.color, 1.0f );
addentity( self );
return PREDRAW_NEXT;
#endif
}
#ifdef SSQC
void CSEv_EffectSpray_sfff( string sLogo, float fR, float fG, float fB ) {
Effect_Spraypaint( sLogo, fR, fG, fB );
}
#endif
void Effect_CreateExplosion( vector vPos ) {
#ifdef SSQC
vPos_z += 48;

View file

@ -1,28 +1,10 @@
/*
Copyright 2016-2018 Marco "eukara" Hladik
MIT LICENSE
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
#ifdef SSQC
.float fBombProgress;

692
Source/Shared/pmove.c Normal file
View file

@ -0,0 +1,692 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
float input_timelength;
vector input_angles;
vector input_movevalues;
float input_buttons;
var float PHY_JUMP_CHAINWINDOW = 0.5f; // maximum possible height from double/chain jump
var float PHY_JUMP_CHAIN = 100; // decay over lifetime of window
var float PHY_JUMP_CHAINDECAY = 50;
/*FIXME: jumptime should use the time global, as time intervals are not predictable - decrement it based upon input_timelength*/
.float jumptime;
.float waterlevel;
.float watertype;
.float teleport_time;
//int trace_endcontentsi;
.float maxspeed;
.vector view_ofs;
/*
=================
PMove_Init
=================
*/
void PMove_Init(void) {
localcmd("serverinfo phy_stepheight 18\n");
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");
localcmd("serverinfo phy_maxspeed 240\n");
}
/*
=================
PMove_Categorize
Figures out where we are in the game world.
Whether we are in water, on the ground etc.
=================
*/
void PMove_Categorize(void)
{
float contents;
// Make sure
if ((self.flags & FL_CROUCHING) /*&& !(self.flags & FL_ONLADDER)*/) {
self.mins = VEC_CHULL_MIN;
self.maxs = VEC_CHULL_MAX;
self.view_ofs = VEC_PLAYER_CVIEWPOS;
} else {
self.mins = VEC_HULL_MIN;
self.maxs = VEC_HULL_MAX;
self.view_ofs = VEC_PLAYER_VIEWPOS;
}
tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 0.25', FALSE, self);
if (!trace_startsolid) {
if ((trace_fraction < 1) && (trace_plane_normal[2] > 0.7)) {
self.flags |= FL_ONGROUND;
} else {
self.flags &= ~FL_ONGROUND;
}
}
// Check water levels, boo
contents = pointcontents(self.origin + self.mins + '0 0 1');
//print(sprintf("Contents: %d\n", contents));
// Ladder content testing
int oldhitcontents = self.hitcontentsmaski;
self.hitcontentsmaski = CONTENTBIT_FTELADDER;
tracebox(self.origin, self.mins, self.maxs, self.origin, FALSE, self);
self.hitcontentsmaski = oldhitcontents;
/*if (trace_endcontentsi & CONTENTBIT_FTELADDER || iContents == CONTENT_LADDER) {
self.flags |= FL_ONLADDER;
} else {
self.flags &= ~FL_ONLADDER;
}*/
if (contents < CONTENT_SOLID && contents != CONTENT_LADDER) {
self.watertype = contents;
if (pointcontents(self.origin + (self.mins + self.maxs) * 0.5) < CONTENT_SOLID) {
if (pointcontents(self.origin + self.maxs - '0 0 1') < CONTENT_SOLID) {
self.waterlevel = 3;
} else {
self.waterlevel = 2;
}
} else {
self.waterlevel = 1;
}
} else {
self.watertype = CONTENT_EMPTY;
self.waterlevel = 0;
}
}
/*
===========
PMove_WaterMove
============
*/
void PMove_WaterMove(void)
{
if (self.movetype == MOVETYPE_NOCLIP) {
return;
}
/*if (self.health < 0) {
return;
}*/
#if 0
CPlayer plPlayer = (CPlayer)self;
if (plPlayer.waterlevel != 3) {
if (plPlayer.m_flAirFinished < time) {
//sound (plPlayer, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
} else if (plPlayer.m_flAirFinished < time + 9) {
//sound (plPlayer, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
}
plPlayer.m_flAirFinished = time + 12;
plPlayer.dmg = 2;
} else if (plPlayer.m_flAirFinished < time) {
if (plPlayer.m_flPainFinished < time) {
plPlayer.dmg = plPlayer.dmg + 2;
if (plPlayer.dmg > 15) {
plPlayer.dmg = 10;
}
Damage_Apply(plPlayer, world, plPlayer.dmg, DAMAGE_DROWNING, WEAPON_NONE);
plPlayer.m_flPainFinished = time + 1;
}
}
#endif
if (!self.waterlevel){
if (self.flags & FL_INWATER) {
#if 0
//sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
#endif
self.flags = self.flags - (self.flags & FL_INWATER);
}
return;
}
#if 0
if (plPlayer.watertype == CONTENT_LAVA) {
if (plPlayer.m_flDamageTime < time) {
plPlayer.m_flDamageTime = time + 0.2;
Damage_Apply(plPlayer, world, 10*plPlayer.waterlevel, DAMAGE_BURN, WEAPON_NONE);
}
} else if (plPlayer.watertype == CONTENT_SLIME) {
if (plPlayer.m_flDamageTime < time) {
plPlayer.m_flDamageTime = time + 1;
Damage_Apply(plPlayer, world, 4*plPlayer.waterlevel, DAMAGE_ACID, WEAPON_NONE);
}
}
#endif
if (!(self.flags & FL_INWATER)) {
#if 0
sound (self, CHAN_BODY, "player/land/slosh.wav", 1, ATTN_NORM);
plPlayer.m_flDamageTime = 0;
#endif
self.flags |= FL_INWATER;
}
if (!(self.flags & FL_WATERJUMP)) {
self.velocity = self.velocity - 0.8 * self.waterlevel * frametime * self.velocity;
}
}
void PMove_CheckWaterJump(void)
{
vector vStart;
vector vEnd;
makevectors(self.angles);
vStart = self.origin;
vStart[2] = vStart[2] + 8;
v_forward[2] = 0;
normalize(v_forward);
vEnd = vStart + (v_forward * 24);
traceline(vStart, vEnd, TRUE, self);
if (trace_fraction < 1) {
vStart[2] = vStart[2] + self.maxs[2];
vEnd = vStart + (v_forward * 24);
//self.movedir = trace_plane_normal * -50;
traceline(vStart, vEnd, TRUE, self);
if (trace_fraction == 1) {
//self.flags = self.flags | FL_WATERJUMP;
self.velocity[2] = 350;
self.flags &= ~FL_JUMPRELEASED;
return;
}
}
}
int QPMove_IsStuck(entity eTarget, vector vOffset, vector vecMins, vector vecMaxs)
{
if (eTarget.solid != SOLID_SLIDEBOX) {
return FALSE;
}
tracebox(eTarget.origin + vOffset, vecMins, vecMaxs, eTarget.origin + vOffset, FALSE, eTarget);
return trace_startsolid;
}
/*
=================
PMove_Run_Acceleration
This function applies the velocity changes the player wishes to apply
=================
*/
void PMove_Run_Acceleration(float flMovetime, float flBefore)
{
vector vecWishVel;
vector vecWishDir;
vector vecTemp;
float flWishSpeed;
float flFriction;
float flJumptimeDelta;
float flChainBonus;
int iFixCrouch = FALSE;
PMove_Categorize();
// Update the timer
self.jumptime -= flMovetime;
self.teleport_time -= flMovetime;
// Corpses
if (self.movetype == MOVETYPE_TOSS) {
self.velocity[2] = self.velocity[2] - (serverkeyfloat("phy_gravity") * flMovetime);
return;
}
if (self.movetype == MOVETYPE_WALK) {
// Crouching
if (input_buttons & INPUT_BUTTON8 /*&& !(self.flags & FL_ONLADDER)*/) {
self.flags |= FL_CROUCHING;
} else {
// If we aren't holding down duck anymore and 'attempt' to stand up, prevent it
if (self.flags & FL_CROUCHING) {
if (QPMove_IsStuck(self, '0 0 36', VEC_HULL_MIN, VEC_HULL_MAX) == FALSE) {
self.flags &= ~FL_CROUCHING;
iFixCrouch = TRUE;
}
} else {
self.flags &= ~FL_CROUCHING;
}
}
if (self.flags & FL_CROUCHING) {
setsize(self, VEC_CHULL_MIN, VEC_CHULL_MAX);
//input_movevalues *= 0.333f;
#ifdef SSQC
self.view_ofs = VEC_PLAYER_CVIEWPOS;
#endif
} else {
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
if (iFixCrouch && QPMove_IsStuck(self, [0,0,0], VEC_HULL_MIN, VEC_HULL_MAX)) {
for (int i = 0; i < 36; i++) {
self.origin[2] += 1;
if (QPMove_IsStuck(self, [0,0,0], self.mins, self.maxs) == FALSE) {
break;
}
}
}
setorigin(self, self.origin);
#ifdef SSQC
self.view_ofs = VEC_PLAYER_VIEWPOS;
#endif
}
}
makevectors(input_angles);
// swim
if (self.waterlevel >= 2) {
if (self.movetype != MOVETYPE_NOCLIP) {
self.flags = self.flags - (self.flags & FL_ONGROUND);
if (input_movevalues == [0,0,0]) {
vecWishVel = '0 0 -60'; // drift towards bottom
} else {
vecWishVel = v_forward * input_movevalues[0];
vecWishVel += v_right * input_movevalues[1];
vecWishVel += v_up * input_movevalues[2];
}
flWishSpeed = vlen(vecWishVel);
if (flWishSpeed > self.maxspeed) {
flWishSpeed = self.maxspeed;
}
flWishSpeed = flWishSpeed * 0.7;
// water friction
if (self.velocity != [0,0,0]) {
flFriction = vlen(self.velocity) * (1 - flMovetime * serverkeyfloat("phy_friction"));
if (flFriction > 0) {
self.velocity = normalize(self.velocity) * flFriction;
} else {
self.velocity = [0,0,0];
}
} else {
flFriction = 0;
}
// water acceleration
if (flWishSpeed <= flFriction) {
return;
}
flFriction = min(flWishSpeed - flFriction, serverkeyfloat("phy_accelerate") * flWishSpeed * flMovetime);
self.velocity = self.velocity + normalize(vecWishVel) * flFriction;
return;
}
}
// hack to not let you back into teleporter
if (self.teleport_time > 0 && input_movevalues[0] < 0) {
vecWishVel = v_right * input_movevalues[1];
} else {
if (self.movetype == MOVETYPE_NOCLIP) {
} else if (self.flags & FL_ONGROUND) {
makevectors (input_angles[1] * [0,1,0]);
}
vecWishVel = v_forward * input_movevalues[0] + v_right * input_movevalues[1];
}
if (self.movetype != MOVETYPE_WALK) {
vecWishVel[2] += input_movevalues[2];
} else {
vecWishVel[2] = 0;
}
vecWishDir = normalize(vecWishVel);
flWishSpeed = vlen(vecWishVel);
if (flWishSpeed > self.maxspeed) {
flWishSpeed = self.maxspeed;
}
if (self.movetype == MOVETYPE_NOCLIP) {
self.flags &= ~FL_ONGROUND;
self.velocity = vecWishDir * flWishSpeed;
} else {
/*FIXME: pogostick*/
if (self.flags & FL_ONGROUND)
if (!(self.flags & FL_WATERJUMP))
if (self.flags & FL_JUMPRELEASED)
if (input_buttons & INPUT_BUTTON2 && flBefore) {
if (self.velocity[2] < 0) {
self.velocity[2] = 0;
}
if (self.waterlevel >= 2) {
if (self.watertype == CONTENT_WATER) {
self.velocity[2] = 100;
} else if (self.watertype == CONTENT_SLIME) {
self.velocity[2] = 80;
} else {
self.velocity[2] = 50;
}
} else {
self.velocity[2] += 240;
}
if (self.jumptime > 0) {
// time since last jump
flJumptimeDelta = 0 - (self.jumptime - PHY_JUMP_CHAINWINDOW);
//self.velocity[2] += PHY_JUMP_CHAIN;
flChainBonus = PHY_JUMP_CHAIN - (((PHY_JUMP_CHAINWINDOW - (PHY_JUMP_CHAINWINDOW - flJumptimeDelta)) * 2) * PHY_JUMP_CHAINDECAY);
self.velocity[2] += flChainBonus;
}
self.jumptime = PHY_JUMP_CHAINWINDOW;
self.flags &= ~FL_ONGROUND;
self.flags &= ~FL_JUMPRELEASED;
}
// not pressing jump, set released flag
if (!(input_buttons & INPUT_BUTTON2)) {
self.flags |= FL_JUMPRELEASED;
}
if (self.flags & FL_ONGROUND /*|| self.flags & FL_ONLADDER*/) {
// friction
if (self.velocity[0] || self.velocity[1]) {
vecTemp = self.velocity;
vecTemp[2] = 0;
flFriction = vlen(vecTemp);
// if the leading edge is over a dropoff, increase friction
vecTemp = self.origin + normalize(vecTemp) * 16 + '0 0 1' * VEC_HULL_MIN[2];
traceline(vecTemp, vecTemp + '0 0 -34', TRUE, self);
// apply friction
if (trace_fraction == 1.0) {
if (flFriction < serverkeyfloat("phy_stopspeed")) {
flFriction = 1 - flMovetime * (serverkeyfloat("phy_stopspeed") / flFriction) * serverkeyfloat("phy_friction") * serverkeyfloat("phy_edgefriction");
} else {
flFriction = 1 - flMovetime * serverkeyfloat("phy_friction") * serverkeyfloat("phy_edgefriction");
}
} else {
if (flFriction < serverkeyfloat("phy_stopspeed")) {
flFriction = 1 - flMovetime * (serverkeyfloat("phy_stopspeed") / flFriction) * serverkeyfloat("phy_friction");
} else {
flFriction = 1 - flMovetime * serverkeyfloat("phy_friction");
}
}
if (flFriction < 0) {
self.velocity = [0,0,0];
} else {
self.velocity = self.velocity * flFriction;
}
}
/*if (self.flags & FL_ONLADDER) {
vector vPlayerVector;
makevectors(input_angles);
vPlayerVector = v_forward;
vPlayerVector = (vPlayerVector * 240);
if (input_movevalues[0] > 0) {
self.velocity = vPlayerVector;
} else {
self.velocity = [0,0,0];
}
}*/
// acceleration
flFriction = flWishSpeed - (self.velocity * vecWishDir);
if (flFriction > 0) {
self.velocity = self.velocity + vecWishDir * min(flFriction, serverkeyfloat("phy_accelerate") * flMovetime * flWishSpeed);
}
} else {
/* apply gravity */
self.velocity[2] = self.velocity[2] - (serverkeyfloat("phy_gravity") * flMovetime);
if (flWishSpeed < 30) {
flFriction = flWishSpeed - (self.velocity * vecWishDir);
} else {
flFriction = 30 - (self.velocity * vecWishDir);
}
if (flFriction > 0) {
self.velocity = self.velocity + vecWishDir * (min(flFriction, serverkeyfloat("phy_accelerate")) * flWishSpeed * flMovetime);
}
}
}
/*if (self.gflags & GF_FROZEN) {
self.velocity[0] = self.velocity[1] = 0;
}*/
}
/*
=================
PMove_Rebound
Calls somethings touch() function upon hit.
=================
*/
void PMove_DoTouch(entity tother)
{
entity oself = self;
if (tother.touch) {
other = self;
self = tother;
self.touch();
}
self = oself;
}
/*
=================
PMove_Rebound
This function 'bounces' off any surfaces that were hit
=================
*/
static void PMove_Rebound(vector vecNormal)
{
self.velocity = self.velocity - vecNormal * (self.velocity * vecNormal);
}
/*
=================
PMove_Fix_Origin
Incase BSP precision messes up, this function will attempt
to correct the origin to stop it from being invalid.
=================
*/
float PMove_Fix_Origin(void)
{
float x, y, z;
vector norg, oorg = self.origin;
for (z = 0; z < 3; z++) {
norg[2] = oorg[2] + ((z==2)?-1:z)*0.0125;
for (x = 0; x < 3; x++) {
norg[0] = oorg[0] + ((x==2)?-1:x)*0.0125;
for (y = 0; y < 3; y++) {
norg[1] = oorg[1] + ((y==2)?-1:y)*0.0125;
tracebox(norg, self.mins, self.maxs, norg, FALSE, self);
if (!trace_startsolid) {
//dprint("[PHYSICS] Unstuck\n");
self.origin = norg;
return TRUE;
}
}
}
}
//dprint("[PHYSICS] Stuck\n");
return FALSE;
}
/*
=================
PMove_Run_Move
This function is responsible for moving the entity
forwards according to the various inputs/state.
=================
*/
void PMove_Run_Move(void)
{
vector vecDestPos;
vector vecSavePlane;
float flStepped;
float flMoveTime;
int iAttempts;
if (self.movetype == MOVETYPE_NOCLIP) {
self.origin = self.origin + self.velocity * input_timelength;
return;
}
// we need to bounce off surfaces (in order to slide along them), so we need at 2 attempts
for (iAttempts = 3, flMoveTime = input_timelength; flMoveTime > 0 && iAttempts; iAttempts--) {
vecDestPos = self.origin + (self.velocity * flMoveTime);
tracebox(self.origin, self.mins, self.maxs, vecDestPos, FALSE, self);
if (trace_startsolid) {
if (!PMove_Fix_Origin()) {
return;
}
continue;
}
self.origin = trace_endpos;
if (trace_fraction < 1) {
vecSavePlane = trace_plane_normal;
flMoveTime -= flMoveTime * trace_fraction;
if (flMoveTime) {
// step up if we can
trace_endpos = self.origin;
if (self.flags & FL_ONGROUND) {
trace_endpos[2] += serverkeyfloat("phy_stepheight");
} else {
trace_endpos[2] += serverkeyfloat("phy_airstepheight");
}
tracebox(self.origin, self.mins, self.maxs, trace_endpos, FALSE, self);
flStepped = trace_endpos[2] - self.origin[2];
float roof_fraction = trace_fraction;
vector roof_plane_normal = trace_plane_normal;
vecDestPos = trace_endpos + self.velocity*flMoveTime;
vecDestPos[2] = trace_endpos[2]; /*only horizontally*/
// move forwards
tracebox(trace_endpos, self.mins, self.maxs, vecDestPos, FALSE, self);
// if we got anywhere, make this raised-step move count
if (trace_fraction != 0) {
float fwfrac = trace_fraction;
vector fwplane = trace_plane_normal;
// move down
vecDestPos = trace_endpos;
vecDestPos[2] -= flStepped + 1;
tracebox(trace_endpos, self.mins, self.maxs, vecDestPos, FALSE, self);
if (trace_fraction < 1 && trace_plane_normal[2] > 0.7f) {
flMoveTime -= flMoveTime * fwfrac;
/* bounce off the ceiling if we hit it while airstepping */
if (roof_fraction < 1) {
PMove_Rebound(roof_plane_normal);
}
/* FIXME: you probably want this: && self.velocity[2] < 0 */
if (trace_fraction < 1) {
PMove_Rebound(trace_plane_normal);
} else if (fwfrac < 1) {
PMove_Rebound(fwplane);
}
self.origin = trace_endpos;
continue;
}
}
}
//stepping failed, just bounce off
PMove_Rebound(vecSavePlane);
PMove_DoTouch(trace_ent);
} else {
break;
}
}
if ((self.flags & FL_ONGROUND) && !(self.velocity[2] > 0)) {
/* try to step down, only if there's something down there */
vecDestPos = self.origin;
vecDestPos[2] -= serverkeyfloat("phy_stepheight");
tracebox(self.origin, self.mins, self.maxs, vecDestPos, FALSE, self); //try going straight there
if (trace_fraction >= 1) {
return;
}
if (trace_startsolid) {
if (!PMove_Fix_Origin()) {
return;
}
}
self.origin = trace_endpos;
PMove_DoTouch(trace_ent);
}
}
/*
=================
PMove_Run
Runs the physics for one input frame.
=================
*/
void PMove_Run(void)
{
PMove_WaterMove();
if (self.waterlevel >= 2) {
PMove_CheckWaterJump();
}
if (input_buttons & INPUT_BUTTON2) {
input_movevalues[2] = 240;
}
if (input_buttons & INPUT_BUTTON8) {
input_movevalues[2] = -240;
}
self.dimension_solid = 255;
self.dimension_hit = 255;
/* Call accelerate before and after the actual move,
* with half the move each time.
* This reduces framerate dependance. */
PMove_Run_Acceleration(input_timelength / 2, TRUE);
PMove_Run_Move();
PMove_Run_Acceleration(input_timelength / 2, FALSE);
self.dimension_solid = 254;
self.dimension_hit = 254;
/* NOTE: should clip to network precision here if lower than a float */
self.angles = input_angles;
self.angles[0] *= -0.333;
touchtriggers();
}

129
Source/Shared/spraylogo.cpp Normal file
View file

@ -0,0 +1,129 @@
/***
*
* Copyright(c) 2000-2019, Vera Visions. All rights reserved.
*
****/
#ifdef SSQC
.float nextspray;
void Spray_RemoveAll(entity entOwner)
{
for (entity eFind = world;(eFind = find(eFind, classname, "Spray"));) {
if (eFind.owner == entOwner) {
remove(eFind);
}
}
}
float Spray_SendEntity(entity ePVSEnt, float fChanged)
{
WriteByte(MSG_ENTITY, ENT_SPRAY);
WriteCoord(MSG_ENTITY, self.origin_x);
WriteCoord(MSG_ENTITY, self.origin_y);
WriteCoord(MSG_ENTITY, self.origin_z);
WriteCoord(MSG_ENTITY, self.angles_x);
WriteCoord(MSG_ENTITY, self.angles_y);
WriteCoord(MSG_ENTITY, self.angles_z);
WriteEntity(MSG_ENTITY, self.owner);
return TRUE;
}
void CSEv_Spraylogo(void)
{
if (self.nextspray > time) {
return;
}
self.nextspray = time + 30.0f;
makevectors(self.v_angle);
traceline(self.origin + self.view_ofs,
self.origin + self.view_ofs + v_forward * 128, FALSE, self);
if (trace_fraction != 1.0f) {
Spray_RemoveAll(self);
entity eSpray = spawn();
eSpray.classname = "Spray";
eSpray.owner = self;
eSpray.solid = SOLID_NOT;
setorigin(eSpray, trace_endpos);
vector vSprayAngles = self.v_angle;
vSprayAngles_x *= -1;
makevectors(vSprayAngles);
vector vecCoplanar = v_forward -(v_forward * trace_plane_normal)
* trace_plane_normal;
if (trace_plane_normal_z == 0) {
vecCoplanar = '0 0 1';
}
eSpray.angles = vectoangles(vecCoplanar, trace_plane_normal);
eSpray.SendEntity = Spray_SendEntity;
eSpray.SendFlags = 1;
sound(self, CHAN_VOICE, "player/sprayer.wav", 1.0, ATTN_NORM);
}
}
#endif
#ifdef CSQC
class CSpraylogo
{
vector m_vecPosition;
vector m_vecAngles;
int m_iOwnerID;
string m_strLogoname;
string m_strLogopath;
int m_iInitialized;
virtual float(void) predraw;
};
float CSpraylogo::predraw(void)
{
int iSize = getplayerkeyblob(m_iOwnerID, "spray", __NULL__, 0);
if (iSize <= 0) {
return PREDRAW_NEXT;
}
if (m_iInitialized == FALSE) {
void *image;
m_iInitialized = TRUE;
image = memalloc(iSize + 1);
getplayerkeyblob(m_iOwnerID, "spray", image, iSize);
r_uploadimage(m_strLogopath, 64, 64, image, iSize, 0);
memfree(image);
print(sprintf("[CLIENT] Spray from player: %s\n",
getplayerkeyvalue(m_iOwnerID, "name")));
shaderforname(m_strLogoname,
sprintf("{\ncull disable\npolygonOffset\n{\nmap $rt:%s\nblendFunc add}\n}\n",
m_strLogopath));
} else {
makevectors(m_vecAngles);
adddecal(m_strLogoname, m_vecPosition,
v_up / 64, v_forward / 64, '1 0 0', 1.0f);
addentity(this);
}
return PREDRAW_NEXT;
}
void Spraylogo_Parse(void)
{
spawnfunc_CSpraylogo();
CSpraylogo spSelf =(CSpraylogo)self;
spSelf.drawmask = MASK_ENGINE;
spSelf.m_vecPosition[0] = readcoord();
spSelf.m_vecPosition[1] = readcoord();
spSelf.m_vecPosition[2] = readcoord();
spSelf.m_vecAngles[0] = readcoord();
spSelf.m_vecAngles[1] = readcoord();
spSelf.m_vecAngles[2] = readcoord();
spSelf.m_iInitialized = FALSE;
spSelf.m_iOwnerID = readentitynum() - 1;
spSelf.m_strLogoname = sprintf("spray_%s",
getplayerkeyvalue(spSelf.m_iOwnerID, "name"));
spSelf.m_strLogopath = sprintf("simg_%s",
getplayerkeyvalue(spSelf.m_iOwnerID, "name"));
}
#endif

View file

@ -4,10 +4,6 @@
*
****/
#ifndef FADEOVERLAY
#define FADEOVERLAY
#endif
float g_flFadeDuration;
float g_flFadeHold;
float g_flFadeMaxAlpha;
@ -32,49 +28,49 @@ enumflags
EVF_ONLYUSER
};
void Fade_Init ( void )
void Fade_Init(void)
{
shaderforname( "fade_modulate","{\n{\nmap $whiteimage\nrgbGen vertex\nblendFunc GL_DST_COLOR GL_ONE_MINUS_SRC_ALPHA\nalphaGen vertex\n}\n}\n" );
shaderforname("fade_modulate","{\n{\nmap $whiteimage\nrgbGen vertex\nblendFunc GL_DST_COLOR GL_ONE_MINUS_SRC_ALPHA\nalphaGen vertex\n}\n}\n");
}
void Fade_Update ( float x, float y, float w, float h )
void Fade_Update (int x, int y, int w, int h)
{
if ( g_iFadeActive == FALSE ) {
if (g_iFadeActive == FALSE) {
return;
}
if ( g_flFadeStyle & EVF_FADEDROM ) {
if ( g_flFadeTime > g_flFadeHold ) {
g_flFadeAlpha -= ( frametime * ( 1.0f / g_flFadeDuration ) ) * g_flFadeMaxAlpha;
if (g_flFadeStyle & EVF_FADEDROM) {
if (g_flFadeTime > g_flFadeHold) {
g_flFadeAlpha -= (frametime * (1.0f / g_flFadeDuration)) * g_flFadeMaxAlpha;
}
} else {
if ( g_flFadeTime < g_flFadeDuration ) {
g_flFadeAlpha += ( frametime * ( 1.0f / g_flFadeDuration ) ) * g_flFadeMaxAlpha;
if (g_flFadeTime < g_flFadeDuration) {
g_flFadeAlpha += (frametime * (1.0f / g_flFadeDuration)) * g_flFadeMaxAlpha;
} else {
g_flFadeAlpha -= ( frametime * ( 1.0f / g_flFadeHold ) ) * g_flFadeMaxAlpha;
g_flFadeAlpha -= (frametime * (1.0f / g_flFadeHold)) * g_flFadeMaxAlpha;
}
}
if ( g_flFadeAlpha > 1.0f ) {
if (g_flFadeAlpha > 1.0f) {
g_flFadeAlpha = 1.0f;
} else if ( g_flFadeAlpha < 0.0f ) {
} else if (g_flFadeAlpha < 0.0f) {
g_flFadeAlpha = 0.0f;
}
if ( g_flFadeAlpha <= 0 ) {
if (g_flFadeAlpha <= 0) {
g_iFadeActive = FALSE;
return;
}
if ( g_flFadeStyle & EVF_MODULATE ) {
drawpic( [x, y], "fade_modulate", [w, h], g_vecFadeColor, g_flFadeAlpha, 0 );
if (g_flFadeStyle & EVF_MODULATE) {
drawpic([x, y], "fade_modulate", [w, h], g_vecFadeColor, g_flFadeAlpha, 0);
} else {
drawfill( [x, y], [w, h], g_vecFadeColor, g_flFadeAlpha, 0 );
drawfill([x, y], [w, h], g_vecFadeColor, g_flFadeAlpha, 0);
}
g_flFadeTime += frametime;
}
void Fade_Parse ( void )
void Fade_Parse (void)
{
g_vecFadeColor[0] = readbyte() / 255;
g_vecFadeColor[1] = readbyte() / 255;
@ -85,7 +81,7 @@ void Fade_Parse ( void )
g_flFadeStyle = readbyte();
g_flFadeTime = 0.0f;
if ( g_flFadeStyle & EVF_FADEDROM ) {
if (g_flFadeStyle & EVF_FADEDROM) {
g_flFadeAlpha = 1.0f;
} else {
g_flFadeAlpha = 0.0f;

View file

@ -16,7 +16,7 @@ enumflags
AS_NOTTOGGLED
};
class CAmbientGeneric : CBaseTrigger {
class ambient_generic : CBaseTrigger {
string m_strActivePath;
string m_strSoundPath;
float m_flVolume;
@ -29,10 +29,10 @@ class CAmbientGeneric : CBaseTrigger {
float m_flVolume_Start;
float m_flFadeIn;
float m_flFadeOut;*/ // TODO: Do this in CSQC
void() CAmbientGeneric;
void() ambient_generic;
};
static float CAmbientGeneric::Network(entity ePEnt, float fChanged)
static float ambient_generic::Network(entity ePEnt, float fChanged)
{
WriteByte( MSG_ENTITY, ENT_AMBIENTSOUND );
WriteCoord( MSG_ENTITY, origin[0] );
@ -45,11 +45,11 @@ static float CAmbientGeneric::Network(entity ePEnt, float fChanged)
WriteByte( MSG_ENTITY, 0 );
return TRUE;
}
void CAmbientGeneric::UseNormal( void )
void ambient_generic::UseNormal( void )
{
sound(this, CHAN_VOICE, m_strActivePath, m_flVolume, m_flRadius, m_flPitch);
}
void CAmbientGeneric::UseLoop( void )
void ambient_generic::UseLoop( void )
{
if ( m_iToggleSwitch == TRUE ) {
m_strActivePath = "common/null.wav";
@ -62,7 +62,7 @@ void CAmbientGeneric::UseLoop( void )
}
}
void CAmbientGeneric::CAmbientGeneric ( void )
void ambient_generic::ambient_generic ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -88,7 +88,7 @@ void CAmbientGeneric::CAmbientGeneric ( void )
}
if ( !m_strSoundPath ) {
objerror( "CAmbientGeneric: No sound file specified. Aborting." );
objerror( "ambient_generic: No sound file specified. Aborting." );
}
precache_sound( m_strSoundPath );
@ -127,6 +127,3 @@ void CAmbientGeneric::CAmbientGeneric ( void )
CBaseTrigger::CBaseTrigger();
}
CLASSEXPORT( ambient_generic, CAmbientGeneric )

View file

@ -25,16 +25,16 @@ Notes
Given the way this entity behaves, there is little practical use for this entity beyond viewing animations (for which there are programs that are far more convenient).
*/
class CCycler : CBaseEntity
class cycler:CBaseEntity
{
void() CCycler;
void() cycler;
};
void CCycler :: CCycler ( void )
void cycler::cycler(void)
{
precache_model( model );
precache_model(model);
CBaseEntity::CBaseEntity();
setmodel( this, model );
setmodel(this, model);
solid = SOLID_BBOX;
}

View file

@ -6,13 +6,11 @@
*
****/
class CEnvBeam {
void() CEnvBeam;
class env_beam {
void() env_beam;
};
void CEnvBeam :: CEnvBeam ( void )
void env_beam :: env_beam ( void )
{
}
CLASSEXPORT( env_beam, CEnvBeam )

View file

@ -21,16 +21,16 @@ enum
SKIN_RANDOM
};
class CEnvBeverage : CBaseTrigger
class env_beverage : CBaseTrigger
{
int m_iUses;
int m_iReady;
int m_iSkin;
void() CEnvBeverage;
void() env_beverage;
virtual void() Trigger;
};
void CEnvBeverage :: Trigger ( void )
void env_beverage :: Trigger ( void )
{
if ( m_iReady == FALSE || m_iUses <= 0 ) {
return;
@ -47,7 +47,7 @@ void CEnvBeverage :: Trigger ( void )
m_iReady = FALSE;
}
void CEnvBeverage :: CEnvBeverage ( void )
void env_beverage :: env_beverage ( void )
{
precache_model( "models/can.mdl" );
precache_sound( "weapons/g_bounce3.wav" );
@ -68,5 +68,3 @@ void CEnvBeverage :: CEnvBeverage ( void )
}
m_iReady = TRUE;
}
CLASSEXPORT( env_beverage, CEnvBeverage )

View file

@ -15,16 +15,16 @@ enumflags {
ENVEXPLO_NOSPARKS
};
class CEnvExplosion:CBaseTrigger
class env_explosion:CBaseTrigger
{
int m_iMagnitude;
float m_flMaxDelay;
void() CEnvExplosion;
void() env_explosion;
virtual void() Trigger;
};
void CEnvExplosion::CEnvExplosion(void)
void env_explosion::env_explosion(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
@ -38,7 +38,7 @@ void CEnvExplosion::CEnvExplosion(void)
CBaseTrigger::CBaseTrigger();
}
void CEnvExplosion::Trigger(void)
void env_explosion::Trigger(void)
{
Effect_CreateExplosion(origin);
@ -50,5 +50,3 @@ void CEnvExplosion::Trigger(void)
remove(this);
}
}
CLASSEXPORT(env_explosion, CEnvExplosion)

View file

@ -13,16 +13,16 @@ enumflags
EVF_ONLYUSER
};
class CEnvFade : CBaseTrigger
class env_fade : CBaseTrigger
{
float m_flFadeDuration;
float m_flFadeHold;
void() CEnvFade;
void() env_fade;
virtual void() Trigger;
};
void CEnvFade :: Trigger (void)
void env_fade :: Trigger (void)
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_FADE);
@ -42,7 +42,7 @@ void CEnvFade :: Trigger (void)
}
}
void CEnvFade :: CEnvFade (void)
void env_fade :: env_fade (void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
@ -58,5 +58,3 @@ void CEnvFade :: CEnvFade (void)
}
CBaseTrigger::CBaseTrigger();
}
CLASSEXPORT(env_fade, CEnvFade)

View file

@ -17,13 +17,13 @@ enum
const string CENVGLOBAL_CVAR = "env_global_data";
class CEnvGlobal : CBaseTrigger
class env_global : CBaseTrigger
{
string m_strGlobalState;
int m_iTriggerMode;
int m_iInitialState;
void() CEnvGlobal;
void() env_global;
virtual void() Trigger;
virtual int( string ) GlobalPresent;
@ -32,7 +32,7 @@ class CEnvGlobal : CBaseTrigger
virtual int( string ) GetGlobal;
};
void CEnvGlobal :: Trigger ( void ) {
void env_global :: Trigger ( void ) {
int iOldValue = GetGlobal( m_strGlobalState );
int iNewValue = 0;
@ -63,7 +63,7 @@ void CEnvGlobal :: Trigger ( void ) {
}
}
int CEnvGlobal :: GlobalPresent ( string strName ) {
int env_global :: GlobalPresent ( string strName ) {
for ( int i = 1; i < ( tokenize( cvar_string( CENVGLOBAL_CVAR ) ) - 1 ); i += 2 ) {
if ( argv( i ) == strName ) {
return 1;
@ -72,11 +72,11 @@ int CEnvGlobal :: GlobalPresent ( string strName ) {
return 0;
}
void CEnvGlobal :: AddNewGlobal ( string strName, int iValue ) {
void env_global :: AddNewGlobal ( string strName, int iValue ) {
cvar_set( CENVGLOBAL_CVAR, sprintf( "%s %s %i", cvar_string( CENVGLOBAL_CVAR ), strName, iValue ) );
}
void CEnvGlobal :: SetGlobal ( string strName, int iValue ) {
void env_global :: SetGlobal ( string strName, int iValue ) {
string strNewData = "";
for ( int i = 1; i < ( tokenize( cvar_string( CENVGLOBAL_CVAR ) ) - 1 ); i += 2 ) {
if ( argv( i ) != strName ) {
@ -86,7 +86,7 @@ void CEnvGlobal :: SetGlobal ( string strName, int iValue ) {
cvar_set( CENVGLOBAL_CVAR, sprintf( "%s %s %i", strNewData, strName, iValue ) );
}
int CEnvGlobal :: GetGlobal ( string strName ) {
int env_global :: GetGlobal ( string strName ) {
for ( int i = 1; i < ( tokenize( cvar_string( CENVGLOBAL_CVAR ) ) - 1 ); i += 2 ) {
if ( argv( i ) == strName ) {
return stoi( argv( i + 1 ) );
@ -95,7 +95,7 @@ int CEnvGlobal :: GetGlobal ( string strName ) {
return 0;
}
void CEnvGlobal :: CEnvGlobal ( void )
void env_global :: env_global ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -114,7 +114,7 @@ void CEnvGlobal :: CEnvGlobal ( void )
}
if ( !m_strGlobalState ) {
objerror( "CEnvGlobal: No globalstate name given! Aborting\n" );
objerror( "env_global: No globalstate name given! Aborting\n" );
}
if ( spawnflags & GLOBAL_SETSPAWN ) {
@ -123,5 +123,3 @@ void CEnvGlobal :: CEnvGlobal ( void )
}
}
}
CLASSEXPORT( env_global, CEnvGlobal )

View file

@ -8,21 +8,20 @@
/* https://twhl.info/wiki/page/env_sprite_(Half-Life) */
enumflags {
enumflags
{
ENVS_STARTON,
ENVS_PLAYONCE
};
class CEnvGlow : CBaseEntity
class env_glow : CBaseEntity
{
void() CEnvGlow;
void() env_glow;
};
void CEnvGlow::CEnvGlow(void)
void env_glow::env_glow(void)
{
CBaseEntity::CBaseEntity();
precache_model(m_oldModel);
Respawn();
}
CLASSEXPORT(env_glow, CEnvGlow)

View file

@ -13,12 +13,12 @@ enumflags {
SF_NORENDERCOLOR
};
class CEnvRender:CBaseTrigger
class env_render:CBaseTrigger
{
virtual void() Trigger;
};
void CEnvRender::Trigger(void)
void env_render::Trigger(void)
{
for (entity eFind = world;
(eFind = find(eFind, CBaseTrigger::m_strTargetName, m_strTarget));) {
@ -36,4 +36,3 @@ void CEnvRender::Trigger(void)
}
}
CLASSEXPORT(env_render, CEnvRender)

View file

@ -8,18 +8,18 @@
#define EVS_GLOBAL 1
class CEnvShake : CBaseTrigger
class env_shake : CBaseTrigger
{
float m_flRadius;
float m_flAmplitude;
float m_flDuration;
float m_flFrequency;
void() CEnvShake;
void() env_shake;
virtual void() Trigger;
};
void CEnvShake :: Trigger (void)
void env_shake :: Trigger (void)
{
for (entity eClients = world; (eClients = find(eClients, ::classname, "Player"));) {
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
@ -33,7 +33,7 @@ void CEnvShake :: Trigger (void)
}
}
void CEnvShake :: CEnvShake (void)
void env_shake :: env_shake (void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
@ -55,5 +55,3 @@ void CEnvShake :: CEnvShake (void)
}
CBaseTrigger::CBaseTrigger();
}
CLASSEXPORT(env_shake, CEnvShake)

View file

@ -6,7 +6,7 @@
*
****/
class CEnvShooter : CBaseTrigger
class env_shooter : CBaseTrigger
{
float m_iGibs;
float m_flDelay;
@ -19,7 +19,7 @@ class CEnvShooter : CBaseTrigger
float m_flSkin;
};
void CEnvShooter :: Trigger ( void )
void env_shooter :: Trigger ( void )
{
static void Gib_Remove ( void ) { remove( self ); }
for ( int i = 0; i < m_iGibs; i++ ) {
@ -34,7 +34,7 @@ void CEnvShooter :: Trigger ( void )
}
}
void CEnvShooter :: CEnvShooter ( void )
void env_shooter :: env_shooter ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -73,5 +73,3 @@ void CEnvShooter :: CEnvShooter ( void )
precache_model( m_strShootModel );
CBaseTrigger::CBaseTrigger();
}
CLASSEXPORT( env_shooter, CEnvShooter )

View file

@ -25,18 +25,18 @@ string spark_snd[] = {
"buttons/spark6.wav"
};
class CEnvSpark:CBaseTrigger
class env_spark:CBaseTrigger
{
float m_flMaxDelay;
void() CEnvSpark;
void() env_spark;
virtual void() CreateSpark;
virtual void() TimedSpark;
virtual void() Trigger;
virtual void() Respawn;
};
void CEnvSpark::CEnvSpark(void)
void env_spark::env_spark(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
@ -54,19 +54,19 @@ void CEnvSpark::CEnvSpark(void)
Respawn();
}
void CEnvSpark::CreateSpark(void)
void env_spark::CreateSpark(void)
{
int r = floor((random() * 6));
sound(this, CHAN_AUTO, spark_snd[r], 1.0f, ATTN_IDLE);
}
void CEnvSpark::TimedSpark(void)
void env_spark::TimedSpark(void)
{
CreateSpark();
nextthink = time + (random() * m_flMaxDelay);
}
void CEnvSpark::Trigger(void)
void env_spark::Trigger(void)
{
if (spawnflags & EVSPARK_TOGGLE) {
if (think != __NULL__) {
@ -81,7 +81,7 @@ void CEnvSpark::Trigger(void)
}
}
void CEnvSpark::Respawn(void)
void env_spark::Respawn(void)
{
if (m_flMaxDelay <= 0) {
m_flMaxDelay = 1.0f;
@ -94,5 +94,3 @@ void CEnvSpark::Respawn(void)
}
}
}
CLASSEXPORT(env_spark, CEnvSpark)

View file

@ -8,18 +8,19 @@
/* https://twhl.info/wiki/page/env_sprite_(Half-Life) */
enumflags {
enumflags
{
ENVS_STARTON,
ENVS_PLAYONCE
};
class CEnvSprite : CBaseTrigger
class env_sprite : CBaseTrigger
{
void() CEnvSprite;
void() env_sprite;
virtual void() Trigger;
};
void CEnvSprite::Trigger(void)
void env_sprite::Trigger(void)
{
Respawn();
if (spawnflags & ENVS_PLAYONCE) {
@ -27,7 +28,7 @@ void CEnvSprite::Trigger(void)
}
}
void CEnvSprite::CEnvSprite(void)
void env_sprite::env_sprite(void)
{
CBaseTrigger::CBaseTrigger();
precache_model(m_oldModel);
@ -37,5 +38,3 @@ void CEnvSprite::CEnvSprite(void)
Hide();
}
}
CLASSEXPORT(env_sprite, CEnvSprite)

View file

@ -20,26 +20,27 @@ enumflags
SF_PRESSURE
};
class CFuncBreakable : CBaseTrigger
class func_breakable : CBaseTrigger
{
float m_iMaterial;
float m_flDelay;
/*entity m_pressAttacker;
int m_pressType;
int m_pressDamage;*/
virtual void() Trigger;
virtual void() touch;
virtual void() PlayerTouch;
/*virtual void() PressureDeath;*/
virtual void( entity eAttacker, int iType, int iDamage ) vPain;
virtual void( entity eAttacker, int iType, int iDamage ) vDeath;
};
void CFuncBreakable :: Respawn ( void )
void func_breakable :: vPain ( entity attacker, int type, int damage )
{
if ( spawnflags & SF_TRIGGER ) {
takedamage = DAMAGE_NO;
} else {
takedamage = DAMAGE_YES;
if (spawnflags & SF_TRIGGER) {
return;
}
}
void CFuncBreakable :: vPain ( entity attacker, int type, int damage )
{
if (serverkeyfloat("*bspversion") != 30) {
return;
}
@ -57,7 +58,8 @@ void CFuncBreakable :: vPain ( entity attacker, int type, int damage )
break;
case MATERIAL_FLESH:
float fRand = floor( random( 1, 8 ) );
if ( fRand == 4 ) { // sigh
/* There never was a flesh4.wav */
if ( fRand == 4 ) {
fRand = 5;
}
sound( self, CHAN_VOICE, sprintf( "debris/flesh%d.wav", fRand ), 1.0, ATTN_NORM );
@ -69,33 +71,75 @@ void CFuncBreakable :: vPain ( entity attacker, int type, int damage )
}
}
void CFuncBreakable :: vDeath ( entity attacker, int type, int damage )
void func_breakable :: vDeath ( entity attacker, int type, int damage )
{
if (m_iMaterial == MATERIAL_GLASS_UNBREAKABLE) {
return;
}
health = 0;
Effect_BreakModel( absmin, absmax, '0 0 0', m_iMaterial );
CBaseTrigger::UseTargets();
CBaseEntity::Hide();
}
void CFuncBreakable :: Trigger ( void )
void func_breakable :: Trigger ( void )
{
CFuncBreakable::vDeath( world, 0, 0 );
func_breakable::vDeath( world, 0, 0 );
}
void CFuncBreakable :: touch ( void )
/*void func_breakable :: PressureDeath ( void )
{
func_breakable::vDeath(m_pressAttacker, m_pressType, m_pressDamage);
}*/
void func_breakable :: PlayerTouch ( void )
{
if ( other.classname == classname ) {
return;
}
if ( m_iMaterial == MATERIAL_GLASS ) {
if (vlen(other.velocity) > 200) {
vDeath( other, 0, 1 );
if (spawnflags & SF_TOUCH) {
int fDamage = (float)(vlen(other.velocity) * 0.01f);
if (fDamage >= health) {
touch = __NULL__;
Damage_Apply( this, other, fDamage, absmin, FALSE );
if ((m_iMaterial == MATERIAL_GLASS) || (m_iMaterial == MATERIAL_COMPUTER)) {
Damage_Apply(other, this, fDamage / 4, other.origin, FALSE);
}
}
}
if ((spawnflags & SF_PRESSURE) && (other.absmin_z >= maxs_z - 2)) {
think = Trigger;
if (m_flDelay == 0) {
m_flDelay = 0.1f;
}
nextthink = time + m_flDelay;
}
}
void CFuncBreakable :: CFuncBreakable( void )
void func_breakable :: Respawn ( void )
{
touch = PlayerTouch;
if ( spawnflags & SF_TRIGGER ) {
takedamage = DAMAGE_NO;
} else {
takedamage = DAMAGE_YES;
}
health = m_oldHealth;
if ( !health ) {
health = 15;
}
}
void func_breakable :: func_breakable( void )
{
precache_model( model );
angles = [0,0,0];
@ -103,21 +147,20 @@ void CFuncBreakable :: CFuncBreakable( void )
solid = SOLID_BSP;
setmodel( this, model );
CBaseEntity::CBaseEntity();
CFuncBreakable::Respawn();
func_breakable::Respawn();
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
case "material":
m_iMaterial = stoi( argv( i + 1 ) );
m_iMaterial = stof( argv( i + 1 ) );
break;
case "delay":
m_flDelay = stof( argv( i + 1 ) );
break;
default:
break;
}
}
if ( !health ) {
health = 15;
}
}
CLASSEXPORT( func_breakable, CFuncBreakable )

View file

@ -25,7 +25,7 @@ enum
FRAME_ON
};
class CButton : CBaseTrigger
class func_button : CBaseTrigger
{
float m_flSpeed;
float m_flLip;
@ -56,7 +56,7 @@ class CButton : CBaseTrigger
virtual void() MoveToDestination_End;
};
void CButton :: Precache( void )
void func_button :: Precache( void )
{
precache_model( model );
switch( m_iSounds ) {
@ -127,7 +127,7 @@ void CButton :: Precache( void )
precache_sound( m_strNoise );
}
void CButton :: Arrived( void )
void func_button :: Arrived( void )
{
m_iState = STATE_RAISED;
@ -144,7 +144,7 @@ void CButton :: Arrived( void )
}
}
void CButton :: Returned( void )
void func_button :: Returned( void )
{
if ( !( spawnflags & SF_BTT_TOUCH_ONLY ) ) {
touch = Touch;
@ -154,7 +154,7 @@ void CButton :: Returned( void )
frame = FRAME_OFF;
}
void CButton :: MoveBack( void )
void func_button :: MoveBack( void )
{
if ( !( spawnflags & SF_BTT_TOUCH_ONLY ) ) {
touch = __NULL__;
@ -163,13 +163,13 @@ void CButton :: MoveBack( void )
m_iState = STATE_DOWN;
if ( m_vecPos2 != m_vecPos1 ) {
CButton::MoveToDestination ( m_vecPos1, Returned );
func_button::MoveToDestination ( m_vecPos1, Returned );
} else {
CButton::Returned();
func_button::Returned();
}
}
void CButton :: MoveAway( void )
void func_button :: MoveAway( void )
{
if ( m_iState == STATE_UP ) {
return;
@ -183,15 +183,15 @@ void CButton :: MoveAway( void )
m_iState = STATE_UP;
if ( m_vecPos2 != m_vecPos1 ) {
CButton::MoveToDestination( m_vecPos2, Arrived );
func_button::MoveToDestination( m_vecPos2, Arrived );
} else {
CButton::Arrived();
func_button::Arrived();
}
frame = FRAME_ON;
}
void CButton :: Trigger( void )
void func_button :: Trigger( void )
{
if ( m_flNextTrigger > time ) {
return;
@ -201,31 +201,31 @@ void CButton :: Trigger( void )
if ( ( m_iState == STATE_UP ) || ( m_iState == STATE_RAISED ) ){
if ( m_flWait != -1 ) {
CButton::MoveBack();
func_button::MoveBack();
}
return;
}
sound( this, CHAN_VOICE, m_strNoise, 1.0, ATTN_NORM );
CButton::MoveAway();
func_button::MoveAway();
if ( m_flDelay ) {
#ifdef GS_DEVELOPER
dprint( sprintf( "CButton: Delayed trigger of `%s`\n", m_strTarget ) );
dprint( sprintf( "func_button: Delayed trigger of `%s`\n", m_strTarget ) );
#endif
CBaseTrigger::UseTargets_Delay( m_flDelay );
} else {
#ifdef GS_DEVELOPER
print( sprintf( "CButton: Normal trigger of `%s`\n", m_strTarget ) );
print( sprintf( "func_button: Normal trigger of `%s`\n", m_strTarget ) );
#endif
CBaseTrigger::UseTargets();
}
}
void CButton :: Touch( void )
void func_button :: Touch( void )
{
if ( other.movetype == MOVETYPE_WALK ) {
CButton::Trigger();
func_button::Trigger();
if ( !( spawnflags & SF_BTT_TOUCH_ONLY ) ) {
touch = __NULL__;
@ -233,12 +233,12 @@ void CButton :: Touch( void )
}
}
void CButton :: PlayerUse ( void )
void func_button :: PlayerUse ( void )
{
Trigger();
}
void CButton :: Blocked( void )
void func_button :: Blocked( void )
{
if ( m_iDamage ) {
//Damage_Apply( other, this, dmg, other.origin, FALSE );
@ -246,14 +246,14 @@ void CButton :: Blocked( void )
if ( m_flWait >= 0 ) {
if ( m_iState == STATE_DOWN ) {
CButton::MoveAway ();
func_button::MoveAway ();
} else {
CButton::MoveBack ();
func_button::MoveBack ();
}
}
}
void CButton :: SetMovementDirection( void )
void func_button :: SetMovementDirection( void )
{
if ( angles == '0 -1 0' ) {
movedir = '0 0 1';
@ -267,7 +267,7 @@ void CButton :: SetMovementDirection( void )
angles = '0 0 0';
}
void CButton :: MoveToDestination_End( void )
void func_button :: MoveToDestination_End( void )
{
setorigin( this, m_vecDest );
velocity = '0 0 0';
@ -275,7 +275,7 @@ void CButton :: MoveToDestination_End( void )
m_pMove();
}
void CButton :: MoveToDestination( vector vDestination, void() func )
void func_button :: MoveToDestination( vector vDestination, void() func )
{
vector vecDifference;
float flTravel, fTravelTime;
@ -308,7 +308,7 @@ void CButton :: MoveToDestination( vector vDestination, void() func )
velocity = ( vecDifference * ( 1 / fTravelTime ) );
}
void CButton :: CButton( void )
void func_button :: func_button( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -332,8 +332,8 @@ void CButton :: CButton( void )
}
}
CButton::Precache();
CButton::SetMovementDirection();
func_button::Precache();
func_button::SetMovementDirection();
CBaseTrigger::CBaseTrigger();
solid = SOLID_BSP;
@ -364,5 +364,3 @@ void CButton :: CButton( void )
m_iState = STATE_LOWERED;
}
CLASSEXPORT( func_button, CButton )

View file

@ -9,18 +9,18 @@
#define SF_CONVEYOR_VISUAL 1
#define SF_CONVEYOR_NOTSOLID 2
class CFuncConveyor : CFuncWall
class func_conveyor : func_wall
{
float m_flSpeed;
vector m_vecMoveDir;
void() CFuncConveyor;
void() func_conveyor;
virtual void() Trigger;
virtual void() touch;
virtual void() SetMovementDirection;
virtual void( float ) UpdateSpeed;
};
void CFuncConveyor :: SetMovementDirection ( void )
void func_conveyor :: SetMovementDirection ( void )
{
if ( angles == '0 -1 0' ) {
m_vecMoveDir = '0 0 1';
@ -36,7 +36,7 @@ void CFuncConveyor :: SetMovementDirection ( void )
// HACKHACK -- This is ugly, but encode the speed in the rendercolor to avoid adding more data to the network stream
void CFuncConveyor :: UpdateSpeed( float flSpeed )
void func_conveyor :: UpdateSpeed( float flSpeed )
{
// Encode it as an integer with 4 fractional bits
/*int speedCode = (int)( fabs( flSpeed ) * 16.0f );
@ -51,22 +51,22 @@ void CFuncConveyor :: UpdateSpeed( float flSpeed )
pev->rendercolor.z = (speedCode & 0xFF);*/
}
void CFuncConveyor :: touch ( void )
void func_conveyor :: touch ( void )
{
//other.basevelocity = m_vecMoveDir * m_flSpeed;
}
void CFuncConveyor :: Trigger ( void )
void func_conveyor :: Trigger ( void )
{
m_flSpeed = -m_flSpeed;
UpdateSpeed( m_flSpeed );
}
void CFuncConveyor :: CFuncConveyor ( void )
void func_conveyor :: func_conveyor ( void )
{
SetMovementDirection();
CFuncWall::CFuncWall();
func_wall::func_wall();
if ( !( spawnflags & SF_CONVEYOR_VISUAL ) ) {
//SetBits( pev->flags, FL_CONVEYOR );
@ -84,5 +84,3 @@ void CFuncConveyor :: CFuncConveyor ( void )
UpdateSpeed( m_flSpeed );
}
CLASSEXPORT( func_conveyor, CFuncConveyor )

View file

@ -21,7 +21,7 @@ enum
STATE_DOWN
};
class CFuncDoor : CBaseTrigger
class func_door : CBaseTrigger
{
vector m_vecPos1;
vector m_vecPos2;
@ -38,7 +38,7 @@ class CFuncDoor : CBaseTrigger
int m_iDamage;
int m_iLocked;
void() CFuncDoor;
void() func_door;
virtual void() SetMovementDirection;
virtual void(vector vdest, void() func) MoveToDestination;
virtual void() MoveToDestination_End;
@ -54,129 +54,129 @@ class CFuncDoor : CBaseTrigger
virtual void() m_pMove = 0;
};
void CFuncDoor :: Precache ( void )
void func_door :: Precache (void)
{
if( m_iMoveSnd > 0 && m_iMoveSnd <= 10 ) {
precache_sound( sprintf( "doors/doormove%i.wav", m_iMoveSnd ) );
if(m_iMoveSnd > 0 && m_iMoveSnd <= 10) {
precache_sound(sprintf("doors/doormove%i.wav", m_iMoveSnd));
} else {
precache_sound( "common/null.wav" );
precache_sound("common/null.wav");
}
if( m_iStopSnd > 0 && m_iStopSnd <= 8 ) {
precache_sound( sprintf( "doors/doorstop%i.wav", m_iStopSnd ) );
if(m_iStopSnd > 0 && m_iStopSnd <= 8) {
precache_sound(sprintf("doors/doorstop%i.wav", m_iStopSnd));
} else {
precache_sound( "common/null.wav" );
precache_sound("common/null.wav");
}
}
void CFuncDoor :: PlayerUse ( void )
void func_door :: PlayerUse (void)
{
eActivator.gflags &= ~GF_USE_RELEASED;
Trigger();
}
void CFuncDoor :: Arrived ( void )
void func_door :: Arrived (void)
{
m_iState = STATE_RAISED;
if( m_iStopSnd > 0 && m_iStopSnd <= 8 ) {
sound( self, CHAN_VOICE, sprintf( "doors/doorstop%i.wav", m_iStopSnd ), 1.0, ATTN_NORM );
if(m_iStopSnd > 0 && m_iStopSnd <= 8) {
sound(self, CHAN_VOICE, sprintf("doors/doorstop%i.wav", m_iStopSnd), 1.0, ATTN_NORM);
} else {
sound( self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM );
sound(self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);
}
if ( !( spawnflags & SF_MOV_USE ) ) {
if (!(spawnflags & SF_MOV_USE)) {
touch = Touch;
}
if ( m_flWait < 0 ) {
if (m_flWait < 0) {
return;
}
if ( !( spawnflags & SF_MOV_TOGGLE ) ) {
if (!(spawnflags & SF_MOV_TOGGLE)) {
think = MoveBack;
nextthink = ( ltime + m_flWait );
nextthink = (ltime + m_flWait);
}
}
void CFuncDoor :: Returned ( void )
void func_door :: Returned (void)
{
if( m_iStopSnd > 0 && m_iStopSnd <= 8 ) {
sound( self, CHAN_VOICE, sprintf( "doors/doorstop%i.wav", m_iStopSnd ), 1.0, ATTN_NORM );
if(m_iStopSnd > 0 && m_iStopSnd <= 8) {
sound(self, CHAN_VOICE, sprintf("doors/doorstop%i.wav", m_iStopSnd), 1.0, ATTN_NORM);
} else {
sound( self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM );
sound(self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);
}
if ( !( spawnflags & SF_MOV_USE ) ) {
if (!(spawnflags & SF_MOV_USE)) {
touch = Touch;
}
m_iState = STATE_LOWERED;
}
void CFuncDoor :: MoveBack ( void )
void func_door :: MoveBack (void)
{
if( m_iMoveSnd > 0 && m_iMoveSnd <= 10 ) {
sound( self, CHAN_VOICE, sprintf( "doors/doormove%i.wav", m_iMoveSnd ), 1.0, ATTN_NORM );
if(m_iMoveSnd > 0 && m_iMoveSnd <= 10) {
sound(self, CHAN_VOICE, sprintf("doors/doormove%i.wav", m_iMoveSnd), 1.0, ATTN_NORM);
} else {
sound( self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM );
sound(self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);
}
if ( !( spawnflags & SF_MOV_USE ) ) {
if (!(spawnflags & SF_MOV_USE)) {
touch = __NULL__;
}
m_iState = STATE_DOWN;
MoveToDestination( m_vecPos1, Returned );
MoveToDestination(m_vecPos1, Returned);
}
void CFuncDoor :: MoveAway ( void )
void func_door :: MoveAway (void)
{
if ( m_iState == STATE_UP ) {
if (m_iState == STATE_UP) {
return;
}
if( m_iMoveSnd > 0 && m_iMoveSnd <= 10 ) {
sound( self, CHAN_VOICE, sprintf( "doors/doormove%i.wav", m_iMoveSnd ), 1.0, ATTN_NORM );
if(m_iMoveSnd > 0 && m_iMoveSnd <= 10) {
sound(self, CHAN_VOICE, sprintf("doors/doormove%i.wav", m_iMoveSnd), 1.0, ATTN_NORM);
} else {
sound( self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM );
sound(self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);
}
if ( !( spawnflags & SF_MOV_TOGGLE ) ) {
if ( m_iState == STATE_RAISED ) {
nextthink = ( ltime + m_flWait );
if (!(spawnflags & SF_MOV_TOGGLE)) {
if (m_iState == STATE_RAISED) {
nextthink = (ltime + m_flWait);
return;
}
}
m_iState = STATE_UP;
MoveToDestination( m_vecPos2, Arrived );
MoveToDestination(m_vecPos2, Arrived);
}
void CFuncDoor :: Trigger ( void )
void func_door :: Trigger (void)
{
if ( m_flNextTrigger > ltime ) {
if ( !( spawnflags & SF_MOV_TOGGLE ) ) {
if (m_flNextTrigger > ltime) {
if (!(spawnflags & SF_MOV_TOGGLE)) {
return;
}
}
m_flNextTrigger = ltime + m_flWait;
// Only trigger stuff when we are done moving
if ( ( m_iState == STATE_RAISED ) || ( m_iState == STATE_LOWERED ) ) {
if ( m_flDelay > 0 ) {
if ((m_iState == STATE_RAISED) || (m_iState == STATE_LOWERED)) {
if (m_flDelay > 0) {
#ifdef GS_DEVELOPER
print( sprintf( "CFuncDoor: Delayed trigger of `%s`\n", m_strTarget ) );
print(sprintf("func_door: Delayed trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets_Delay( m_flDelay );
CBaseTrigger::UseTargets_Delay(m_flDelay);
} else {
#ifdef GS_DEVELOPER
dprint( sprintf( "CFuncDoor: Normal trigger of `%s`\n", m_strTarget ) );
dprint(sprintf("func_door: Normal trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets();
}
}
if ( ( m_iState == STATE_UP ) || ( m_iState == STATE_RAISED ) ){
if ((m_iState == STATE_UP) || (m_iState == STATE_RAISED)){
MoveBack();
return;
}
@ -184,31 +184,31 @@ void CFuncDoor :: Trigger ( void )
MoveAway();
}
void CFuncDoor :: Touch ( void )
void func_door :: Touch (void)
{
if ( spawnflags & SF_MOV_TOGGLE ) {
if (spawnflags & SF_MOV_TOGGLE) {
return;
}
if ( m_iLocked ) {
if (m_iLocked) {
return;
}
if ( other.movetype == MOVETYPE_WALK ) {
if ( other.absmin[2] <= maxs[2] - 2 ) {
if (other.movetype == MOVETYPE_WALK) {
if (other.absmin[2] <= maxs[2] - 2) {
Trigger();
}
}
}
void CFuncDoor :: Blocked ( void )
void func_door :: Blocked (void)
{
if( m_iDamage ) {
//Damage_Apply( other, self, dmg, other.origin, FALSE );
if(m_iDamage) {
//Damage_Apply(other, self, dmg, other.origin, FALSE);
}
if ( m_flWait >= 0 ) {
if ( m_iState == STATE_DOWN ) {
if (m_flWait >= 0) {
if (m_iState == STATE_DOWN) {
MoveAway ();
} else {
MoveBack ();
@ -217,29 +217,29 @@ void CFuncDoor :: Blocked ( void )
}
void CFuncDoor :: Respawn ( void )
void func_door :: Respawn (void)
{
solid = SOLID_BSP;
movetype = MOVETYPE_PUSH;
setorigin( this, origin );
setmodel( this, model );
setorigin(this, origin);
setmodel(this, model);
blocked = Blocked;
//Use = Trigger;
if ( m_flWait == -1 ) {
if (m_flWait == -1) {
spawnflags |= SF_MOV_TOGGLE;
}
if ( !m_flSpeed ) {
if (!m_flSpeed) {
m_flSpeed = 100;
}
if ( !m_iDamage ) {
if (!m_iDamage) {
m_iDamage = 2;
}
if ( spawnflags & SF_MOV_USE ) {
if (spawnflags & SF_MOV_USE) {
touch = __NULL__;
gflags |= GF_USABLE;
} else {
@ -249,113 +249,112 @@ void CFuncDoor :: Respawn ( void )
m_iState = STATE_LOWERED;
m_vecPos1 = origin;
m_vecPos2 = ( m_vecPos1 + m_vecMoveDir * ( fabs( m_vecMoveDir * size ) - m_flLip ) );
m_vecPos2 = (m_vecPos1 + m_vecMoveDir * (fabs(m_vecMoveDir * size) - m_flLip));
if ( spawnflags & SF_MOV_OPEN ) {
setorigin( this, m_vecPos2 );
if (spawnflags & SF_MOV_OPEN) {
setorigin(this, m_vecPos2);
m_vecPos2 = m_vecPos1;
m_vecPos1 = origin;
}
}
void CFuncDoor :: CFuncDoor ( void )
void func_door :: SetMovementDirection (void)
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
case "speed":
m_flSpeed = stof( argv( i + 1 ) );
break;
case "lip":
m_flLip = stof( argv( i + 1 ) );
break;
case "movesnd":
m_iMoveSnd = stoi( argv( i + 1 ) );
break;
case "stopsnd":
m_iStopSnd = stoi( argv( i + 1 ) );
break;
case "delay":
m_flDelay = stof( argv( i + 1 ) );
break;
case "wait":
m_flWait = stof( argv( i + 1 ) );
break;
default:
break;
}
}
CFuncDoor::Precache();
CFuncDoor::SetMovementDirection();
CFuncDoor::Respawn();
CBaseTrigger::CBaseTrigger();
if ( m_strTargetName ) {
m_iLocked = TRUE;
}
}
void CFuncDoor :: SetMovementDirection ( void )
{
if ( angles == '0 -1 0' ) {
m_vecMoveDir = '0 0 1';
} else if ( angles == '0 -2 0' ) {
m_vecMoveDir = '0 0 -1';
if (angles == [0,-1,0]) {
m_vecMoveDir = [0,0,1];
} else if (angles == [0,-2,0]) {
m_vecMoveDir = [0,0,-1];
} else {
makevectors( angles );
makevectors(angles);
m_vecMoveDir = v_forward;
}
angles = '0 0 0';
angles = [0,0,0];
}
void CFuncDoor :: MoveToDestination_End ( void )
void func_door :: MoveToDestination_End (void)
{
setorigin( this, m_vecDest );
velocity = '0 0 0';
setorigin(this, m_vecDest);
velocity = [0,0,0];
nextthink = -1;
m_pMove();
}
void CFuncDoor :: MoveToDestination ( vector vDestination, void() func )
void func_door :: MoveToDestination (vector vDestination, void() func)
{
vector vecDifference;
float flTravel, fTravelTime;
float flTravel;
float fTravelTime;
if ( !m_flSpeed ) {
objerror( "No speed defined for moving entity! Will not divide by zero." );
if (!m_flSpeed) {
objerror("No speed defined for moving entity! Will not divide by zero.");
}
m_pMove = func;
m_vecDest = vDestination;
think = MoveToDestination_End;
if ( vDestination == origin ) {
if (vDestination == origin) {
velocity = '0 0 0';
nextthink = ( ltime + 0.1 );
nextthink = (ltime + 0.1);
return;
}
vecDifference = ( vDestination - origin );
flTravel = vlen( vecDifference );
fTravelTime = ( flTravel / m_flSpeed );
vecDifference = (vDestination - origin);
flTravel = vlen(vecDifference);
fTravelTime = (flTravel / m_flSpeed);
if ( fTravelTime < 0.1 ) {
if (fTravelTime < 0.1) {
velocity = '0 0 0';
nextthink = ltime + 0.1;
return;
}
nextthink = ( ltime + fTravelTime );
velocity = ( vecDifference * ( 1 / fTravelTime ) );
nextthink = (ltime + fTravelTime);
velocity = (vecDifference * (1 / fTravelTime));
}
CLASSEXPORT( func_door, CFuncDoor )
void func_water ( void )
void func_door :: func_door (void)
{
spawnfunc_CFuncDoor();
self.classname = "CFuncWater";
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "speed":
m_flSpeed = stof(argv(i + 1));
break;
case "lip":
m_flLip = stof(argv(i + 1));
break;
case "movesnd":
m_iMoveSnd = stoi(argv(i + 1));
break;
case "stopsnd":
m_iStopSnd = stoi(argv(i + 1));
break;
case "delay":
m_flDelay = stof(argv(i + 1));
break;
case "wait":
m_flWait = stof(argv(i + 1));
break;
default:
break;
}
}
func_door::Precache();
func_door::SetMovementDirection();
func_door::Respawn();
CBaseTrigger::CBaseTrigger();
if (m_strTargetName) {
m_iLocked = TRUE;
}
}
void func_water(void)
{
spawnfunc_func_door();
self.classname = "func_water";
self.solid = SOLID_BSP;
self.skin = CONTENT_WATER;
}

View file

@ -18,7 +18,7 @@
#define SF_DOOR_NOMONSTERS 512
#define SF_DOOR_SILENT 0x80000000i
class CDoorRotating : CBaseTrigger
class func_door_rotating:CBaseTrigger
{
int m_iMoveSnd;
int m_iStopSnd;
@ -36,7 +36,7 @@ class CDoorRotating : CBaseTrigger
vector m_vecMoveDir;
virtual void() m_pMove = 0;
void() CDoorRotating;
void() func_door_rotating;
virtual void() Precache;
virtual void() Arrived;
virtual void() Returned;
@ -51,7 +51,7 @@ class CDoorRotating : CBaseTrigger
virtual void() RotateToDestination_End;
};
void CDoorRotating :: Precache ( void )
void func_door_rotating::Precache(void)
{
if ( m_iMoveSnd > 0 && m_iMoveSnd <= 10 ) {
precache_sound( sprintf( "doors/doormove%i.wav", m_iMoveSnd ) );
@ -66,7 +66,7 @@ void CDoorRotating :: Precache ( void )
}
}
void CDoorRotating :: Arrived ( void )
void func_door_rotating::Arrived(void)
{
m_iState = STATE_RAISED;
@ -87,7 +87,7 @@ void CDoorRotating :: Arrived ( void )
nextthink = ( ltime + m_flWait );
}
void CDoorRotating :: Returned ( void )
void func_door_rotating::Returned(void)
{
if ( !(spawnflags & SF_ROT_USE) ) {
touch = Touch;
@ -96,7 +96,7 @@ void CDoorRotating :: Returned ( void )
m_iState = STATE_LOWERED;
}
void CDoorRotating :: RotateBack ( void )
void func_door_rotating::RotateBack(void)
{
if ( m_iMoveSnd > 0 && m_iMoveSnd <= 10 ) {
sound( this, CHAN_VOICE, sprintf( "doors/doormove%i.wav", m_iMoveSnd ), 1.0, ATTN_NORM );
@ -112,7 +112,7 @@ void CDoorRotating :: RotateBack ( void )
RotateToDestination( m_vecPos1, Returned );
}
void CDoorRotating :: RotateAway ( void )
void func_door_rotating::RotateAway(void)
{
float fDirection = 1.0;
@ -148,7 +148,7 @@ void CDoorRotating :: RotateAway ( void )
RotateToDestination( m_vecPos2 * fDirection, Arrived );
}
void CDoorRotating :: Trigger ( void )
void func_door_rotating::Trigger(void)
{
if ( m_flNextAction > time ) {
return;
@ -164,24 +164,24 @@ void CDoorRotating :: Trigger ( void )
if ( m_flDelay ) {
#ifdef GS_DEVELOPER
print( sprintf( "CDoorRotating: Delayed trigger of `%s`\n", m_strTarget ) );
print( sprintf( "func_door_rotating: Delayed trigger of `%s`\n", m_strTarget ) );
#endif
CBaseTrigger::UseTargets_Delay( m_flDelay );
} else {
#ifdef GS_DEVELOPER
print( sprintf( "CDoorRotating: Normal trigger of `%s`\n", m_strTarget ) );
print( sprintf( "func_door_rotating: Normal trigger of `%s`\n", m_strTarget ) );
#endif
CBaseTrigger::UseTargets();
}
}
void CDoorRotating :: PlayerUse ( void )
void func_door_rotating::PlayerUse(void)
{
eActivator.gflags &= ~GF_USE_RELEASED;
Trigger();
}
void CDoorRotating :: Touch ( void )
void func_door_rotating::Touch(void)
{
if ( spawnflags & SF_ROT_USE ) {
return;
@ -196,10 +196,10 @@ void CDoorRotating :: Touch ( void )
touch = __NULL__;
}
void CDoorRotating :: Blocked ( void )
void func_door_rotating::Blocked(void)
{
if ( m_iDamage ) {
// Damage_Apply( other, this, m_iDamage, other.origin, FALSE );
Damage_Apply( other, this, m_iDamage, other.origin, FALSE );
}
if ( m_flWait >= 0 ) {
@ -211,7 +211,7 @@ void CDoorRotating :: Blocked ( void )
}
}
void CDoorRotating :: Respawn ( void )
void func_door_rotating::Respawn(void)
{
solid = SOLID_BSP;
movetype = MOVETYPE_PUSH;
@ -246,7 +246,7 @@ void CDoorRotating :: Respawn ( void )
}
}
void CDoorRotating :: SetMovementDirection ( void )
void func_door_rotating::SetMovementDirection(void)
{
if ( spawnflags & SF_ROT_ZAXIS ) {
m_vecMoveDir = '0 0 1';
@ -257,7 +257,7 @@ void CDoorRotating :: SetMovementDirection ( void )
}
}
void CDoorRotating :: RotateToDestination_End ( void )
void func_door_rotating::RotateToDestination_End(void)
{
angles = m_vecDest;
avelocity = '0 0 0';
@ -265,7 +265,7 @@ void CDoorRotating :: RotateToDestination_End ( void )
m_pMove();
}
void CDoorRotating :: RotateToDestination ( vector vDestinationAngle, void() func )
void func_door_rotating::RotateToDestination(vector vDestinationAngle, void() func)
{
vector vecAngleDifference;
float flTravelLength, flTravelTime;
@ -283,7 +283,7 @@ void CDoorRotating :: RotateToDestination ( vector vDestinationAngle, void() fun
nextthink = ( ltime + flTravelTime );
}
void CDoorRotating :: CDoorRotating ( void )
void func_door_rotating::func_door_rotating(void)
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -309,7 +309,7 @@ void CDoorRotating :: CDoorRotating ( void )
break;
}
}
if ( !m_flSpeed ) {
m_flSpeed = 100;
}
@ -322,10 +322,9 @@ void CDoorRotating :: CDoorRotating ( void )
if ( !m_flDistance ) {
m_flDistance = 90;
}
CDoorRotating::Precache();
CBaseEntity::CBaseEntity();
CDoorRotating::SetMovementDirection();
CDoorRotating::Respawn();
}
CLASSEXPORT( func_door_rotating, CDoorRotating )
func_door_rotating::Precache();
CBaseEntity::CBaseEntity();
func_door_rotating::SetMovementDirection();
func_door_rotating::Respawn();
}

View file

@ -6,15 +6,15 @@
*
****/
class CFuncHealthCharger:CBaseTrigger
class func_healthcharger:CBaseTrigger
{
float m_flDelay;
void() CFuncHealthCharger;
void() func_healthcharger;
virtual void() PlayerUse;
};
void CFuncHealthCharger::PlayerUse(void)
void func_healthcharger::PlayerUse(void)
{
eActivator.flags = (eActivator.flags - FL_USERELEASED);
@ -26,7 +26,7 @@ void CFuncHealthCharger::PlayerUse(void)
m_flDelay = time + 1.0f;
}
void CFuncHealthCharger::CFuncHealthCharger(void)
void func_healthcharger::func_healthcharger(void)
{
solid = SOLID_BSP;
movetype = MOVETYPE_PUSH;
@ -34,5 +34,3 @@ void CFuncHealthCharger::CFuncHealthCharger(void)
setmodel(this, model);
gflags = GF_USABLE;
}
CLASSEXPORT(func_healthcharger, CFuncHealthCharger)

View file

@ -6,24 +6,27 @@
*
****/
class CFuncIllusionary : CBaseEntity
class func_illusionary : CBaseEntity
{
virtual void() Use;
};
void CFuncIllusionary :: CFuncIllusionary ( void )
void func_illusionary :: func_illusionary ( void )
{
CBaseEntity::CBaseEntity();
precache_model( model );
//angles = '0 0 0';
movetype = MOVETYPE_PUSH;
self.solid = SOLID_NOT;
solid = SOLID_NOT;
setmodel( this, model );
CBaseEntity::CBaseEntity();
// FIXME: Add support for (skin) -1 = Empty, -7 = Volumetric light
if (skin < 0 ) {
skin = 0;
}
}
void CFuncIllusionary :: Use ( void )
void func_illusionary :: Use ( void )
{
skin = 1 - skin;
}
CLASSEXPORT( func_illusionary, CFuncIllusionary )

View file

@ -6,16 +6,22 @@
*
****/
class CFuncLadder : CBaseEntity {
void() CFuncLadder;
class func_ladder : CBaseEntity {
void() func_ladder;
};
void CFuncLadder :: CFuncLadder ( void )
void func_ladder :: func_ladder ( void )
{
setmodel( this, model );
movetype = MOVETYPE_NONE;
skin = CONTENT_LADDER;
solid = SOLID_BSP;
#ifdef GS_DEVELOPER
alpha = 0.5f;
effects = EF_ADDITIVE;
#else
effects = EF_NODRAW;
alpha = 0.0001f;
#endif
}
CLASSEXPORT( func_ladder, CFuncLadder )

View file

@ -6,15 +6,15 @@
*
****/
class CFuncSuitCharger:CBaseTrigger
class func_recharge:CBaseTrigger
{
float m_flDelay;
void() CFuncSuitCharger;
void() func_recharge;
virtual void() PlayerUse;
};
void CFuncSuitCharger::PlayerUse(void)
void func_recharge::PlayerUse(void)
{
eActivator.flags = (eActivator.flags - FL_USERELEASED);
@ -26,7 +26,7 @@ void CFuncSuitCharger::PlayerUse(void)
m_flDelay = time + 1.0f;
}
void CFuncSuitCharger::CFuncSuitCharger(void)
void func_recharge::func_recharge(void)
{
solid = SOLID_BSP;
movetype = MOVETYPE_PUSH;
@ -34,5 +34,3 @@ void CFuncSuitCharger::CFuncSuitCharger(void)
setmodel(this, model);
gflags = GF_USABLE;
}
CLASSEXPORT(func_recharge, CFuncSuitCharger)

View file

@ -6,13 +6,13 @@
*
****/
class CFuncWall : CBaseTrigger
class func_wall : CBaseTrigger
{
void() CFuncWall;
void() func_wall;
virtual void() Trigger;
};
void CFuncWall :: CFuncWall ( void )
void func_wall :: func_wall ( void )
{
precache_model( model );
//angles = '0 0 0';
@ -22,10 +22,9 @@ void CFuncWall :: CFuncWall ( void )
CBaseTrigger::CBaseTrigger();
}
void CFuncWall :: Trigger ( void )
void func_wall :: Trigger ( void )
{
frame = 1 - frame;
}
CLASSEXPORT( func_wall, CFuncWall )
CLASSEXPORT( func_train, CFuncWall )
CLASSEXPORT( func_train, func_wall )

View file

@ -0,0 +1,45 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
enumflags
{
FTW_STARTHIDDEN
};
class func_wall_toggle:CBaseTrigger
{
void() func_wall_toggle;
virtual void() Trigger;
};
void func_wall_toggle::func_wall_toggle(void)
{
precache_model(model);
//angles = '0 0 0';
movetype = MOVETYPE_PUSH;
solid = SOLID_BSP;
setmodel(this, model);
CBaseTrigger::CBaseTrigger();
if (spawnflags & FTW_STARTHIDDEN) {
Trigger();
}
}
void func_wall_toggle::Trigger(void)
{
if (solid == SOLID_BSP) {
solid = SOLID_NOT;
modelindex = 0;
model = "";
} else {
solid = SOLID_BSP;
model = m_oldModel;
setmodel(this, model);
}
}

View file

@ -6,4 +6,3 @@
*
****/

View file

@ -1,18 +0,0 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class CStartDM
{
void(void) CStartDM;
};
void CStartDM::CStartDM(void)
{
}
CLASSEXPORT( info_player_deathmatch, CStartDM )

View file

@ -1,15 +0,0 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class CStartOBS
{
};
CLASSEXPORT( info_player_spectator, CStartOBS )
CLASSEXPORT( info_player_spectate, CStartOBS )

View file

@ -1,18 +0,0 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class CStartSP
{
void(void) CStartSP;
};
void CStartSP::CStartSP(void)
{
}
CLASSEXPORT( info_player_start, CStartSP )

View file

@ -6,22 +6,22 @@
*
****/
class CItemFood
class item_food
{
int m_iIsCan;
void() CItemFood;
void() item_food;
virtual void() Setup;
virtual void() Touch;
};
void CItemFood :: Touch ( void )
void item_food :: Touch ( void )
{
if ( other.classname != "Player" ) {
return;
}
if ( owner != __NULL__ ) {
CEnvBeverage bevOwner = (CEnvBeverage)owner;
env_beverage bevOwner = (env_beverage)owner;
bevOwner.m_iReady = TRUE;
}
@ -29,7 +29,7 @@ void CItemFood :: Touch ( void )
remove( this );
}
void CItemFood :: Setup ( void )
void item_food :: Setup ( void )
{
solid = SOLID_TRIGGER;
setsize( this, '-8 -8 -8', '8 8 8' );
@ -40,7 +40,7 @@ void CItemFood :: Setup ( void )
}
}
void CItemFood :: CItemFood ( void )
void item_food :: item_food ( void )
{
// TODO: differentiate between item_sodacan and item_food
m_iIsCan = 1;
@ -57,5 +57,4 @@ void CItemFood :: CItemFood ( void )
nextthink = time + 1.0f;
}
CLASSEXPORT( item_sodacan, CItemFood )
CLASSEXPORT( item_food, CItemFood )
CLASSEXPORT( item_sodacan, item_food )

View file

@ -6,19 +6,19 @@
*
****/
class CItemSuit:CBaseTrigger
class item_suit:CBaseTrigger
{
void() CItemSuit;
void() item_suit;
virtual void() touch;
};
void CItemSuit::touch(void)
void item_suit::touch(void)
{
Trigger();
Hide();
}
void CItemSuit::CItemSuit(void)
void item_suit::item_suit(void)
{
CBaseTrigger::CBaseTrigger();
@ -26,5 +26,3 @@ void CItemSuit::CItemSuit(void)
setmodel( self, "models/w_kevlar.mdl");
InitPointTrigger();
}
CLASSEXPORT(item_suit, CItemSuit)

View file

@ -6,29 +6,29 @@
*
****/
class CLight : CBaseTrigger
class light : CBaseTrigger
{
string m_strPattern;
int m_iEnabled;
float m_flStyle;
void() CLight;
void() light;
virtual void() Trigger;
};
void CLight :: Trigger ( void )
void light :: Trigger ( void )
{
if ( m_iEnabled == TRUE ) {
//dprint( "CLight: Turned off!\n" );
//dprint( "light: Turned off!\n" );
lightstyle( m_flStyle, "a" );
m_iEnabled = FALSE;
} else {
//dprint( "CLight: Turned on!\n" );
//dprint( "light: Turned on!\n" );
lightstyle( m_flStyle, m_strPattern );
m_iEnabled = TRUE;
}
}
void CLight :: CLight ( void )
void light :: light ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -61,6 +61,6 @@ void CLight :: CLight ( void )
}
}
CLASSEXPORT( light, CLight )
CLASSEXPORT( light_spot, CLight )
CLASSEXPORT( light_spot, light )
CLASSEXPORT( light_environment, light )

View file

@ -18,13 +18,13 @@ enumflags
MF_FADECORPSE
};
class CMonsterFurniture : CBaseEntity
class monster_furniture : CBaseEntity
{
void() CMonsterFurniture;
void() monster_furniture;
//virtual void() Respawn;
};
void CMonsterFurniture :: CMonsterFurniture ( void )
void monster_furniture :: monster_furniture ( void )
{
precache_model( model );
setmodel( this, model );
@ -37,5 +37,3 @@ void CMonsterFurniture :: CMonsterFurniture ( void )
//self.modelflags = MF_ROTATE;
#endif
}
CLASSEXPORT( monster_furniture, CMonsterFurniture )

View file

@ -18,13 +18,13 @@ enumflags
MF_FADECORPSE
};
class CMonsterGeneric : CBaseEntity
class monster_generic : CBaseEntity
{
void() CMonsterGeneric;
void() monster_generic;
//virtual void() Respawn;
};
void CMonsterGeneric :: CMonsterGeneric ( void )
void monster_generic :: monster_generic ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -47,5 +47,3 @@ void CMonsterGeneric :: CMonsterGeneric ( void )
#endif
}
CLASSEXPORT( monster_generic, CMonsterGeneric )

View file

@ -6,14 +6,14 @@
*
****/
class CMultiManager : CBaseTrigger
class multi_manager : CBaseTrigger
{
string m_strBuffer;
int m_iBusy;
virtual void() Trigger;
};
void CMultiManager :: Trigger ( void )
void multi_manager :: Trigger ( void )
{
static void mm_enttrigger ( void ) {
spawnfunc_CBaseTrigger();
@ -21,7 +21,7 @@ void CMultiManager :: Trigger ( void )
wow.m_strTarget = wow.netname;
entity eFind = find( world, CBaseTrigger::m_strTargetName, self.netname );
//dprint( sprintf( "CMultiManager: %s (%s)\n", wow.m_strTarget, eFind.classname ) );
//dprint( sprintf( "multi_manager: %s (%s)\n", wow.m_strTarget, eFind.classname ) );
CBaseTrigger::UseTargets();
remove( wow );
@ -39,7 +39,7 @@ void CMultiManager :: Trigger ( void )
}
}
void CMultiManager :: CMultiManager ( void )
void multi_manager :: multi_manager ( void )
{
m_strBuffer = "";
int iFields = tokenize( __fullspawndata );
@ -67,5 +67,3 @@ void CMultiManager :: CMultiManager ( void )
CBaseTrigger::CBaseTrigger();
}
CLASSEXPORT( multi_manager, CMultiManager )

View file

@ -6,14 +6,14 @@
*
****/
class CMultiSource : CBaseTrigger
class multisource : CBaseTrigger
{
void() CMultiSource;
void() multisource;
virtual int() GetValue;
virtual void() Trigger;
};
int CMultiSource :: GetValue ( void )
int multisource :: GetValue ( void )
{
int iWillTrigger = TRUE;
@ -28,19 +28,17 @@ int CMultiSource :: GetValue ( void )
return iWillTrigger;
}
void CMultiSource :: Trigger ( void )
void multisource :: Trigger ( void )
{
if ( GetValue() == FALSE ) {
return;
}
//dprint( sprintf( "CMultiSource: Trigger of %s\n", m_strTarget ) );
//dprint( sprintf( "multisource: Trigger of %s\n", m_strTarget ) );
CBaseTrigger::UseTargets();
}
void CMultiSource :: CMultiSource ( void )
void multisource :: multisource ( void )
{
CBaseTrigger::CBaseTrigger();
}
CLASSEXPORT( multisource, CMultiSource )

View file

@ -6,30 +6,28 @@
*
****/
class CInfoNull
class info_null
{
void() CInfoNull;
void() info_null;
};
void CInfoNull :: CInfoNull ( void )
void info_null :: info_null ( void )
{
remove( self );
}
class CInfoNotNull
class info_notnull
{
void() CInfoNotNull;
void() info_notnull;
};
void CInfoNotNull :: CInfoNotNull ( void )
void info_notnull :: info_notnull ( void )
{
}
CLASSEXPORT( info_null, CInfoNull )
CLASSEXPORT( info_notnull, CInfoNotNull )
CLASSEXPORT( info_node, CInfoNotNull )
CLASSEXPORT( info_target, CInfoNotNull )
CLASSEXPORT( info_node, info_notnull )
CLASSEXPORT( info_target, info_notnull )
/*class CSuit : CBaseTrigger
{

View file

@ -6,15 +6,15 @@
*
****/
class CTriggerAuto : CBaseTrigger
class trigger_auto : CBaseTrigger
{
float m_flDelay;
void() CTriggerAuto;
void() trigger_auto;
virtual void() think;
};
void CTriggerAuto :: think ( void )
void trigger_auto :: think ( void )
{
// This is weird, because ents may not be spawned yet.
// However, Half-Life doesn't care about this, either.
@ -26,7 +26,7 @@ void CTriggerAuto :: think ( void )
}
}
void CTriggerAuto :: CTriggerAuto ( void )
void trigger_auto :: trigger_auto ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -40,5 +40,3 @@ void CTriggerAuto :: CTriggerAuto ( void )
CBaseTrigger::CBaseTrigger();
nextthink = time + 0.2f;
}
CLASSEXPORT( trigger_auto, CTriggerAuto )

View file

@ -6,15 +6,15 @@
*
****/
class CTriggerCamera:CBaseTrigger
class trigger_camera:CBaseTrigger
{
float m_flWait;
void() CTriggerCamera;
void() trigger_camera;
virtual void() Trigger;
};
void CTriggerCamera::Trigger(void)
void trigger_camera::Trigger(void)
{
if (m_strTarget) {
entity e = find(world, CBaseTrigger::m_strTargetName, m_strTarget);
@ -26,7 +26,7 @@ void CTriggerCamera::Trigger(void)
Client_TriggerCamera(eActivator, origin, angles, m_flWait);
}
void CTriggerCamera::CTriggerCamera(void)
void trigger_camera::trigger_camera(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
@ -39,5 +39,3 @@ void CTriggerCamera::CTriggerCamera(void)
}
CBaseTrigger::CBaseTrigger();
}
CLASSEXPORT(trigger_camera, CTriggerCamera)

View file

@ -6,22 +6,22 @@
*
****/
class CTriggerCDAudio : CBaseTrigger
class trigger_cdaudio : CBaseTrigger
{
int m_iCDTrack;
void() CTriggerCDAudio;
void() trigger_cdaudio;
virtual void() Trigger;
};
void CTriggerCDAudio :: Trigger ( void )
void trigger_cdaudio :: Trigger ( void )
{
//dprint( sprintf( "CTriggerCDAudio: Now playing CD track %i", m_iCDTrack ) );
//dprint( sprintf( "trigger_cdaudio: Now playing CD track %i", m_iCDTrack ) );
WriteByte( MSG_ALL, 32 ); // aka SVC_CDTRACK
WriteByte( MSG_ALL, m_iCDTrack );
remove( this );
}
void CTriggerCDAudio :: CTriggerCDAudio ( void )
void trigger_cdaudio :: trigger_cdaudio ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -36,5 +36,3 @@ void CTriggerCDAudio :: CTriggerCDAudio ( void )
CBaseTrigger::InitBrushTrigger();
touch = Trigger;
}
CLASSEXPORT( trigger_cdaudio, CTriggerCDAudio )

View file

@ -8,25 +8,26 @@
vector g_landmarkpos;
enumflags {
enumflags
{
LC_NOINTERMISSION, // Unused?
LC_USEONLY
};
class CLevelChanger : CBaseTrigger
class trigger_changelevel : CBaseTrigger
{
string m_strMap;
string m_strLandmark;
float m_flChangeDelay;
entity m_activator;
void() CLevelChanger;
void() trigger_changelevel;
virtual void() Change;
virtual void() Trigger;
virtual int( entity, entity ) IsInside;
};
int CLevelChanger :: IsInside ( entity ePlayer, entity eVolume ) {
int trigger_changelevel :: IsInside ( entity ePlayer, entity eVolume ) {
if ( ePlayer.absmin[0] > eVolume.absmax[0] ||
ePlayer.absmin[1] > eVolume.absmax[1] ||
ePlayer.absmin[2] > eVolume.absmax[2] ||
@ -37,7 +38,7 @@ int CLevelChanger :: IsInside ( entity ePlayer, entity eVolume ) {
return TRUE;
}
void CLevelChanger :: Change ( void )
void trigger_changelevel :: Change ( void )
{
if ( m_strLandmark ) {
entity landmark = find( world, ::targetname, m_strLandmark );
@ -48,7 +49,7 @@ void CLevelChanger :: Change ( void )
}
}
void CLevelChanger :: Trigger ( void )
void trigger_changelevel :: Trigger ( void )
{
//entity eVolume;
@ -72,7 +73,7 @@ void CLevelChanger :: Trigger ( void )
}
}
void CLevelChanger :: CLevelChanger ( void )
void trigger_changelevel :: trigger_changelevel ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -98,8 +99,7 @@ void CLevelChanger :: CLevelChanger ( void )
CBaseTrigger::InitBrushTrigger();
}
CLASSEXPORT( info_landmark, CInfoNull )
CLASSEXPORT( trigger_changelevel, CLevelChanger )
CLASSEXPORT( info_landmark, info_notnull )
vector Landmark_GetSpot(void)
{

View file

@ -6,14 +6,12 @@
*
****/
class CTriggerEnd : CBaseTrigger
class trigger_endsection : CBaseTrigger
{
virtual void() Trigger;
}
void CTriggerEnd :: Trigger ( void )
void trigger_endsection :: Trigger ( void )
{
localcmd( "disconnect\n" );
}
CLASSEXPORT( trigger_endsection, CTriggerEnd )

View file

@ -12,15 +12,15 @@
#define SF_HURT_FIREONPLAYER 16 // Only call UseTarget functions when it's a player
#define SF_HURT_TOUCHPLAYER 32 // Only hurt players
class CTriggerHurt : CBaseTrigger
class trigger_hurt : CBaseTrigger
{
float m_flNextTrigger;
int m_iDamage;
float m_flDelay;
void() CTriggerHurt;
void() trigger_hurt;
};
void CTriggerHurt :: Trigger ( void )
void trigger_hurt :: Trigger ( void )
{
if ( solid == SOLID_NOT ) {
solid = SOLID_TRIGGER;
@ -29,7 +29,7 @@ void CTriggerHurt :: Trigger ( void )
}
}
void CTriggerHurt :: Touch ( void )
void trigger_hurt :: Touch ( void )
{
if ( m_flNextTrigger > ltime ) {
return;
@ -68,7 +68,7 @@ void CTriggerHurt :: Touch ( void )
m_flNextTrigger = ltime + 0.5;
}
void CTriggerHurt :: Respawn ( void )
void trigger_hurt :: Respawn ( void )
{
solid = SOLID_TRIGGER;
if ( spawnflags & SF_HURT_OFF ) {
@ -77,7 +77,7 @@ void CTriggerHurt :: Respawn ( void )
touch = Touch;
}
void CTriggerHurt :: CTriggerHurt ( void )
void trigger_hurt :: trigger_hurt ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -93,8 +93,6 @@ void CTriggerHurt :: CTriggerHurt ( void )
}
}
CBaseTrigger::InitBrushTrigger();
CTriggerHurt::Respawn();
trigger_hurt::Respawn();
CBaseEntity::CBaseEntity();
}
CLASSEXPORT( trigger_hurt, CTriggerHurt )

View file

@ -14,16 +14,16 @@ enumflags
TM_PUSHABLES
};
class CTriggerMultiple : CBaseTrigger
class trigger_multiple : CBaseTrigger
{
float m_flDelay;
float m_flWait;
void() CTriggerMultiple;
void() trigger_multiple;
virtual void() touch;
virtual void() Respawn;
};
void CTriggerMultiple :: touch ( void )
void trigger_multiple :: touch ( void )
{
if ( m_flDelay > 0 ) {
CBaseTrigger::UseTargets_Delay( m_flDelay );
@ -39,7 +39,7 @@ void CTriggerMultiple :: touch ( void )
#endif
}
void CTriggerMultiple :: Respawn ( void )
void trigger_multiple :: Respawn ( void )
{
solid = SOLID_TRIGGER;
#ifdef GS_DEVELOPER
@ -47,7 +47,7 @@ void CTriggerMultiple :: Respawn ( void )
#endif
}
void CTriggerMultiple :: CTriggerMultiple ( void )
void trigger_multiple :: trigger_multiple ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -61,9 +61,7 @@ void CTriggerMultiple :: CTriggerMultiple ( void )
break;
}
}
CTriggerMultiple::Respawn();
trigger_multiple::Respawn();
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
}
CLASSEXPORT( trigger_multiple, CTriggerMultiple )

View file

@ -14,18 +14,18 @@ enumflags
TO_PUSHABLES
};
class CTriggerOnce : CBaseTrigger
class trigger_once:CBaseTrigger
{
float m_flDelay;
void() CTriggerOnce;
void() trigger_once;
virtual void() touch;
virtual void() Respawn;
};
void CTriggerOnce :: touch ( void )
void trigger_once::touch(void)
{
if ( m_flDelay > 0 ) {
CBaseTrigger::UseTargets_Delay( m_flDelay );
CBaseTrigger::UseTargets_Delay(m_flDelay);
} else {
CBaseTrigger::UseTargets();
}
@ -35,7 +35,7 @@ void CTriggerOnce :: touch ( void )
#endif
}
void CTriggerOnce :: Respawn ( void )
void trigger_once::Respawn(void)
{
solid = SOLID_TRIGGER;
#ifdef GS_DEVELOPER
@ -43,7 +43,7 @@ void CTriggerOnce :: Respawn ( void )
#endif
}
void CTriggerOnce :: CTriggerOnce ( void )
void trigger_once::trigger_once(void)
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -54,9 +54,7 @@ void CTriggerOnce :: CTriggerOnce ( void )
break;
}
}
CTriggerOnce::Respawn();
trigger_once::Respawn();
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
}
CLASSEXPORT( trigger_once, CTriggerOnce )

View file

@ -10,19 +10,19 @@
#define TP_STARTOFF 2
#define TP_AAAA 4
class CTriggerPush : CBaseTrigger
class trigger_push : CBaseTrigger
{
vector m_vecMoveDir;
float m_flDelay;
float m_flSpeed;
void() CTriggerPush;
void() trigger_push;
virtual void() touch;
virtual void() Respawn;
virtual void() Trigger;
virtual void() SetMovementDirection;
};
void CTriggerPush :: SetMovementDirection ( void )
void trigger_push :: SetMovementDirection ( void )
{
if ( angles == '0 -1 0' ) {
m_vecMoveDir = '0 0 1';
@ -37,7 +37,7 @@ void CTriggerPush :: SetMovementDirection ( void )
//m_vecMoveDir *= 1;
}
void CTriggerPush :: Trigger ( void )
void trigger_push :: Trigger ( void )
{
if ( solid == SOLID_NOT ) {
solid = SOLID_TRIGGER;
@ -46,7 +46,7 @@ void CTriggerPush :: Trigger ( void )
}
}
void CTriggerPush :: touch ( void )
void trigger_push :: touch ( void )
{
switch( other.movetype )
{
@ -75,7 +75,7 @@ void CTriggerPush :: touch ( void )
}
}
void CTriggerPush :: Respawn ( void )
void trigger_push :: Respawn ( void )
{
if ( angles == '0 0 0' ) {
angles[1] = 360;
@ -91,7 +91,7 @@ void CTriggerPush :: Respawn ( void )
}
}
void CTriggerPush :: CTriggerPush ( void )
void trigger_push :: trigger_push ( void )
{
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
switch ( argv( i ) ) {
@ -105,7 +105,5 @@ void CTriggerPush :: CTriggerPush ( void )
CBaseTrigger::CBaseTrigger();
CBaseTrigger::InitBrushTrigger();
CTriggerPush::Respawn();
trigger_push::Respawn();
}
CLASSEXPORT( trigger_push, CTriggerPush )

View file

@ -6,4 +6,4 @@
*
****/
CLASSEXPORT( trigger_relay, CTriggerOnce )
CLASSEXPORT( trigger_relay, trigger_once )

View file

@ -6,13 +6,13 @@
*
****/
class CTriggerTeleport : CBaseTrigger
class trigger_teleport : CBaseTrigger
{
void() CTriggerTeleport;
void() trigger_teleport;
virtual void() touch;
};
void CTriggerTeleport :: touch ( void )
void trigger_teleport :: touch ( void )
{
if ( other.health > 0 || other.solid == SOLID_SLIDEBOX ) {
entity eTarget = find( world, ::targetname, target );
@ -20,11 +20,10 @@ void CTriggerTeleport :: touch ( void )
}
}
void CTriggerTeleport :: CTriggerTeleport ( void )
void trigger_teleport :: trigger_teleport ( void )
{
CBaseTrigger::CBaseTrigger();
CBaseTrigger::InitBrushTrigger();
}
CLASSEXPORT( trigger_teleport, CTriggerTeleport )
CLASSEXPORT( info_teleport_destination, CInfoNull )
CLASSEXPORT( info_teleport_destination, info_notnull )

View file

@ -6,12 +6,12 @@
*
****/
class CTriggerVolume
class trigger_transition
{
void() CTriggerVolume;
void() trigger_transition;
};
void CTriggerVolume :: CTriggerVolume ( void )
void trigger_transition :: trigger_transition ( void )
{
solid = SOLID_NOT;
movetype = MOVETYPE_NONE;
@ -20,4 +20,4 @@ void CTriggerVolume :: CTriggerVolume ( void )
modelindex = 0;
}
CLASSEXPORT( trigger_transition, CTriggerVolume )
CLASSEXPORT( trigger_transition, trigger_transition )

Binary file not shown.

Binary file not shown.

Binary file not shown.