buymenu render and input separation, misc cleanup
This commit is contained in:
parent
d546812954
commit
11c9179b57
25 changed files with 457 additions and 509 deletions
|
@ -46,16 +46,6 @@ struct
|
|||
void
|
||||
Camera_RunBob(__inout vector camera_angle)
|
||||
{
|
||||
|
||||
//TAGGG - NEW. TS viewbob also shifts the player camera up/down a tiny bit.
|
||||
// We'll do that here, why not.
|
||||
// AND IMPORTANT - used to refer to vPlayerOrigin here,
|
||||
// now using vPlayerOrigin.
|
||||
// See if anywhere else called here neds to do that!
|
||||
// namely View_DetermineBobOffset.
|
||||
|
||||
//setproperty(VF_ORIGIN, pSeat->vPlayerOrigin + pl.view_ofs + pViewBob->m_vCam);
|
||||
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
|
||||
makevectors(view_angles);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "particles.h"
|
||||
|
||||
|
||||
//TAGGG - VERY LITTLE USES "hud_color" RIGHT NOW!
|
||||
// VERY LITTLE USES "hud_color" RIGHT NOW!
|
||||
// See inventory_logic_draw.qc for places that benefit from involving it, compare to behavior
|
||||
// in original TS to see what it affects.
|
||||
vector g_hud_color;
|
||||
|
@ -35,10 +35,11 @@ vector vHUDColor; // Defined in HUD_Draw (HUD.c)
|
|||
vector vVGUIColor; // Defined in HUD_Draw (VGUI.c)
|
||||
vector vCrossColor; // Defined in HUD_Draw (HUDCrosshair.c)
|
||||
|
||||
//TAGGG INCLUSION - new. Global var to store the current screen size. If it changes, the font should be re-loaded to fit it.
|
||||
var vector Recorded_video_res;
|
||||
// Global var to store the current screen size. If it changes, the font should be re-loaded to fit it.
|
||||
var vector g_videoResPrev;
|
||||
|
||||
//TAGGG - INCLUSION. eplaces several cases of FONT_CON to be able to draw larger text (well).
|
||||
|
||||
// Replaces several cases of FONT_CON to be able to draw larger text (well).
|
||||
var float FONT_ARIAL;
|
||||
var float FONT_ARIAL_TITLE;
|
||||
var float FONT_ARIAL_STD; //stands for "standard" ya hooligans.
|
||||
|
@ -73,29 +74,24 @@ const vector clrRed = [255.0f/255.0f, 0f/255.0f, 0f/255.0f];
|
|||
const vector clrLaserHUDDot = [255.0f/255.0f, 35.0f/255.0f, 35.0f/255.0f];
|
||||
|
||||
|
||||
// !!!
|
||||
// g_seatslocal AND pSeatLocal definition moved to seatlocal.h
|
||||
|
||||
void HUD_WeaponPickupNotify(int);
|
||||
|
||||
|
||||
// CRITICAL:
|
||||
// Should these be per pSeat instead? Unsure if that makes sense.
|
||||
var float TS_keyRefTapped = 0;
|
||||
var float TS_keyRefUp = 0;
|
||||
var float TS_keyRefUpASCII = 0;
|
||||
var float TS_keyRefDown = 0;
|
||||
var float TS_mouseClickRef = 0;
|
||||
|
||||
|
||||
|
||||
//TAGGG - NEW.
|
||||
// NEW.
|
||||
// The "fov" CVar is set to this at startup. This must be changed to be persistent
|
||||
// bewteen games.
|
||||
var float autocvar_fov_default = 80.0f;
|
||||
|
||||
//TAGGG - TODO. Is this even used yet?
|
||||
var int autocvar_cl_autoweaponswitch = TRUE;
|
||||
// TODO. Is this even used yet?
|
||||
var int autocvar_sv_autoweaponswitch = TRUE;
|
||||
|
||||
// Very situational, not all debug printouts, nowhere near.
|
||||
var float autocvar_cl_printoutspam = 0;
|
||||
|
||||
|
||||
void HUD_WeaponPickupNotify(int);
|
||||
|
||||
// !!!
|
||||
// g_seatslocal AND pSeatLocal definition moved to seatlocal.h
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ HUD_Draw(void)
|
|||
pSeat->m_iHUDWeaponSelected = (pl.weaponSelectHighlightID != -1);
|
||||
|
||||
|
||||
TS_keyRefTapped = 0; //reset.
|
||||
pSeatLocal->m_inputKeyTapped = 0; //reset.
|
||||
|
||||
HUD_DrawNotify();
|
||||
// Nuclide provided method, draws the HL pain arrows
|
||||
|
|
|
@ -104,7 +104,6 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
|
|||
// using the new VGUI approach.
|
||||
// That also includes mentions of fonts in ts/src/client/vgui.qc
|
||||
|
||||
//TAGGG - INCLUSION.
|
||||
// Also see ts/src/client/vgui.qc where CSQC_VGUI_Draw checks to see if the screen
|
||||
// size has been changed or this is the first time drawing (some FONTs having ID -1).
|
||||
// In either case, they're loaded and sized per screen height over there.
|
||||
|
|
|
@ -34,6 +34,12 @@ struct
|
|||
// Keeping for now, remove later
|
||||
float fVGUI_Display;
|
||||
|
||||
// CRITICAL:
|
||||
// Should these be per pSeat instead? Unsure if that makes sense.
|
||||
float m_inputKeyTapped;
|
||||
float m_inputKeyDown;
|
||||
float m_inputMouseClicked;
|
||||
|
||||
// like pSeat->ePlayer, but already casted to the gamemod's custom "player" class.
|
||||
// WARNING: Not yet set, find some place around the start of each frame where it
|
||||
// makes sense to set this.
|
||||
|
|
|
@ -8,5 +8,9 @@ pSeatLocal_init(void)
|
|||
pSeatLocal->m_flPrevVGUI = VGUI_SCREEN::NONE;
|
||||
pSeatLocal->m_bNeedPrimaryRelease = FALSE;
|
||||
pSeatLocal->m_flReleaseTime = 0;
|
||||
|
||||
pSeatLocal->m_inputKeyTapped = 0;
|
||||
pSeatLocal->m_inputKeyDown = 0;
|
||||
pSeatLocal->m_inputMouseClicked = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@ CUIEventGrabber::Draw(void)
|
|||
// nothing!
|
||||
}
|
||||
|
||||
//TODO: globals from src/client/defs.h over here now (like TS_mouseClickRef, etc.)
|
||||
|
||||
void BuySideMenu_onInputEvent(void);
|
||||
extern var BOOL VGUI_BuySideMenu_InitDone;
|
||||
|
||||
void
|
||||
CUIEventGrabber::Input(float flEVType, float flKey, float flChar, float flDevID)
|
||||
|
@ -38,27 +40,26 @@ CUIEventGrabber::Input(float flEVType, float flKey, float flChar, float flDevID)
|
|||
switch (flEVType) {
|
||||
|
||||
case IE_KEYDOWN:
|
||||
//printf("CUIEventGrabber::Input %d\n", flKey);
|
||||
printf("CUIEventGrabber::Input %d time:%.2f\n", flKey, time);
|
||||
if (flKey == K_MOUSE1) {
|
||||
TS_mouseClickRef = 1;
|
||||
} else {
|
||||
TS_keyRefDown = 1;
|
||||
pSeatLocal->m_inputMouseClicked = TRUE;
|
||||
}
|
||||
TS_keyRefUp = flKey;
|
||||
TS_keyRefTapped = flKey; //lasts only this frame
|
||||
TS_keyRefUpASCII = flChar;
|
||||
pSeatLocal->m_inputKeyDown = flKey;
|
||||
pSeatLocal->m_inputKeyTapped = flKey; //lasts only this frame
|
||||
break;
|
||||
case IE_KEYUP:
|
||||
if (flKey == K_MOUSE1) {
|
||||
TS_mouseClickRef = 0;
|
||||
} else {
|
||||
TS_keyRefDown = 0;
|
||||
pSeatLocal->m_inputMouseClicked = FALSE;
|
||||
}
|
||||
TS_keyRefUp = 0;
|
||||
TS_keyRefUpASCII = 0;
|
||||
pSeatLocal->m_inputKeyDown = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(pSeatLocal->fVGUI_Display == BUYSIDEMENU){
|
||||
BuySideMenu_onInputEvent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Could include this a lot earlier, but no point as it's useless without being
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#ifndef TS_CLIENT_UTIL_H
|
||||
#define TS_CLIENT_UTIL_H
|
||||
|
||||
|
||||
#define BITS_DIGITOPT_NONE 0
|
||||
|
@ -100,10 +98,6 @@ typedef struct{
|
|||
|
||||
|
||||
|
||||
|
||||
//easy ref.
|
||||
extern const vector vecZero;
|
||||
|
||||
int drawSpriteNumber(imageCropBounds_t* arg_ary_spriteSet, int arg_draw_x, int arg_draw_y, int arg_quantityToDraw, int arg_digits, int arg_bits, vector arg_clr, float arg_opac);
|
||||
void Gfx_Text(vector vPos, string sText, vector vSize, vector vRGB, float flAlpha, float flDrawFlag, float flFont);
|
||||
void Gfx_TextLineWrap( vector vPos, vector vSize, float fAlignFlags, string sText, float flFont );
|
||||
|
@ -111,4 +105,3 @@ void Gfx_RotScalePic( string sImage, vector arg_vDrawPos, vector arg_vDrawPivot,
|
|||
void Gfx_ScalePicPreserveBounds(string sImage, vector arg_vDrawPos, vector vSize, vector vScale, vector vInset, vector vRGB, float flOpac);
|
||||
|
||||
|
||||
#endif // TS_CLIENT_UTIL_H
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
|
||||
|
||||
|
||||
//err. what?
|
||||
//Then how do I supply a list of things to draw from?
|
||||
//use another struct that itself has the array? well ok.
|
||||
// OR make it a pointer and assume its length (or send it separately if needed... in this case
|
||||
// we know it has to have 10 images: 1 for each of the digits, 0 - 9)
|
||||
//../ts/client/vgui_buysidemenu.c:1745: error: Array arguments are not supported
|
||||
// TODO - make this a more general utility for any UI, not just the inventory-related stuff.
|
||||
//Now supports returning the number of pixels of width of the string it drew for nearby UI to see too.
|
||||
// Use a set of sprites representing digits to draw a number.
|
||||
// Has bits for other options like handling drawing leading 0's
|
||||
// (like if 16 is drawn with 3 digits expected: 016).
|
||||
int
|
||||
drawSpriteNumber(imageCropBounds_t* arg_ary_spriteSet, int arg_draw_x, int arg_draw_y, int arg_quantityToDraw, int arg_digits, int arg_bits, vector arg_clr, float arg_opac){
|
||||
|
||||
//The "arg_bits" can give extra options about drawing. "0" means straight defaults.
|
||||
//NONE SUPPORTED YET. If so, give enum like
|
||||
drawSpriteNumber(
|
||||
imageCropBounds_t* arg_ary_spriteSet, int arg_draw_x, int arg_draw_y,
|
||||
int arg_quantityToDraw, int arg_digits, int arg_bits, vector arg_clr, float arg_opac
|
||||
)
|
||||
{
|
||||
// The "arg_bits" can give extra options about drawing. "0" means straight defaults.
|
||||
// NONE SUPPORTED YET. If so, give enum like
|
||||
|
||||
//currently looking at leading 0's (whether they are drawn or not). The first non-zero digit stops this.
|
||||
BOOLEAN leadingZeros = TRUE;
|
||||
BOOL leadingZeros = TRUE;
|
||||
|
||||
int spriteWidth = arg_ary_spriteSet[0].vSize.x;
|
||||
int sprigeHeight = arg_ary_spriteSet[0].vSize.y;
|
||||
|
@ -26,9 +23,9 @@ drawSpriteNumber(imageCropBounds_t* arg_ary_spriteSet, int arg_draw_x, int arg_d
|
|||
int maxPossible = pow(10, arg_digits) - 1; //...9999, 999, 99, 9
|
||||
|
||||
if(quantityYet < 0){
|
||||
//negatives not allowed, no need seen yet.
|
||||
//To support negatives, we could draw a negative sign left of the highest digit place possible or
|
||||
//of the drawn digit (subjective) and force "quantityYet" positive to draw it as expected.
|
||||
// negatives not allowed, no need seen yet.
|
||||
// To support negatives, we could draw a negative sign left of the highest digit place possible or
|
||||
// of the drawn digit (subjective) and force "quantityYet" positive to draw it as expected.
|
||||
quantityYet = 0;
|
||||
}else if(quantityYet > maxPossible){
|
||||
// force it to the max, that's all we can display
|
||||
|
@ -92,9 +89,9 @@ drawSpriteNumber(imageCropBounds_t* arg_ary_spriteSet, int arg_draw_x, int arg_d
|
|||
}
|
||||
|
||||
}else{
|
||||
//First non-zero digit makes leadingZeros FALSE for the first time.
|
||||
//Also, the very first digit must be drawn unconditionally. Even if 0.
|
||||
//All digits after this will be drawn.
|
||||
// First non-zero digit makes leadingZeros FALSE for the first time.
|
||||
// Also, the very first digit must be drawn unconditionally. Even if 0.
|
||||
// All digits after this will be drawn.
|
||||
leadingZeros = FALSE;
|
||||
//draw digitAtPlace.
|
||||
DRAW_IMAGE_CROPPED_ADDITIVE(arg_ary_spriteSet[digitAtPlace], vDrawPosYet, arg_clr, arg_opac)
|
||||
|
@ -107,14 +104,11 @@ drawSpriteNumber(imageCropBounds_t* arg_ary_spriteSet, int arg_draw_x, int arg_d
|
|||
//Not functional, but "quantityYet" should end up as "0" all the time.
|
||||
|
||||
return totalDrawWidth;
|
||||
}//END OF drawSpriteNumber
|
||||
}// drawSpriteNumber
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//TAGGG - BOTH NEW. Convenience methods for drawing without any font-related struct, just some font's load ID.
|
||||
// Convenience methods for drawing without any font-related struct, just some font's load ID.
|
||||
// Otherwise close to the engine-provided drawstring and drawtextfield methods.
|
||||
// "drawfont" is a global provided by the engine (fteextensions.qc)
|
||||
// Compare with vgui/font.cpp's "Font_DrawText" and "Font_DrawField" which take a font struct.
|
||||
|
@ -133,7 +127,7 @@ Gfx_TextLineWrap( vector vPos, vector vSize, float fAlignFlags, string sText, fl
|
|||
}
|
||||
|
||||
|
||||
//TAGGG - "Gfx_RotScalePic" was made from a blend of methods found in The Wastes.
|
||||
// Made from a blend of methods found in The Wastes.
|
||||
void
|
||||
Gfx_RotScalePic( string sImage, vector arg_vDrawPos, vector arg_vDrawPivot, vector vSize, float flAngle, vector vScale, vector vRGB, float flOpac )
|
||||
{
|
||||
|
@ -155,13 +149,9 @@ Gfx_RotScalePic( string sImage, vector arg_vDrawPos, vector arg_vDrawPivot, vect
|
|||
//Gfx_Pic( vPos + vScalePos, sImage, vScaleSize, vRGB, flAlpha, 0 );
|
||||
drawrotpic(arg_vDrawPos + [arg_vDrawPivot[0]*vScale[0], arg_vDrawPivot[1]*vScale[1]], mins, maxs, sImage, vRGB, flOpac, flAngle);
|
||||
// (time * 40) % 360
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
Gfx_ScalePicPreserveBounds(string sImage, vector arg_vDrawPos, vector vSize, vector vScale, vector vInset, vector vRGB, float flOpac)
|
||||
{
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
#define VGUI_WINDOW_BGALPHA 0.76
|
||||
#define VGUI_WINDOW_FGALPHA 1.0
|
||||
|
||||
//var int iVGUIKey;
|
||||
|
||||
vector vVGUIWindowPos;
|
||||
vector vVGUIWindowSiz;
|
||||
//vector vVGUIButtonPos;
|
||||
|
||||
string sMOTDString[25];
|
||||
string sMapString[35];
|
||||
|
|
|
@ -114,12 +114,12 @@ CSQC_VGUI_Draw( player arg_player)
|
|||
}//END OF screen height check
|
||||
|
||||
//
|
||||
if(FONT_ARIAL == -1 || Recorded_video_res != video_res){
|
||||
if(FONT_ARIAL == -1 || g_videoResPrev != video_res){
|
||||
//Give it a font based on this screen size.
|
||||
|
||||
//Recorded_video_res = video_res;
|
||||
Recorded_video_res[0] = video_res[0];
|
||||
Recorded_video_res[1] = video_res[1];
|
||||
//g_videoResPrev = video_res;
|
||||
g_videoResPrev[0] = video_res[0];
|
||||
g_videoResPrev[1] = video_res[1];
|
||||
|
||||
//FONT_ARIAL = loadfont( "label", "arial", "32", -1 );
|
||||
float font_arial_size = (fontSizeMulti * 24);
|
||||
|
@ -131,14 +131,14 @@ CSQC_VGUI_Draw( player arg_player)
|
|||
FONT_ARIAL = loadfont( "game", "arial", str_font_arial_size, -1 );
|
||||
FONT_ARIAL_TITLE = loadfont( "game", "arial", str_font_arial_title_size, -1 );
|
||||
|
||||
//print( sprintf("CHANGE height:%i fontm:%.2f fontref:%i match:(%i, %i) totalmatch:%i\n", (int)video_res[1], fontSizeMulti, (int)FONT_ARIAL, (int)(Recorded_video_res[0]==video_res[0]), (int)(Recorded_video_res[1]==video_res[1]), (int)(Recorded_video_res==video_res)) );
|
||||
//print( sprintf("CHANGE height:%i fontm:%.2f fontref:%i match:(%i, %i) totalmatch:%i\n", (int)video_res[1], fontSizeMulti, (int)FONT_ARIAL, (int)(g_videoResPrev[0]==video_res[0]), (int)(g_videoResPrev[1]==video_res[1]), (int)(g_videoResPrev==video_res)) );
|
||||
}
|
||||
|
||||
//little demo.
|
||||
/*
|
||||
if(nextPrintoutTime == -1 || (time >= nextPrintoutTime) ){
|
||||
nextPrintoutTime = time + 2;
|
||||
print( sprintf("timed printout. height:%i fontm:%.2f fontref:%i match:(%i, %i) totalmatch:%i\n", (int)video_res[1], fontSizeMulti, (int)FONT_ARIAL, (int)(Recorded_video_res[0]==video_res[0]), (int)(Recorded_video_res[1]==video_res[1]), (int)(Recorded_video_res==video_res)) );
|
||||
print( sprintf("timed printout. height:%i fontm:%.2f fontref:%i match:(%i, %i) totalmatch:%i\n", (int)video_res[1], fontSizeMulti, (int)FONT_ARIAL, (int)(g_videoResPrev[0]==video_res[0]), (int)(g_videoResPrev[1]==video_res[1]), (int)(g_videoResPrev==video_res)) );
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -88,10 +88,10 @@ void VGUI_MessageOfTheDay(player arg_player, vector vPos, vector vWindowSiz, flo
|
|||
// So you have to invent your own wordwrap to get that?? Let's just skip that.
|
||||
Gfx_TextLineWrap( vTextPos, vWindowSiz - ('16 64 0' * 2) , DRAWTEXTFIELD_ALIGN_LEFT_TOP, tempText, FONT_ARIAL );
|
||||
|
||||
if(TS_keyRefDown && TS_keyRefTapped == 13){
|
||||
if(pSeatLocal->m_inputKeyTapped == 13){
|
||||
//pressing enter here works too.
|
||||
MessageOfTheDay_ButtonOK();
|
||||
TS_keyRefTapped = 0; //why do we have to do this, no clue
|
||||
pSeatLocal->m_inputKeyTapped = 0; //why do we have to do this, no clue
|
||||
}
|
||||
|
||||
VGUI_Button( _("VGUI_OK"), MessageOfTheDay_ButtonOK, [vPos.x + 16, vPos.y + vWindowSiz.y - 30 - 16, 0], '100 30 0' );
|
||||
|
|
|
@ -112,11 +112,6 @@ Draws a button, returns whether or not a mouse is hovering over it (for inherita
|
|||
float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSize) {
|
||||
vector vLabelPos;
|
||||
|
||||
/*
|
||||
if ( iVGUIKey < 57 ) {
|
||||
iVGUIKey++;
|
||||
}
|
||||
*/
|
||||
|
||||
drawfill( vPosition, [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
|
||||
drawfill( [vPosition[0], vPosition[1] + vSize[1] - 1], [vSize[0], 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
|
||||
|
@ -127,23 +122,14 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSi
|
|||
vLabelPos[0] = vPosition[0] + 16;
|
||||
vLabelPos[1] = vPosition[1] + ( ( vSize[1] / 2 ) - 4 );
|
||||
|
||||
/*
|
||||
//TAGGG REPLACEMENT - "pSeatLocal->fInputKeyCode" for "TS_keyRefUp".
|
||||
if ( ( iVGUIKey == TS_keyRefUp ) ) {
|
||||
vFunction();
|
||||
TS_keyRefUp = 0;
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if ( VGUI_CheckMouse( vPosition, vSize ) ) {
|
||||
//pSeatLocal->fVGUI_Display
|
||||
|
||||
if ( TS_mouseClickRef == TRUE ) {
|
||||
if (pSeatLocal->m_inputMouseClicked == TRUE) {
|
||||
vFunction();
|
||||
TS_mouseClickRef = FALSE;
|
||||
pSeatLocal->m_inputMouseClicked = FALSE;
|
||||
}
|
||||
|
||||
Gfx_Text( vLabelPos, sLabel, vButtonFontSize, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD );
|
||||
|
|
|
@ -25,6 +25,14 @@ var float autocvar_v_bobup = 0.5;
|
|||
// visibility. Remove from there on using the Valve file instead.
|
||||
|
||||
|
||||
//TAGGG - helper method.
|
||||
void setVCam(void){
|
||||
pViewBob->m_vCam[0] = 0;
|
||||
pViewBob->m_vCam[1] = 0;
|
||||
pViewBob->m_vCam[2] = pViewBob->m_flBob * 1.2 * sin(pViewBob->m_flBobCycle*2 + MATH_PI/2 );
|
||||
}
|
||||
|
||||
|
||||
/* bob vars are calculated separately from application, so that if there's
|
||||
* more than one viewmodel we won't affect the speed of the bob by running
|
||||
* the math too many times */
|
||||
|
@ -89,10 +97,6 @@ Viewmodel_CalcBob(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!bOnGround){
|
||||
float timeTol;
|
||||
vector vSource = pl.origin;
|
||||
|
@ -107,9 +111,7 @@ Viewmodel_CalcBob(void)
|
|||
timeTol = 0.17;
|
||||
}
|
||||
|
||||
|
||||
if((time-pl.flRecentGroundTime) > timeTol*(1/autocvar_movemodmulti) ){
|
||||
|
||||
float reducerMulti;
|
||||
|
||||
//if(inputLen <= 0.1){
|
||||
|
@ -123,6 +125,8 @@ Viewmodel_CalcBob(void)
|
|||
}else{
|
||||
pViewBob->m_flBob = 0;
|
||||
}
|
||||
// adjust this per new m_flBob and frozen BobCycle.
|
||||
setVCam();
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
|
@ -158,10 +162,7 @@ Viewmodel_CalcBob(void)
|
|||
// And the r_viewmodelscale from Valve. I think this is safe.
|
||||
pViewBob->m_flBob *= autocvar_r_viewmodelscale;
|
||||
|
||||
//////////////
|
||||
pViewBob->m_vCam[0] = 0;
|
||||
pViewBob->m_vCam[1] = 0;
|
||||
pViewBob->m_vCam[2] = pViewBob->m_flBob * 1.2 * sin(pViewBob->m_flBobCycle*2 + MATH_PI/2 );
|
||||
setVCam();
|
||||
}
|
||||
|
||||
//TAGGG - BobNEW. REPLACED.
|
||||
|
|
|
@ -59,6 +59,13 @@ var int g_ts_player_spectator; //do we even need this one?
|
|||
var int g_ts_player_all;
|
||||
|
||||
|
||||
|
||||
// Very situational, not all debug printouts, nowhere near.
|
||||
var float autocvar_sv_printoutspam = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
void initSpawnMem(void);
|
||||
|
||||
//TAGGG - restored?
|
||||
|
|
|
@ -12,9 +12,9 @@ void TSThrownProjectile::TSThrownProjectile(void){
|
|||
TSWorldGun::TSWorldGun();
|
||||
|
||||
startAngularVelocityDelay = -1;
|
||||
//vPreviousVelocity = vecZero;
|
||||
//vPreviousVelocity = g_vZero;
|
||||
forceBecomePickupableTime = -1;
|
||||
queuedVelocity = vecZero;
|
||||
queuedVelocity = g_vZero;
|
||||
queuedVelocityApplyTime = -1;
|
||||
switchToNormalPickupBoundsTime = -1;
|
||||
|
||||
|
|
|
@ -26,15 +26,13 @@
|
|||
|
||||
|
||||
//default if unspecified.
|
||||
//TODO - hook a bunch of this stuff up to console.
|
||||
// TODO - hook a bunch of this stuff up to console.
|
||||
|
||||
//Including a "changeteam" command if we implement teams.
|
||||
// Including a "changeteam" command if we implement teams.
|
||||
var TS_GameMode currentGameMode = TS_GameMode::DEATHMATCH;
|
||||
|
||||
|
||||
//TAGGG - INCLUSION - YOU BETTER NOT FORGET ABOUT THESE VARS.
|
||||
|
||||
//TAGGG TODO - there isn't one var / CVar to tell what gamemode this is? uhhh ok.
|
||||
// TODO - There isn't one var / CVar to tell what gamemode this is? uhhh ok.
|
||||
//until something deeper is made like a gamemode struct or CVar, this will have to do.
|
||||
|
||||
//defaults. The "81" max weight slots rule is from The Specialists as-is.
|
||||
|
@ -61,14 +59,14 @@ TSGameRules::PlayerDeath(base_player pp)
|
|||
void
|
||||
TSGameRules::PlayerPain(base_player pp)
|
||||
{
|
||||
//TAGGG - why was this using "self" instead of the "pp"? haha.. the pp.
|
||||
// Why was this using "self" instead of the "pp"? haha.. the pp.
|
||||
// Also this is completely new to FreeCS and probably FreeHL. ?
|
||||
sound(pp, CHAN_VOICE, sprintf("player/pain%i.wav", randomInRange_i(1, 3)), 1, ATTN_IDLE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//TAGGG - CRITICAL. Do any new player vars need to be copied too,
|
||||
// CRITICAL. Do any new player vars need to be copied too,
|
||||
// same for LevelChangeParams further down?
|
||||
void
|
||||
TSGameRules::LevelDecodeParms(base_player pp)
|
||||
|
@ -87,7 +85,7 @@ TSGameRules::LevelDecodeParms(base_player pp)
|
|||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
//TAGGG - why was this one missing from FreeHL? Present in FreeCS.
|
||||
// Why was this one missing from FreeHL? Present in FreeCS.
|
||||
pl.gflags = parm63;
|
||||
|
||||
/*
|
||||
|
@ -135,7 +133,7 @@ TSGameRules::LevelChangeParms(base_player pp)
|
|||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
|
||||
//TAGGG - why was this one missing from FreeHL? Present in FreeCS.
|
||||
// Why was this one missing from FreeHL? Present in FreeCS.
|
||||
parm63 = pl.gflags;
|
||||
|
||||
parm64 = pl.flags;
|
||||
|
@ -169,7 +167,7 @@ TSGameRules::LevelChangeParms(base_player pp)
|
|||
void
|
||||
TSGameRules::LevelNewParms(void)
|
||||
{
|
||||
//TAGGG - parm63 added, absent in FreeHL.
|
||||
// ! parm63 added, absent in FreeHL.
|
||||
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
|
||||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
|
||||
|
@ -183,11 +181,10 @@ TSGameRules::LevelNewParms(void)
|
|||
|
||||
|
||||
|
||||
//TAGGG - NEW. Need PlayerPreFrame as well.
|
||||
// NEW. Need PlayerPreFrame as well.
|
||||
void
|
||||
TSGameRules::PlayerPreFrame(base_player pp)
|
||||
{
|
||||
//TAGGG - NEW
|
||||
// Is this null check redundant?
|
||||
if(pp != NULL){
|
||||
player pl = (player)pp;
|
||||
|
@ -196,8 +193,6 @@ TSGameRules::PlayerPreFrame(base_player pp)
|
|||
|
||||
}
|
||||
|
||||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
TSGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
|
@ -250,7 +245,6 @@ TSGameRules::PlayerKill(base_player pl)
|
|||
|
||||
|
||||
|
||||
|
||||
void
|
||||
Money_AddMoney(player pl, int iMoneyValue)
|
||||
{
|
||||
|
|
|
@ -632,6 +632,7 @@ TSMultiplayerRules::RestartRound(int iWipe)
|
|||
*/
|
||||
//try this
|
||||
// !!!
|
||||
|
||||
// TAGGG - update2020. not yet! See if we even need to, probably but just be safe.
|
||||
// that is re-implement the old decal.c, info_decal edits.
|
||||
//Decals_Reset();
|
||||
|
|
|
@ -275,7 +275,7 @@ Game_Worldspawn(void)
|
|||
//pointerstat(STAT_WEIGHTSLOTS, EV_FLOAT, iTotalSlots);
|
||||
|
||||
|
||||
//TAGGG - INCLUSION. NEW.
|
||||
// NEW.
|
||||
pointerstat(STAT_RULE_MONEYALLOWED, EV_INTEGER, &bRule_MoneyAllowed);
|
||||
pointerstat(STAT_RULE_MAXWEIGHTSLOTS, EV_INTEGER, &iRule_MaxWeightSlots);
|
||||
|
||||
|
@ -283,7 +283,7 @@ Game_Worldspawn(void)
|
|||
localcmd(sprintf("serverinfo slots %d\n", cvar("sv_playerslots")));
|
||||
localcmd("teamplay 1\n");
|
||||
|
||||
//TAGGG - shouldn't these get explicit defaults?
|
||||
// Shouldn't these get explicit defaults?
|
||||
g_ts_gamestate = GAME_INACTIVE;
|
||||
g_ts_gametime = 0;
|
||||
|
||||
|
@ -294,19 +294,6 @@ Game_Worldspawn(void)
|
|||
initSpawnMem();
|
||||
|
||||
|
||||
//TAGGG - 2020update?
|
||||
/*
|
||||
// and what do these mean anyway? Search game files, maybe something tells what "buy.kevlar" means?
|
||||
// how to derive that to some sound file I assume?
|
||||
Sound_Precache("buy.kevlar");
|
||||
Sound_Precache("buy.weapon");
|
||||
Sound_Precache("buy.ammo");
|
||||
|
||||
Weapons_Init();
|
||||
|
||||
clientstat(STAT_MONEY, EV_INTEGER, player::money);
|
||||
*/
|
||||
|
||||
clientstat(STAT_MONEY, EV_INTEGER, player::money);
|
||||
pointerstat(STAT_GAMETIME, EV_FLOAT, &g_ts_gametime);
|
||||
pointerstat(STAT_GAMESTATE, EV_INTEGER, &g_ts_gamestate);
|
||||
|
|
|
@ -103,8 +103,7 @@ enum {
|
|||
STAT_WON_CT,
|
||||
*/
|
||||
|
||||
//TAGGG - NEW
|
||||
//TAGGG - INCLUSION. just to show up in searches, new stuff though
|
||||
// NEW.
|
||||
STAT_RULE_MONEYALLOWED,
|
||||
STAT_RULE_MAXWEIGHTSLOTS
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
|
||||
//TAGGG - INCLUSION. and new file.
|
||||
|
||||
//Try copying from _base/shared/effects.c. From the up to date repository or the old one, dunno.
|
||||
// New file.
|
||||
|
||||
// Try copying from _base/shared/effects.c. From the up to date repository
|
||||
// or the old one, dunno.
|
||||
// ...this comment has aged terribly.
|
||||
// No clue, these effects are due for a complete overhaul to better resemble
|
||||
// TS sometime anyway.
|
||||
|
||||
#ifdef SSQC
|
||||
void Effect_Explosion(vector vecOrigin )
|
||||
|
|
|
@ -756,7 +756,7 @@ void player::player(void){
|
|||
*/
|
||||
|
||||
|
||||
}//END OF player constructor
|
||||
}// player constructor
|
||||
|
||||
|
||||
// use TRUE for clean respawns,
|
||||
|
@ -1166,8 +1166,7 @@ player::callWeaponThink(void){
|
|||
|
||||
basicRef.vOnThink(this, dynaRef);
|
||||
|
||||
//self.v_angle += '-0.6 0.6 0.0';
|
||||
}//END OF weaponEquipped check
|
||||
}// weaponEquipped check
|
||||
}
|
||||
|
||||
|
||||
|
@ -1187,13 +1186,17 @@ player::callWeaponThink(void){
|
|||
void
|
||||
player::frameThink_fromServer(void){
|
||||
|
||||
if(autocvar_sv_printoutspam == 1){
|
||||
printfline("My state: %d", iState);
|
||||
}
|
||||
|
||||
if(fKarateStamina < 1.0){
|
||||
fKarateStamina = bound(0, fKarateStamina + frametime * 0.1667, 1);
|
||||
}
|
||||
|
||||
handleAccuracyKickback();
|
||||
|
||||
}//END OF frameThink_fromServer
|
||||
}// frameThink_fromServer
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1208,6 +1211,10 @@ void
|
|||
player::preThink(void){
|
||||
weapondynamic_t dynaRef;
|
||||
|
||||
if(autocvar_cl_printoutspam == 1){
|
||||
printfline("My state: %d", iState);
|
||||
}
|
||||
|
||||
|
||||
// Called before rendering, so this is an acceptable place.
|
||||
View_HandleZoom();
|
||||
|
@ -1270,8 +1277,8 @@ player::preThink(void){
|
|||
TS_Weapons_ViewAnimation(baseRef.iAnim_Idle_Index, 2 );
|
||||
}
|
||||
|
||||
}//END OF inventoryEquippedIndex
|
||||
}//END OF w_freeze_idle_next check
|
||||
}// inventoryEquippedIndex
|
||||
}// w_freeze_idle_next check
|
||||
|
||||
}//preThink
|
||||
|
||||
|
@ -1319,12 +1326,12 @@ player::preThink(void){
|
|||
|
||||
v_angle = View_approachAngleOffsetTarget(v_angle);
|
||||
|
||||
}//END OF preThink
|
||||
}// preThink
|
||||
|
||||
void
|
||||
player::postThink(void){
|
||||
|
||||
}//END OF postThink
|
||||
}// postThink
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1388,7 +1395,7 @@ player::attemptAddWeaponFromPickup(TSWorldGun arg_pickup){
|
|||
}
|
||||
|
||||
return FALSE; //don't delete.
|
||||
}//END OF attemptAddWeaponFromPickup
|
||||
}// attemptAddWeaponFromPickup
|
||||
|
||||
|
||||
// Drop this weapon (of that index). ID is kinda the improper term.
|
||||
|
@ -1602,7 +1609,7 @@ player::dropWeapon(int arg_weaponID, BOOLEAN completeDrop){
|
|||
|
||||
sound(this, CHAN_WEAPON, "weapons/weapondrop.wav", 1, ATTN_NORM );
|
||||
|
||||
}//END OF dropWeapon
|
||||
}// dropWeapon
|
||||
|
||||
|
||||
|
||||
|
@ -1617,7 +1624,7 @@ player::anyAmmoPoolNonEmpty(void){
|
|||
}
|
||||
//return anyNonEmpty;
|
||||
return FALSE; //made it this far? didn't have any.
|
||||
}//END OF anyAmmoPoolNonEmpty
|
||||
}// anyAmmoPoolNonEmpty
|
||||
|
||||
// oh.. I guess that's it.
|
||||
void
|
||||
|
@ -1625,7 +1632,7 @@ player::dropAmmo(void){
|
|||
//TSAmmoPack eDrop =
|
||||
TSAmmoPack::generate(this);
|
||||
|
||||
}//END OF dropAmmo
|
||||
}// dropAmmo
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
|
||||
|
||||
//TAGGG - why not??
|
||||
#define NULL __NULL__
|
||||
|
||||
//TAGGG - new. I just want to make it clear this variable is meant to be TRUE or FALSE.
|
||||
#define BOOL float
|
||||
#define BOOLEAN float
|
||||
|
||||
//TAGGG
|
||||
// plain printouts, no client/server tagging
|
||||
//#define printf(...) print(sprintf(__VA_ARGS__))
|
||||
//#define printfline(s1, ...) print(sprintf(s1"\n" __VA_ARGS__))
|
||||
//#define printlinef(s1, ...) print(sprintf(s1"\n" __VA_ARGS__))
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//TODO - let some easy constant, or even just "debug", specify whether to include
|
||||
// TODO - let some easy constant, or even just "debug", specify whether to include
|
||||
// the CL or SV in front. But we don't know how many re-updates from modern files
|
||||
// will happen between now and then.
|
||||
|
||||
|
@ -47,8 +45,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
// Safe way to declare an entity seen in FreeHL. Think of it as:
|
||||
// arg_dest = spawnfunc_ClassNameHere;
|
||||
// This lets the constructor invoked by 'spawnfunc_' have a 'self' set
|
||||
|
@ -69,10 +65,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// will anywhere shared ever need this?
|
||||
#ifdef CLIENT
|
||||
#define GET_GAME_STATE getstatf(STAT_GAMESTATE)
|
||||
|
@ -187,10 +179,14 @@ if (pl.inputSecondaryTapFrameCount == 0)\
|
|||
|
||||
|
||||
|
||||
// be aware that a player is a thing
|
||||
// be aware of the player
|
||||
class player;
|
||||
|
||||
|
||||
extern const vector g_vZero;
|
||||
|
||||
|
||||
|
||||
#ifdef SSQC
|
||||
void centerprintToAll(string strSend);
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
|
||||
//easy ref.
|
||||
const vector vecZero = [0,0,0];
|
||||
|
||||
|
||||
const vector g_vZero = [0,0,0];
|
||||
|
||||
|
||||
|
||||
|
@ -14,6 +12,8 @@ centerprintToAll(string strSend){
|
|||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
centerprint(eFind, strSend);
|
||||
}
|
||||
// NOTE! These would be real spectators now, not just players that can use
|
||||
// the buy menu. Is that ok?
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "spectator"));) {
|
||||
centerprint(eFind, strSend);
|
||||
}
|
||||
|
@ -22,20 +22,18 @@ centerprintToAll(string strSend){
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//NOTICE - there already is a "floor" method, but it might be considered
|
||||
//incorrect for negative numbers. We have a fix!
|
||||
// NOTICE - there already is a "floor" method, but it might be considered
|
||||
// incorrect for negative numbers. We have a fix!
|
||||
int
|
||||
floor_proper(float arg){
|
||||
if(arg >= 0){
|
||||
//no change needed
|
||||
return (int)(floor(arg));
|
||||
}else{
|
||||
//aha! Do a little shifting around.
|
||||
//In short, this is the same as though arg were positive, and we took the opposite direction operation instead... and make the result negative.
|
||||
//So yes, floor_proper(-42.7) would be -43, not -42.
|
||||
// aha! Do a little shifting around.
|
||||
// In short, this is the same as though arg were positive, and we took the opposite
|
||||
// direction operation instead... and make the result negative.
|
||||
// So yes, floor_proper(-42.7) would be -43, not -42.
|
||||
return (int)(-ceil(-arg));
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +49,8 @@ int ceil_proper(float arg){
|
|||
|
||||
|
||||
|
||||
|
||||
//New utility method.
|
||||
//I don't know if QuakeC has its own "round"-like method, but I tried.
|
||||
// New utility method.
|
||||
// I don't know if QuakeC has its own "round"-like method, but I tried.
|
||||
int round(float arg){
|
||||
|
||||
// WHOOPS. There is one.
|
||||
|
@ -87,23 +84,17 @@ int round(float arg){
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
// Includes the possibility in some engines that a solid "1" is returned
|
||||
// by the built-in random method. Sometimes we may not care about this,
|
||||
// like a number between 2 and 5 for seconds. Do we really care if we hit
|
||||
// exactly 5 seconds?
|
||||
// BUT this is bad for arrays. If there are 10 elements in an array (elements
|
||||
// 0 through 9 available), hitting exactly element #10 would be bad.
|
||||
// See below for a remedy to that.
|
||||
float randomInRange_raw_f(float min, float max){
|
||||
return min + ((max - min) * random());
|
||||
}//randomInRange
|
||||
|
||||
}//END OF randomInRange
|
||||
|
||||
//This is the fixed version to ensure random() does not hit an invalid range.
|
||||
//Although this is much more important for the int one in most cases.
|
||||
// This is the fixed version to ensure random() does not hit an invalid range.
|
||||
// Although this is much more important for the int one in most cases.
|
||||
// NOTE! Turns it it is already impossible for random() to return exactly 1, so
|
||||
// removing the bound check. No different from _raw above.
|
||||
float randomInRange_f(float min, float max){
|
||||
/*
|
||||
float r = random();
|
||||
if(r >= 1.0f){
|
||||
//r = 0.999f; //should be fine
|
||||
|
@ -113,19 +104,17 @@ float randomInRange_f(float min, float max){
|
|||
//to 3-4 places, judging from printouts trying to use more digits.
|
||||
return max - 0.001f;
|
||||
}
|
||||
|
||||
*/
|
||||
return min + ((max - min) * random());
|
||||
|
||||
}//END OF randomInRange
|
||||
}//zrandomInRange
|
||||
|
||||
|
||||
|
||||
int randomInRange_raw_i(int min, int max){
|
||||
return min + floor_proper((max - min + 1) * random());
|
||||
}// randomInRange
|
||||
|
||||
}//END OF randomInRange
|
||||
|
||||
//This is the fixed version to ensure random() does not hit an invalid range.
|
||||
// This is the fixed version to ensure random() does not hit an invalid range.
|
||||
int randomInRange_i(int min, int max){
|
||||
float r = random();
|
||||
if(r >= 1.0f){
|
||||
|
@ -135,7 +124,7 @@ int randomInRange_i(int min, int max){
|
|||
|
||||
return min + floor_proper((max - min + 1) * random());
|
||||
|
||||
}//END OF randomInRange
|
||||
}//randomInRange
|
||||
|
||||
//And just an isolated version of what goes on to make sure the random value isn't >= 1.
|
||||
float safeRandom(void){
|
||||
|
|
Loading…
Reference in a new issue