pitchsound out of order fix and vgui rename + cleanup minor

This commit is contained in:
Chris Dawalt 2021-08-07 18:01:24 -04:00
parent 42a97f73d3
commit 0af2292d70
27 changed files with 1773 additions and 1990 deletions

View file

@ -25,10 +25,10 @@ ClientGame_ConsoleCommand(void)
//TAGGG - is that ok? //TAGGG - is that ok?
case "+speedcustom": case "+speedcustom":
pSeatLocal->iInputSpeed = TRUE; pSeatLocal->m_iInputSpeed = TRUE;
break; break;
case "-speedcustom": case "-speedcustom":
pSeatLocal->iInputSpeed = FALSE; pSeatLocal->m_iInputSpeed = FALSE;
break; break;
//TAGGG - NEW ONES //TAGGG - NEW ONES
@ -85,12 +85,12 @@ ClientGame_ConsoleCommand(void)
*/ */
case "motd": case "motd":
if(getplayerkeyvalue( player_localnum, "*spec" ) != "0"){ if(getplayerkeyvalue( player_localnum, "*spec" ) != "0"){
VGUI_ChangeScreen(VGUI_SCREEN::MOTD); UI_ChangeScreen(UI_SCREEN::MOTD);
} }
break; break;
case "buy": case "buy":
//If we're in spectator mode we can do this //If we're in spectator mode we can do this
// no-screen check, not necessary probably: pSeatLocal->fVGUI_Display == VGUI_SCREEN::NONE && // no-screen check, not necessary probably: pSeatLocal->m_flUI_Display == UI_SCREEN::NONE &&
pl = (player)pSeat->m_ePlayer; pl = (player)pSeat->m_ePlayer;
printfline("CMD: BUY COMMAND RECEIVED! Should I react? %s (1=yes) : %d", getplayerkeyvalue( player_localnum, "*spec" ), pl.iState); printfline("CMD: BUY COMMAND RECEIVED! Should I react? %s (1=yes) : %d", getplayerkeyvalue( player_localnum, "*spec" ), pl.iState);
@ -99,7 +99,7 @@ ClientGame_ConsoleCommand(void)
//if(getplayerkeyvalue( player_localnum, "*spec" ) != "0"){ //if(getplayerkeyvalue( player_localnum, "*spec" ) != "0"){
if(pl.iState != PLAYER_STATE::SPAWNED){ if(pl.iState != PLAYER_STATE::SPAWNED){
//we can show it! //we can show it!
VGUI_ChangeScreen(VGUI_SCREEN::BUYSIDEMENU); UI_ChangeScreen(UI_SCREEN::BUYMENU);
} }
break; break;

View file

@ -26,8 +26,8 @@ ClientGame_EventParse(float fHeader)
// ! // !
// Any need for a m_ePlayer classname check here? // Any need for a m_ePlayer classname check here?
// I think none apply for being an authentic "spectator", most don't for being a buymenu spectator // I think none apply for being an authentic "spectator", most don't for being a
// (player with that is not PLAYER_STATE::SPAWNED) // buymenu spectator (player with that is not PLAYER_STATE::SPAWNED)
switch(fHeader){ switch(fHeader){
case EV_OBITUARY: case EV_OBITUARY:
@ -162,7 +162,7 @@ ClientGame_EventParse(float fHeader)
deployConfig(); deployConfig();
// Just in case. // Just in case.
VGUI_ChangeScreen(VGUI_SCREEN::NONE); UI_ChangeScreen(UI_SCREEN::NONE);
// so that any choice of weapon, same as before or even nothing, will still // so that any choice of weapon, same as before or even nothing, will still
// let client/view.qc do the whole viewmodel routine again // let client/view.qc do the whole viewmodel routine again
@ -178,9 +178,6 @@ ClientGame_EventParse(float fHeader)
case EVENT_TS::PLAYER_DEATH: case EVENT_TS::PLAYER_DEATH:
EV_PlayerDeath(); EV_PlayerDeath();
break; break;
//case EVENT_TS::PLAY_INSERT_SHELL_SND:
// EV_TS_PlayInsertShellSound(pl);
// break;
case EVENT_TS::EFFECT_EXPLOSION: case EVENT_TS::EFFECT_EXPLOSION:
vecOrigin[0] = readcoord(); vecOrigin[0] = readcoord();
vecOrigin[1] = readcoord(); vecOrigin[1] = readcoord();

View file

@ -83,9 +83,7 @@ HUD_Draw(void)
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
GameClient_PlayerInputRaw(); //TAGGG - new
//TAGGG - NEw
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
drawTimer(); drawTimer();
drawPlayerStats(); drawPlayerStats();
@ -94,8 +92,9 @@ HUD_Draw(void)
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// TEST! Just for nuclide, doesn't matter what m_iHUDWeaponSelected is exactly, // Just for nuclide, doesn't matter what m_iHUDWeaponSelected is exactly,
// just 0 or non-zero has significance in it. // just 0 or non-zero has significance in it for denying game-related inputs
// in Nuclide, which is all we need.
pSeat->m_iHUDWeaponSelected = (pl.weaponSelectHighlightID != -1); pSeat->m_iHUDWeaponSelected = (pl.weaponSelectHighlightID != -1);
@ -123,21 +122,11 @@ HUD_Draw(void)
pSeat->m_iHUDWeaponSelected = 0; pSeat->m_iHUDWeaponSelected = 0;
// is this necessary? With or without the if-then too.
/*
if(g_vguiWidgetCount > 0){
GameClient_SpectatorInputRaw();
}
*/
drawTimer(); drawTimer();
//TAGGG - Moved over! Is it wise for this to go here?
// Links to drawing the MoTD and buymenu when appropriate // Links to drawing the MoTD and buymenu when appropriate
//TAGGG - CRITICAL. "self" is a spectator, not a player!! UI_Draw(pl);
// Send over the above "spec" instead too!
CSQC_VGUI_Draw(pl);
}// pl.iState check }// pl.iState check

View file

@ -104,7 +104,7 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
// using the new VGUI approach. // using the new VGUI approach.
// That also includes mentions of fonts in ts/src/client/vgui.qc // That also includes mentions of fonts in ts/src/client/vgui.qc
// Also see ts/src/client/vgui.qc where CSQC_VGUI_Draw checks to see if the screen // Also see ts/src/client/vgui.qc where UI_Draw checks to see if the screen
// size has been changed or this is the first time drawing (some FONTs having ID -1). // 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. // In either case, they're loaded and sized per screen height over there.
FONT_ARIAL = -1; //specify me at draw startup instead, if this is safe. FONT_ARIAL = -1; //specify me at draw startup instead, if this is safe.
@ -136,7 +136,7 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
drawfont = FONT_CON; drawfont = FONT_CON;
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
CSQC_VGUI_Init(); UI_Init();
} }

View file

@ -1,4 +0,0 @@
void GameClient_SpectatorInputRaw(void)
void GameClient_PlayerInputRaw(void);

View file

@ -1,204 +0,0 @@
// NEW FILE.
// RECENT: This file is pending deletion, if the "GamePlayerSpawn" message call in
// ts/src/shared/input.qc is good enough.
// That would mean GameClient_SpectatorInputRaw, nor any pSeatLocal vars only it uses,
// would no longer be necessary.
// Just want to be sure first with some more tests, no getting locked out of spawning.
// GameClient_PlayerInputRaw is tiny and hud.qc can do what it does instead.
// The "DISABLED" area further down is worth seeing if supporting right click to close
// an open weapon select immediately without applying any selection is a good idea though.
// -----------------------------
// WARNING: Do not get this file mixed up with <game>/src/shared/input.qc, that one is
// only called when the player is spawned (collision, seen by others, etc.).
// This is for checking to see if the user performed some action that does not need
// to be checked by the server, such as INPUT_BUTTON0 (primary fire) while not in any
// VGUI choice (blank screen) to send a message to the server to swawn the player.
// This is reached through draw-calls (root of the calls is method CSQC_UpdateView).
// It works.
// ALSO, this is called continually to check for user-provided input, it is not only
// called when user input is detected. Be aware of that.
// Also, this version is for while in spectator. See further down for the "for-player"
// version.
void
GameClient_SpectatorInputRaw(void)
{
// If in spectator with nothing open (no MoTD, no buyside menu),
// go ahead and spawn ingame.
if(pSeatLocal->fVGUI_Display == VGUI_SCREEN::NONE && pSeatLocal->m_flPrevVGUI != VGUI_SCREEN::NONE){
// Current display is NONE, yet the previous wasn't (Recent change to NONE)?
// Set that.
pSeatLocal->m_bNeedPrimaryRelease = TRUE;
pSeatLocal->m_flReleaseTime = time + 0.15f;
}
pSeatLocal->m_flPrevVGUI = pSeatLocal->fVGUI_Display;
// OKAY. So little issue.
// Modern Nuclide does not offer a way to read "input_buttons" in the usual places
// (CSQC_Input_Frame), can they be re-gathered?
// COPIED FROM src/client/predict.qc, for scraping through
// all queued input frames for sending (or not yet verified to have
// been received by the server. I think?).
// Or use the one at clientcommandframe only. Hmm.
// quote from fteextensions.qc:
// The sequence number range used for prediction should normally be
// servercommandframe < sequence <= clientcommandframe.
//printf("WHAT are the client/server comm frames? %d %d\n", clientcommandframe, servercommandframe);
//for (int i = pl.sequence + 1; i <= clientcommandframe; i++) {
/*
bool wasButtonPushedThisFrame = FALSE;
for (int i = servercommandframe+1; i <= clientcommandframe; i++) {
float flSuccess = getinputstate(i);
if (flSuccess == FALSE) {
continue;
}
//if (i==clientcommandframe){
// CSQC_Input_Frame();
//}
if (input_timelength == 0) {
break;
}
if((input_buttons & INPUT_BUTTON0) != 0){
//printfline("IM here man %d\n", (input_buttons & INPUT_BUTTON0) != 0);
// any frame says I got pushed? Treat it as such.
wasButtonPushedThisFrame = TRUE;
}
//input_sequence = i;
}
*/
float flSuccess = getinputstate(clientcommandframe);
if (flSuccess) {
//printf("BUT HOW? %d - %d\n", (pSeatLocal->m_bNeedPrimaryRelease), (( input_buttons & INPUT_BUTTON0)!=0) );
// IDEA: could we just do this?
/*
if(pSeatLocal->m_bNeedPrimaryRelease){
if(!wasButtonPushedThisFrame)){
pSeatLocal->m_bNeedPrimaryRelease = FALSE;
}
}
*/
// INSTEAD OF THIS
///////////////////////////////////////////////////////
if(pSeatLocal->m_bNeedPrimaryRelease){
// yay.
if(!(input_buttons & INPUT_BUTTON0)){
// not pushed? Check it
if(time >= pSeatLocal->m_flReleaseTime){
// okay! Not touched for enough time.
pSeatLocal->m_bNeedPrimaryRelease = FALSE;
}
}else{
// Touched? Oh.
pSeatLocal->m_flReleaseTime = time + 0.15f;
}
}
///////////////////////////////////////////////////////
player pl = (player)pSeat->m_ePlayer;
// primary fire?
if(!pSeatLocal->m_bNeedPrimaryRelease && (input_buttons & INPUT_BUTTON0) ){
if(
pSeatLocal->fVGUI_Display == VGUI_SCREEN::NONE &&
//getplayerkeyvalue(player_localnum, "*spec") != "0"
pl.iState != PLAYER_STATE::SPAWNED
){
// && getstati(STAT_RULE_ALLOW_SPAWN))
// just send the intention we want to spawn, the server will see if a delay is needed.
// And only work if we're not in some other screen AND not spawned. Clicking to spawn while ingame (die) would be irritating.
// Check is no longer needed, only the spectator would have reached this method to begin with.
//if( stof(getplayerkeyvalue(player_localnum, "*team")) == TEAM_SPECTATOR)
//TAGGG - TODO - should some minimum cooldown before respawning be enforced,
// and the countdown shows up if the user clicks too soon since a respawn?
// Print this if the client suspects that will be the case, or let spawn-delay
// be some serverstat that is known here at all times.
//CSQC_Parse_CenterPrint("Spawning soon...\n");
sendevent( "GamePlayerSpawn", "");
VGUI_ChangeScreen(VGUI_SCREEN::NONE);
// probably unnecessary?
EV_TS_resetViewModel();
}
}
}
}//GameClient_SpectatorInputRaw
// While a player.
void
GameClient_PlayerInputRaw(void)
{
player pl = (player)pSeat->m_ePlayer;
// weapon select extra.
if(pl == NULL){
return;
}
// This was removed? Legacy VGUI
// If we are inside a VGUI, don't let the client do stuff outside
if (pl.iState != PLAYER_STATE::SPAWNED && pSeatLocal->fVGUI_Display != VGUI_SCREEN::NONE){
pSeat->m_flInputBlockTime = time + 0.2;
}
// No need to check for calling TS_HUD_DrawWeaponSelect_CheckClick or
// HUD_DrawWeaponSelect_Trigger here, Nuclide calls the latter which works
// fine.
// CRITICAL.
// DISABLED.
// This is trying to close weaponselect on detecting a right-click, but it
// has issues.
// Idea is, this needs to *absorb* the right-click, and stop it from reaching
// the rest of the client and server to work with weapons, like a change-ironsight
// order.
// This might stop the client weapon logic from seeing the right click, but not
// the server.
// It appears there is no way to stop that without the FTE built-in event method
// CSQC_Input_Frame (defined by Nuclide) letting the gamemod block right-click
// inputs per some condition, like weapon-select being up.
/*
if(pSeat->m_iInputAttack2){ //input_buttons & INPUT_BUTTON3){
if(HUD_CloseWeaponSelect(TRUE)){
pSeat->m_flInputBlockTime = time + 0.2;
input_impulse = 0;
input_buttons = 0;
pSeat->m_iInputAttack2 = FALSE;
}else{
//pSeat->m_iInputAttack2 = TRUE;
}
}
*/
}//GameClient_PlayerInputRaw

View file

@ -32,13 +32,12 @@ defs.h
clientinfo.h clientinfo.h
seatlocal.h seatlocal.h
input.h
//TAGGG - NEW //TAGGG - NEW
precache.h precache.h
vgui.h ui.h
ui_eventgrabber.h ui_eventgrabber.h
vgui_buysidemenu.h ui_buymenu.h
hud_weaponselect.h hud_weaponselect.h
inventory_logic_draw.h inventory_logic_draw.h
view.h view.h
@ -59,12 +58,10 @@ hud.h
../shared/inventory_logic.qc ../shared/inventory_logic.qc
//TAGGG - NEW //TAGGG - NEW
input.qc
vguiobjects.qc vguiobjects.qc
vgui_motd.qc vgui_motd.qc
vgui_buysidemenu.qc ui_buymenu.qc
//vgui_spectator.c ???? ui.qc
vgui.qc
hud_crosshair.qc hud_crosshair.qc
hud_scope.qc hud_scope.qc

View file

@ -23,16 +23,13 @@ struct
int m_iHUDWeaponSelected; int m_iHUDWeaponSelected;
float m_flHUDWeaponSelectTime; float m_flHUDWeaponSelectTime;
float m_flPrevVGUI;
BOOL m_bNeedPrimaryRelease;
float m_flReleaseTime;
//TAGGG - assuming this is a fine place to put this //TAGGG - assuming this is a fine place to put this
// It's the slower movement from holding shift down. // It's the slower movement from holding shift down.
int iInputSpeed; int m_iInputSpeed;
// Keeping for now, remove later // Keeping for now, remove later
float fVGUI_Display; float m_flUI_Display;
// CRITICAL: // CRITICAL:
// Should these be per pSeat instead? Unsure if that makes sense. // Should these be per pSeat instead? Unsure if that makes sense.

View file

@ -5,9 +5,8 @@
void void
pSeatLocal_init(void) pSeatLocal_init(void)
{ {
pSeatLocal->m_flPrevVGUI = VGUI_SCREEN::NONE; pSeatLocal->m_flUI_Display = UI_SCREEN::NONE;
pSeatLocal->m_bNeedPrimaryRelease = FALSE;
pSeatLocal->m_flReleaseTime = 0;
pSeatLocal->m_inputKeyTapped = 0; pSeatLocal->m_inputKeyTapped = 0;
pSeatLocal->m_inputKeyDown = 0; pSeatLocal->m_inputKeyDown = 0;

View file

@ -1,47 +1,47 @@
#define VGUI_WINDOW_BGCOLOR '0.0 0.0 0.0' #define VGUI_WINDOW_BGCOLOR '0.0 0.0 0.0'
#define VGUI_WINDOW_FGCOLOR '1.0 0.5 0.0' #define VGUI_WINDOW_FGCOLOR '1.0 0.5 0.0'
#define VGUI_WINDOW_BGALPHA 0.76 #define VGUI_WINDOW_BGALPHA 0.76
#define VGUI_WINDOW_FGALPHA 1.0 #define VGUI_WINDOW_FGALPHA 1.0
vector vVGUIWindowPos; vector vVGUIWindowPos;
vector vVGUIWindowSiz; vector vVGUIWindowSiz;
string sMOTDString[25]; string sMOTDString[25];
string sMapString[35]; string sMapString[35];
var string sMOTD_total; var string sMOTD_total;
class player; class player;
// Keep in synch with the vguiMenus array of vgui.c // Keep in synch with the vguiMenus array of vgui.c
enum VGUI_SCREEN{ enum UI_SCREEN{
NONE = 0, NONE = 0,
MOTD, MOTD,
BUYSIDEMENU BUYMENU
}; };
typedef struct { typedef struct {
string sTitle; string sTitle;
// Whether to do a VGUI_Window call to draw a window. // Whether to do a VGUI_Window call to draw a window.
// Not very customizable for now, intended only for the MoTD, but adapts to different screen sizes. // Not very customizable for now, intended only for the MoTD, but adapts to different screen sizes.
// Could have other settings added later, or even be handled per screen's draw call too for completely re-doing // Could have other settings added later, or even be handled per screen's draw call too for completely re-doing
BOOLEAN fDrawMainWindowAuto; BOOLEAN fDrawMainWindowAuto;
// Custom draw script for a particular screen choice // Custom draw script for a particular screen choice
//TAGGG - now accepts how much to change the font size (and adjust other things) by. //TAGGG - now accepts how much to change the font size (and adjust other things) by.
// Also accepts the player for getting other info from. // Also accepts the player for getting other info from.
void(player arg_player, vector vPos, vector vWindowSiz, float fFontSizeMulti ) vDraw; void(player arg_player, vector vPos, vector vWindowSiz, float fFontSizeMulti ) vDraw;
// What to do the moment the screen is changed to this. // What to do the moment the screen is changed to this.
void(void) vOnInit; void(void) vOnInit;
} vguiwindow_t; } vguiwindow_t;
void CSQC_VGUI_Init(void); void UI_Init(void);
float CSQC_VGUI_Draw( player arg_player); float UI_Draw( player arg_player);
void VGUI_ChangeScreen(VGUI_SCREEN fNewScreenID); void UI_ChangeScreen(UI_SCREEN fNewScreenID);

View file

@ -26,25 +26,25 @@
// be set in an init method instead. // be set in an init method instead.
// Keep in synch with vgui.h's VGUI_SCREEN enum choices, besides the NONE choice. // Keep in synch with vgui.h's UI_SCREEN enum choices, besides the NONE choice.
// That isn't represented, not even by a dummy. // That isn't represented, not even by a dummy.
var vguiwindow_t vguiMenus[] = { var vguiwindow_t vguiMenus[] = {
//{ _("VGUI_TITLE_MOTD"), VGUI_MessageOfTheDay }, //{ _("VGUI_TITLE_MOTD"), VGUI_MessageOfTheDay },
{ "", TRUE, VGUI_MessageOfTheDay, NULL }, { "", TRUE, VGUI_MessageOfTheDay, NULL },
{ "", FALSE, VGUI_BuySideMenu_Update, VGUI_BuySideMenu_OnInit} { "", FALSE, UI_BuyMenu_Update, UI_BuyMenu_OnInit}
}; };
//var float nextPrintoutTime = -1; //var float nextPrintoutTime = -1;
void void
VGUI_ChangeScreen(VGUI_SCREEN arg_NewScreenID) UI_ChangeScreen(UI_SCREEN arg_NewScreenID)
{ {
pSeatLocal->fVGUI_Display = (float)arg_NewScreenID; pSeatLocal->m_flUI_Display = (float)arg_NewScreenID;
printfline("VGUI_ChangeScreen:: arg_NewScreenID? %d", arg_NewScreenID); printfline("UI_ChangeScreen:: arg_NewScreenID? %d", arg_NewScreenID);
if(arg_NewScreenID <= VGUI_SCREEN::NONE){ if(arg_NewScreenID <= UI_SCREEN::NONE){
// If at NONE or below, also do nothing. This has no "vOnInit" behavior. // If at NONE or below, also do nothing. This has no "vOnInit" behavior.
// Besides obligatory cleanup if we choose (which may as well be done right here) // Besides obligatory cleanup if we choose (which may as well be done right here)
// And turn the cursor lock off. // And turn the cursor lock off.
@ -75,16 +75,16 @@ VGUI_ChangeScreen(VGUI_SCREEN arg_NewScreenID)
/* /*
================= =================
CSQC_VGUI_Draw UI_Draw
This is the entry point for FreeTS's (cloned from FreeCS) own "VGUI" implementation This is the entry point for FreeTS's (cloned from FreeCS) own "VGUI" implementation
Run every frame Run every frame
================= =================
*/ */
float float
CSQC_VGUI_Draw( player arg_player) UI_Draw(player arg_player)
{ {
if ( pSeatLocal->fVGUI_Display == VGUI_SCREEN::NONE ) { if ( pSeatLocal->m_flUI_Display == UI_SCREEN::NONE ) {
setcursormode( FALSE ); setcursormode( FALSE );
return FALSE; return FALSE;
} }
@ -160,19 +160,19 @@ CSQC_VGUI_Draw( player arg_player)
vVGUIWindowSiz[1] = window_height_y; vVGUIWindowSiz[1] = window_height_y;
// draw the window only if this screen says to. // draw the window only if this screen says to.
if(vguiMenus[ pSeatLocal->fVGUI_Display - 1 ].fDrawMainWindowAuto){ if(vguiMenus[ pSeatLocal->m_flUI_Display - 1 ].fDrawMainWindowAuto){
VGUI_Window( vVGUIWindowPos, vVGUIWindowSiz, vguiMenus[ pSeatLocal->fVGUI_Display - 1 ].sTitle, [fontSizeMulti*32,fontSizeMulti*32] ); VGUI_Window( vVGUIWindowPos, vVGUIWindowSiz, vguiMenus[ pSeatLocal->m_flUI_Display - 1 ].sTitle, [fontSizeMulti*32,fontSizeMulti*32] );
} }
// Display the contents of whatever we have selected // Display the contents of whatever we have selected
vguiMenus[ pSeatLocal->fVGUI_Display - 1 ].vDraw( arg_player, vVGUIWindowPos, vVGUIWindowSiz, fontSizeMulti ); vguiMenus[ pSeatLocal->m_flUI_Display - 1 ].vDraw( arg_player, vVGUIWindowPos, vVGUIWindowSiz, fontSizeMulti );
return TRUE; return TRUE;
} }
/* /*
================= =================
CSQC_VGUI_Init UI_Init
Initialize all there is Initialize all there is
================= =================
@ -181,7 +181,7 @@ Initialize all there is
// ALSO - this means once for the entire client, so handle all pSeat choices // ALSO - this means once for the entire client, so handle all pSeat choices
// individually as it does. // individually as it does.
void void
CSQC_VGUI_Init(void) UI_Init(void)
{ {
string sTemp; string sTemp;
int iMOTDLength; int iMOTDLength;
@ -238,14 +238,14 @@ CSQC_VGUI_Init(void)
for (s = 0; s < g_seats.length; s++){ for (s = 0; s < g_seats.length; s++){
pSeat = &g_seats[s]; pSeat = &g_seats[s];
pSeatLocal = &g_seatslocal[s]; pSeatLocal = &g_seatslocal[s];
VGUI_ChangeScreen(VGUI_SCREEN::MOTD); UI_ChangeScreen(UI_SCREEN::MOTD);
} }
}else{ }else{
// make all pSeats start at the NONE screen instead // make all pSeats start at the NONE screen instead
for (s = 0; s < g_seats.length; s++){ for (s = 0; s < g_seats.length; s++){
pSeat = &g_seats[s]; pSeat = &g_seats[s];
pSeatLocal = &g_seatslocal[s]; pSeatLocal = &g_seatslocal[s];
VGUI_ChangeScreen(VGUI_SCREEN::NONE); UI_ChangeScreen(UI_SCREEN::NONE);
} }
} }
} }

3
src/client/ui_buymenu.h Normal file
View file

@ -0,0 +1,3 @@
extern var BOOL UI_BuyMenu_InitDone;
void UI_BuyMenu_onInputEvent(void);

File diff suppressed because it is too large Load diff

View file

@ -9,12 +9,9 @@
// Simple UIWidget to absorb mouse-click and key-press events while in // Simple UIWidget to absorb mouse-click and key-press events while in
// the MoTD or the buysidemenu screens. // the MoTD or the buymenu screens.
// Do not give me child elements! Behavior for handling children removed. // Do not give me child elements! Behavior for handling children removed.
// assuming these are provided elsewhere, works for now.
extern var BOOL VGUI_BuySideMenu_InitDone;
void BuySideMenu_onInputEvent(void);
class CUIEventGrabber:CUIWidget class CUIEventGrabber:CUIWidget
@ -52,8 +49,8 @@ CUIEventGrabber::Input(float flEVType, float flKey, float flChar, float flDevID)
// TODO TODO TODO! Check for mouse-clicks (K_MOUSE1) and key presses by separate methods? // TODO TODO TODO! Check for mouse-clicks (K_MOUSE1) and key presses by separate methods?
// Checking for keypresses on a mouse-click or for mouse-coords on a keypress on every // Checking for keypresses on a mouse-click or for mouse-coords on a keypress on every
// single button (even a mouse, yes/no check every time) is unnecessary. // single button (even a mouse, yes/no check every time) is unnecessary.
if(pSeatLocal->fVGUI_Display == BUYSIDEMENU){ if(pSeatLocal->m_flUI_Display == UI_SCREEN::BUYMENU){
BuySideMenu_onInputEvent(); UI_BuyMenu_onInputEvent();
} }
break; break;

View file

@ -1 +0,0 @@

View file

@ -63,8 +63,8 @@ Colors_RGB8_to_HEX(vector color)
void VGUI_MessageOfTheDay(player arg_player, vector vPos, vector vWindowSiz, float fFontSizeMulti ) { void VGUI_MessageOfTheDay(player arg_player, vector vPos, vector vWindowSiz, float fFontSizeMulti ) {
static void MessageOfTheDay_ButtonOK( void ) { static void MessageOfTheDay_ButtonOK( void ) {
printfline("HEY ButtonOK got CLICKED!!!"); printfline("HEY ButtonOK got CLICKED");
VGUI_ChangeScreen(VGUI_SCREEN::BUYSIDEMENU); UI_ChangeScreen(UI_SCREEN::BUYMENU);
} }
//TAGGG - start from this location instead. //TAGGG - start from this location instead.

View file

@ -108,7 +108,7 @@ Draws a button, returns whether or not a mouse is hovering over it (for inherita
==================== ====================
*/ */
//*** NOTE! Buysidemenu buttons don't use this! Only the MoTD close button, at least so far. //*** NOTE! BuyMenu buttons don't use this! Only the MoTD close button, at least so far.
float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSize) { float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSize) {
vector vLabelPos; vector vLabelPos;
@ -125,7 +125,7 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSi
if ( VGUI_CheckMouse( vPosition, vSize ) ) { if ( VGUI_CheckMouse( vPosition, vSize ) ) {
//pSeatLocal->fVGUI_Display //pSeatLocal->m_flUI_Display
if (pSeatLocal->m_inputMouseClicked == TRUE) { if (pSeatLocal->m_inputMouseClicked == TRUE) {
vFunction(); vFunction();

View file

@ -192,7 +192,7 @@ Game_Worldspawn(void)
// The message of the day. // The message of the day.
// This saves the contents of the MoTD text file (path given by CVar motdfile) to a series of // This saves the contents of the MoTD text file (path given by CVar motdfile) to a series of
// serverinfo entries named motdline0, 1, 2, ... for reading back in client/vgui.c from the server // serverinfo entries named motdline0, 1, 2, ... for reading back in client/vgui.c from the server
// at client-connect time (CSQC_VGUI_Init) to go in the MoTD window whenever needed. // at client-connect time (UI_Init) to go in the MoTD window whenever needed.
localcmd(sprintf("echo [MOTD] Loading %s.\n", autocvar_motdfile)); localcmd(sprintf("echo [MOTD] Loading %s.\n", autocvar_motdfile));
filestream fmMOTD = fopen(autocvar_motdfile, FILE_READ); filestream fmMOTD = fopen(autocvar_motdfile, FILE_READ);
if (fmMOTD >= 0) { if (fmMOTD >= 0) {

View file

@ -24,14 +24,6 @@ void CSEv_TS_playerEquippedWeapon_ii(int newWeaponEquipped, BOOL useAkimbo);
#ifdef SERVER
void TS_PlayInsertShellSound(player pl);
#else
void TS_PlayInsertShellSound(player pl);
void EV_TS_PlayInsertShellSound(player pl);
#endif
#ifdef SERVER #ifdef SERVER
void TS_resetViewModel(player pl); void TS_resetViewModel(player pl);
#else #else

View file

@ -235,35 +235,6 @@ CSEv_TS_playerEquippedWeapon_ii(int newWeaponEquipped, BOOL useAkimbo){
#ifdef SERVER
// Send a request to change the animation of the viewmodel directly.
void
TS_PlayInsertShellSound(player pl){
/*
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
WriteByte( MSG_MULTICAST, EVENT_TS::PLAY_INSERT_SHELL_SND );
msg_entity = pl;
multicast( [0,0,0], MULTICAST_ONE );
*/
}
#else
void
TS_PlayInsertShellSound(player pl){
EV_TS_PlayInsertShellSound(pl);
}
//CLIENTSIDE. now what do I do over here?
void
EV_TS_PlayInsertShellSound(player pl){
//TODO - lower attenuation maybe?
// Nevermind, this is a client-only sound for now anyway.
localsound("weapons/insert-shell.wav", CHAN_AUTO, 1.0f);
}
#endif
// The server may want to tell the client to reset its viewmodel. // The server may want to tell the client to reset its viewmodel.
// DUMMIED - nevermind that for now, assuming the logic is called from server/client // DUMMIED - nevermind that for now, assuming the logic is called from server/client
// individually like a lot of weapon's logic. // individually like a lot of weapon's logic.
@ -334,19 +305,22 @@ EV_TS_resetPlayer(player pl, BOOL resetInventory){
#ifdef CLIENT #ifdef CLIENT
// Called by the GameRules, PlayerDeath, for the client to do something as soon as // Called by the GameRules, PlayerDeath, for the client to do something as soon as
// possible. // possible.
// WHOOPS. All vars since have been dummied or changes here are ineffective,
// keeping the event in case it has some use later.
void void
EV_PlayerDeath(void){ EV_PlayerDeath(void){
printfline("EV_PlayerDeath"); printfline("EV_PlayerDeath");
// Require a tiny amount of time and a mouse release before a respawn, so that // Require a tiny amount of time and a mouse release before a respawn, so that
// dying with the mouse held down isn't enough to trigger a respawn request. // dying with the mouse held down isn't enough to trigger a respawn request.
pSeatLocal->m_bNeedPrimaryRelease = TRUE; //pSeatLocal->m_bNeedPrimaryRelease = TRUE;
pSeatLocal->m_flReleaseTime = time + 0.15; //pSeatLocal->m_flReleaseTime = time + 0.15;
// Unfortunately not as effective as it may look. // Unfortunately not as effective as it may look.
// On the player using "kill" in console, a CSQC_Parse_Damage call happens shortly // On the player using "kill" in console, a CSQC_Parse_Damage call happens shortly
// after this PlayerDeath one, somehow. Stopping damage-drawing on the "*dead" key // after this PlayerDeath one, somehow. Stopping damage-drawing on the "*dead" key
// being 1 works. // being 1 works.
pSeat->m_flDamageAlpha = 0; //pSeat->m_flDamageAlpha = 0;
} }
#endif #endif

View file

@ -36,12 +36,11 @@ Game_Input(void)
// If not, grab pSeat->m_ePlayer instead! // If not, grab pSeat->m_ePlayer instead!
player pl = (player)self; player pl = (player)self;
if(pl.iState != PLAYER_STATE::SPAWNED){ if(pl.iState != PLAYER_STATE::SPAWNED){
// not ingame (fake spectator)? Do another check instead: spawning. // not ingame (fake spectator)? Do another check instead: spawning.
#ifdef CLIENT #ifdef CLIENT
if((input_buttons & INPUT_BUTTON0) && !(pl.gflags & GF_SEMI_TOGGLED) ){ if((input_buttons & INPUT_BUTTON0) && !(pl.gflags & GF_SEMI_TOGGLED) ){
if(pSeatLocal->fVGUI_Display == VGUI_SCREEN::NONE && pl.iState != PLAYER_STATE::SPAWNED){ if(pSeatLocal->m_flUI_Display == UI_SCREEN::NONE && pl.iState != PLAYER_STATE::SPAWNED){
sendevent( "GamePlayerSpawn", ""); sendevent( "GamePlayerSpawn", "");
} }
} }
@ -52,14 +51,57 @@ Game_Input(void)
pl.gflags &= ~GF_SEMI_TOGGLED; pl.gflags &= ~GF_SEMI_TOGGLED;
} }
#endif #endif
// client or server, don't pay attention to the rest of this file if not spawned
return; return;
} }
#ifdef CLIENT
else{
// not spawned? Some notes on possible things to involve, all dummied for now
// This was removed? Legacy VGUI
// If we are inside a UI, don't let the client do stuff outside
// (looks like this is no longer necessary)
/*
if (pl.iState != PLAYER_STATE::SPAWNED && pSeatLocal->m_flUI_Display != UI_SCREEN::NONE){
pSeat->m_flInputBlockTime = time + 0.2;
}
*/
// No need to check for calling TS_HUD_DrawWeaponSelect_CheckClick or
// HUD_DrawWeaponSelect_Trigger here, Nuclide calls the latter which works
// fine.
// CRITICAL.
// DISABLED.
// This is trying to close weaponselect on detecting a right-click, but it
// has issues.
// Idea is, this needs to *absorb* the right-click, and stop it from reaching
// the rest of the client and server to work with weapons, like a change-ironsight
// order.
// This might stop the client weapon logic from seeing the right click, but not
// the server.
// It appears there is no way to stop that without the FTE built-in event method
// CSQC_Input_Frame (defined by Nuclide) letting the gamemod block right-click
// inputs per some condition, like weapon-select being up.
/*
if(pSeat->m_iInputAttack2){ //input_buttons & INPUT_BUTTON3){
if(HUD_CloseWeaponSelect(TRUE)){
pSeat->m_flInputBlockTime = time + 0.2;
input_impulse = 0;
input_buttons = 0;
pSeat->m_iInputAttack2 = FALSE;
}else{
//pSeat->m_iInputAttack2 = TRUE;
}
}
*/
}// pi.iState checks
#endif
// Must be ingame to reach beyond here // Must be ingame to reach beyond here
//TAGGG - good place for this? Cloned from w_attack_next as a separate counter //TAGGG - good place for this? Cloned from w_attack_next as a separate counter
// for akimbo firing to use. // for akimbo firing to use.
// This method, Game_Input, is called by Nuclide's pmove.qc in the same place // This method, Game_Input, is called by Nuclide's pmove.qc in the same place
@ -139,8 +181,18 @@ Game_Input(void)
#endif #endif
// !!!
// An override for this to go in CSQC_Input_Frame would be very nice I think,
// unless there is some other way that I'm missing.
/*
if (pSeatLocal->m_iInputSpeed == TRUE) {
//input_buttons |= INPUT_BUTTON9;
input_buttons |= INPUT_BUTTON7;
//self.flags |= FL_SNEAK;
}else{
//self.flags &= ~FL_SNEAK;
}
*/
// TS way, weapon thinks happen alongside checking inputs // TS way, weapon thinks happen alongside checking inputs

View file

@ -301,9 +301,9 @@ player::Physics_MaxSpeed(void)
return targetSpeed; return targetSpeed;
} }
//FL_CROUCHING // Sneak?
if (input_buttons & INPUT_BUTTON7) { if (input_buttons & INPUT_BUTTON7) {
//sneak forgets slot limits. // sneak forgets slot limits.
targetSpeed *= 0.38; targetSpeed *= 0.38;
}else{ }else{
// speed factor of 0 means 55% speed. // speed factor of 0 means 55% speed.

View file

@ -118,43 +118,43 @@ const string sfx_pitched_s[] =
"weapons/beretta/fire.wav", "weapons/beretta/fire.wav",
"weapons/beretta/fire-sil.wav", "weapons/beretta/fire-sil.wav",
"weapons/contender/fire.wav", "weapons/contender/fire.wav",
"weapons/deagle/fire-sil.wav",
"weapons/deagle/fire.wav", "weapons/deagle/fire.wav",
"weapons/fnh/fnh-fire-sil.wav", "weapons/deagle/fire-sil.wav",
"weapons/fnh/fnh-fire.wav", "weapons/fnh/fnh-fire.wav",
"weapons/glock/glock-fire-sil.wav", "weapons/fnh/fnh-fire-sil.wav",
"weapons/glock/glock-fire.wav", "weapons/glock/glock-fire.wav",
"weapons/glock22/glock22-fire-sil.wav", "weapons/glock/glock-fire-sil.wav",
"weapons/glock22/glock22-fire.wav", "weapons/glock22/glock22-fire.wav",
"weapons/pdw/fire-sil.wav", "weapons/glock22/glock22-fire-sil.wav",
"weapons/pdw/fire.wav", "weapons/pdw/fire.wav",
"weapons/pdw/fire-sil.wav",
"weapons/katana/miss.wav", "weapons/katana/miss.wav",
"weapons/katana/miss1.wav", "weapons/katana/miss1.wav",
"weapons/m4/m4-fire-sil.wav",
"weapons/m4/m4-fire.wav", "weapons/m4/m4-fire.wav",
"weapons/m4/m4-fire-sil.wav",
"weapons/m16/fire.wav", "weapons/m16/fire.wav",
"weapons/m60/m60-fire.wav", "weapons/m60/m60-fire.wav",
"weapons/mac10/mac10-fire-sil.wav",
"weapons/mac10/mac10-fire.wav", "weapons/mac10/mac10-fire.wav",
"weapons/uzi/uzi-fire-sil.wav", "weapons/mac10/mac10-fire-sil.wav",
"weapons/uzi/uzi-fire.wav", "weapons/uzi/uzi-fire.wav",
"weapons/uzi/uzi-fire-sil.wav",
"weapons/mossberg/fire.wav", "weapons/mossberg/fire.wav",
"weapons/mp5k/mp5k-fire-sil.wav",
"weapons/mp5k/mp5k-fire.wav", "weapons/mp5k/mp5k-fire.wav",
"weapons/mp5k/mp5k-fire-sil.wav",
"weapons/mp5sd/mp5sd-fire.wav", "weapons/mp5sd/mp5sd-fire.wav",
"weapons/bull/fire01.wav", "weapons/bull/fire01.wav",
"weapons/ruger/fire.wav", "weapons/ruger/fire.wav",
"weapons/sawedoff/fire.wav", "weapons/sawedoff/fire.wav",
"weapons/skorpion/fire.wav", "weapons/skorpion/fire.wav",
"weapons/mk23/mk23-fire-sil.wav",
"weapons/mk23/mk23-fire.wav", "weapons/mk23/mk23-fire.wav",
"weapons/mk23/mk23-fire-sil.wav",
"weapons/spas12/spas12-fire.wav", "weapons/spas12/spas12-fire.wav",
"weapons/aug/aug-fire-sil.wav",
"weapons/aug/aug-fire.wav", "weapons/aug/aug-fire.wav",
"weapons/tmp/fire-sil.wav", "weapons/aug/aug-fire-sil.wav",
"weapons/tmp/fire.wav", "weapons/tmp/fire.wav",
"weapons/ump/ump-fire-sil.wav", "weapons/tmp/fire-sil.wav",
"weapons/ump/ump-fire.wav", "weapons/ump/ump-fire.wav",
"weapons/ump/ump-fire-sil.wav",
"weapons/usas/usas-fire.wav", "weapons/usas/usas-fire.wav",
"explo/explode.wav", "explo/explode.wav",
"explo/explode1.wav", "explo/explode1.wav",

View file

@ -531,7 +531,6 @@ weapon_shotgun_onThink_reloadLogic(player pl, weapondata_gun_t* basePRef, weapon
if(pl.shotgunAddAmmoSoundTime != -1 && pl.w_attack_next <= pl.shotgunAddAmmoSoundTime){ if(pl.shotgunAddAmmoSoundTime != -1 && pl.w_attack_next <= pl.shotgunAddAmmoSoundTime){
//TS_PlayInsertShellSound(pl);
//TS_Weapons_PlaySoundChannelDirect(pl, "weapons/insert-shell.wav", CHAN_AUTO); //TS_Weapons_PlaySoundChannelDirect(pl, "weapons/insert-shell.wav", CHAN_AUTO);
// TODO: if you want other players to hear this, the server should play it for all players // TODO: if you want other players to hear this, the server should play it for all players

View file

@ -225,7 +225,7 @@ w_glock18_hud(void)
} }
// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the // NOPE! Handled by the BuyMenu, could make this give the instructions for drawing the
// button with the icon if really wanted // button with the icon if really wanted
void void
w_glock18_hudpic(int selected, vector pos, float a) w_glock18_hudpic(int selected, vector pos, float a)

View file

@ -62,7 +62,6 @@ weapondata_basic_t weapon_karate =
void void
w_karate_precache(void) w_karate_precache(void)
{ {

View file

@ -53,9 +53,6 @@ weapondata_melee_t weapon_katana =
void void
w_katana_precache(void) w_katana_precache(void)
{ {