From d674fa4c14460f57fd79d3a81c89c03edb6179a9 Mon Sep 17 00:00:00 2001 From: Chris Dawalt Date: Fri, 27 Aug 2021 05:14:31 -0400 Subject: [PATCH] default.cfg overhaul, TS view offset restore, robust against vid_restart, minor cleanup --- src/client/cmds.qc | 32 ++-- src/client/defs.h | 9 +- src/client/game_event.qc | 3 + src/client/init.qc | 58 ++++-- src/client/inventory_logic_draw.qc | 20 +- src/client/precache.qc | 9 +- src/client/seatlocal.h | 13 +- src/client/ui.h | 2 + src/client/ui.qc | 23 ++- src/client/ui_buymenu.qc | 28 ++- src/client/ui_eventgrabber.qc | 10 +- src/client/vguiobjects.qc | 4 +- src/client/view.qc | 27 ++- src/server/defs.h | 7 +- src/server/gamerules.qc | 4 +- src/server/gamerules_multiplayer.qc | 5 +- src/server/init.qc | 8 +- src/shared/defs.h | 5 + src/shared/event_custom.qc | 61 +++++- src/shared/event_enum.h | 1 + src/shared/fx_ts_explosion_grenade.qc | 2 +- src/shared/input.qc | 53 +++++- src/shared/player.h | 8 +- src/shared/player.qc | 43 ++++- src/shared/pmove.qc | 23 +-- src/shared/precache.qc | 5 +- src/shared/util.qc | 8 +- src/shared/weapons.h | 2 +- src/shared/weapons.qc | 259 ++++++++++++++------------ src/shared/weapons/weapon_karate.qc | 2 +- zpak001.pk3dir/default.cfg | 200 ++++++++++++-------- 31 files changed, 589 insertions(+), 345 deletions(-) diff --git a/src/client/cmds.qc b/src/client/cmds.qc index 6c14043..d8d57e4 100644 --- a/src/client/cmds.qc +++ b/src/client/cmds.qc @@ -23,39 +23,40 @@ ClientGame_ConsoleCommand(void) switch(argv(0)) { - //TAGGG - is that ok? - case "+speedcustom": + case "+speed": pSeatLocal->m_iInputSpeed = TRUE; break; - case "-speedcustom": + case "-speed": pSeatLocal->m_iInputSpeed = FALSE; break; - //TAGGG - NEW ONES case "getorigin": sendevent("TS_Debug_getOrigin", ""); - break; + break; case "getangle": sendevent("TS_Debug_getAngle", ""); - break; + break; case "firemode": TS_playerChangeFiremode(); - break; + //pSeatLocal->m_bFireModeFreshPress = TRUE; + break; case "useitems": TS_playerUseItems(); - break; + //pSeatLocal->m_bUseItemsFreshPress = TRUE; + //pSeatLocal->m_bUseItems = TRUE; + break; case "usepowerup": TS_playerUsePowerup(); - break; + break; // I think the plus is good here then? // ...wait, not continuously reacted to in original TS. I have no idea. // Oh well, catch the - anyway too to stop an annoying printout about that command being missing (release) case "+alt1": TS_playerCallAlt1(); - break; + break; case "-alt1": - break; + break; //TAGGG - TODO: low priority. // Let holding down the coldcock key (C by default) continuously use it, just like // holding down primary fire to continuously fire. Something about setting a var @@ -64,10 +65,10 @@ ClientGame_ConsoleCommand(void) case "+alt2": TS_playerCallAlt2(); //pSeat->m_iInputAlt2 = TRUE; - break; + break; case "-alt2": //pSeat->m_iInputAlt2 = FALSE; - break; + break; case "dev_testorbituary": //TAGGG - CRITICAL. Orbituary stuff... @@ -95,7 +96,7 @@ ClientGame_ConsoleCommand(void) printfline("CMD: BUY COMMAND RECEIVED! Should I react? %s (1=yes) : %d", getplayerkeyvalue( player_localnum, "*spec" ), pl.iState); - // Should this use a "pl.iState != PLAYER_STATE::SPAWNED" check instead? + // Is there any reason to prefer a player key value or iState check? //if(getplayerkeyvalue( player_localnum, "*spec" ) != "0"){ if(pl.iState != PLAYER_STATE::SPAWNED){ //we can show it! @@ -104,6 +105,7 @@ ClientGame_ConsoleCommand(void) break; case "chooseteam": + // TODO. break; @@ -116,7 +118,7 @@ ClientGame_ConsoleCommand(void) break; - default: + default: return (0); } return (1); diff --git a/src/client/defs.h b/src/client/defs.h index 027efe6..35d7e3d 100644 --- a/src/client/defs.h +++ b/src/client/defs.h @@ -46,10 +46,13 @@ var float FONT_ARIAL_SCOPEMAG; // Be sure to keep this up to date with the font FONT_ARIAL_STD as it's loaded in // ui.qc, notice this is always one less than the actual expected corresponding font. +// Except vButtonFontSize it is 2 less in width, I think it would be better to make +// the buy buttons a little wider though. // TODO - a some things may be unused at this point, check. -const vector vButtonFontSize = [13, 13, 0]; -const vector vFontSizeNumSlash = [15, 15, 0]; -const vector vFontArialScopeMag = [16, 16, 0]; +const vector vButtonFontSize = [14, 15, 0]; +const vector vHUDFontSize = [15, 15, 0]; +const vector vFontSizeNumSlash = [17, 17, 0]; +const vector vFontArialScopeMag = [18, 18, 0]; const vector vButtonSizStandard = [127, 19, 0]; diff --git a/src/client/game_event.qc b/src/client/game_event.qc index 3b94c9e..e9173ab 100644 --- a/src/client/game_event.qc +++ b/src/client/game_event.qc @@ -203,6 +203,9 @@ ClientGame_EventParse(float fHeader) EV_TS_playerDropWeapon(pl); }break; */ + case EVENT_TS::USEITEMS_CHANGE_CALLBACK:{ + pl.clientUseItemsCallback(); + }break; case EVENT_TS::TEST:{ //printfline("EVENT_TS::TEST HAPPENED"); //clearscene(); diff --git a/src/client/init.qc b/src/client/init.qc index c21acef..1f8512f 100644 --- a/src/client/init.qc +++ b/src/client/init.qc @@ -15,8 +15,7 @@ */ -// should this even be defaulted? -var float numclientseats_highest = 0; +var float numclientseats_highest; /* ================= @@ -28,11 +27,18 @@ Comparable to worldspawn in SSQC in that it's mostly used for precaches void ClientGame_Init(float apilevel, string enginename, float engineversion) { + numclientseats_highest = 0; + int s; printfline("---ClientGame_Init---"); - printf("What is numclientseats? %d\n", numclientseats); + + // wait, numclientseats isn't even known right at startup? Just 0 here? + // And the RendererRestart event further down also isn't called after the + // first client is added so it sees 0 too? + // I GIVE UP just do this for all possible g_seats and be done with it + // !!! // Use g_seats.length instead to fill all seats, even those not intended for use, or // in case of a change of numclientseats (was 1, but someone joins for multiplayer on @@ -45,11 +51,11 @@ ClientGame_Init(float apilevel, string enginename, float engineversion) // Moved to our ClientGame_RendererRestart for safety, change how this works if my // understanding of pSeat isn't quite there. - // safety - if(numclientseats > g_seats.length){numclientseats = g_seats.length;} - for(s = numclientseats-1; s >= 0; s--){ + //if(numclientseats > g_seats.length){numclientseats = g_seats.length;} + for(s = 0; s < g_seats.length; s++){ // < numclientseats pSeat = &g_seats[s]; pSeatLocal = &g_seatslocal[s]; + pSeatLocal_init(); ClientInfo_init(&pSeatLocal->m_clientinfo); } @@ -126,9 +132,9 @@ ClientGame_Init(float apilevel, string enginename, float engineversion) // BLABLABLA. "arialbd.ttf" without the "gfx/shell/" in front is searching the OS, // not your own gamemod or platform directories (which ought to have it in gfx/shell). // Forget it! I'm using our own platform supplied one, "gfx/shell/" it is. - FONT_ARIAL_STD = loadfont( "", "gfx/shell/arialbd.ttf", "14", -1 ); - FONT_ARIAL_NUMSLASH = loadfont( "", "gfx/shell/arialbd.ttf", "16", -1 ); - FONT_ARIAL_SCOPEMAG = loadfont( "", "gfx/shell/arialbd.ttf", "17", -1 ); + FONT_ARIAL_STD = loadfont( "", "gfx/shell/arialbd.ttf", "16", -1 ); + FONT_ARIAL_NUMSLASH = loadfont( "", "gfx/shell/arialbd.ttf", "17", -1 ); + FONT_ARIAL_SCOPEMAG = loadfont( "", "gfx/shell/arialbd.ttf", "18", -1 ); // safe default for whatever doesn't specify it? // Beware that draw calls that don't set the drawfont will still rely @@ -163,29 +169,55 @@ Custom_ViewInit(void){ } } + void ClientGame_RendererRestart(string rstr) { int s; printfline("---ClientGame_RendererRestart---"); - printf("What is numclientseats? %d\n", numclientseats); + //printf("What is numclientseats? %d highest:%d\n", numclientseats, numclientseats_highest); - // safety + // NEVERMIND. + /* if(numclientseats > g_seats.length){numclientseats = g_seats.length;} - - // Did numclientseats change, and it's higher than the previous choice? // Just init the additional ones then. if(numclientseats > numclientseats_highest){ + printfline("---Need to init new pseats? %d vs. %d", numclientseats, numclientseats_highest); for(s = numclientseats-1; s >= numclientseats_highest; s--){ pSeat = &g_seats[s]; pSeatLocal = &g_seatslocal[s]; + pSeatLocal_init(); ClientInfo_init(&pSeatLocal->m_clientinfo); } + printfline("numclientseats_highest D SET TO %d", numclientseats); numclientseats_highest = numclientseats; } + */ + + + // this is ok. + // Mainly, some things about viewmodels need to be refreshed on vid_restart, + // like submodel choice (silencer, scope, laser/flashlight, bloodied melee weapons). + // If anything else should be handled, in there it goes + for(s = 0; s < numclientseats; s++){ // < numclientseats + pSeat = &g_seats[s]; + pSeatLocal = &g_seatslocal[s]; + player pl = (player)pSeat->m_ePlayer; + + //pSeatLocal->m_bRecentRendererRestart = TRUE; + + // TODO - if this becomes a lot of lines, go to a method + // "pSeatLocal_RendererRestart" instead + if(pl != NULL){ + pl.prev_iForceBodygroup1Submodel = 0; + TS_View_SetViewModelFromStats(); + } + } + + Custom_ViewInit(); // Hook into precache.qc diff --git a/src/client/inventory_logic_draw.qc b/src/client/inventory_logic_draw.qc index 12681ed..e9f4a1a 100644 --- a/src/client/inventory_logic_draw.qc +++ b/src/client/inventory_logic_draw.qc @@ -8,7 +8,7 @@ drawWeaponOptionBar( ) { drawfill( arg_vDrawOrigin, [128, 19], clrPaleBlue, arg_opac - 0.55f ); - Gfx_Text( [arg_vDrawOrigin.x + 2, arg_vDrawOrigin.y + 4], arg_sOptionName, vButtonFontSize, clrPaleBlue, 0.90f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [arg_vDrawOrigin.x + 2, arg_vDrawOrigin.y + 4], arg_sOptionName, vHUDFontSize, clrPaleBlue, 0.90f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); vector tempVec = [arg_vDrawOrigin.x + 112, arg_vDrawOrigin.y + 1]; @@ -33,12 +33,12 @@ drawPlayerInventory_TopBar(int arg_iSlotSelected, BOOL arg_fBuyMode) // TODO - fetch these globally if(!getstati(STAT_RULE_MONEYALLOWED)){ - Gfx_Text( [8, 8 + 2], sprintf("Order Value: %i", pSeatLocal->m_clientinfo.weaponconfig_temp.iTotalPrice), vButtonFontSize, clrPaleBlue, 0.93f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [8, 8 + 2], sprintf("Order Value: %i", pSeatLocal->m_clientinfo.weaponconfig_temp.iTotalPrice), vHUDFontSize, clrPaleBlue, 0.93f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); }else{ - Gfx_Text( [8, 8 + 2], sprintf("Cash: %i (Order Cost: %i)", getstati(STAT_MONEY), pSeatLocal->m_clientinfo.weaponconfig_temp.iTotalPrice), vButtonFontSize, clrPaleBlue, 0.93f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [8, 8 + 2], sprintf("Cash: %i (Order Cost: %i)", getstati(STAT_MONEY), pSeatLocal->m_clientinfo.weaponconfig_temp.iTotalPrice), vHUDFontSize, clrPaleBlue, 0.93f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); } - Gfx_Text( [8 + 128*2, 8 + 2], sprintf("Weight Slots: %i / %i", pSeatLocal->m_clientinfo.weaponconfig_temp.iTotalSlots, getstati(STAT_RULE_MAXWEIGHTSLOTS)), vButtonFontSize, clrPaleBlue, 0.93f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [8 + 128*2, 8 + 2], sprintf("Weight Slots: %i / %i", pSeatLocal->m_clientinfo.weaponconfig_temp.iTotalSlots, getstati(STAT_RULE_MAXWEIGHTSLOTS)), vHUDFontSize, clrPaleBlue, 0.93f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); }else{ vWeaponsBar_drawBase = [8, 8]; } @@ -283,7 +283,7 @@ drawPlayerInventory_place // Then just make arg_sSelectedWeaponDisplayName into arg_fIsSelected. fOpac = 1.00f; - Gfx_Text( [vDrawPos.x + 128, vDrawPos.y + 4], arg_sSelectedWeaponDisplayName, vButtonFontSize, clrPaleBlue, 0.95f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vDrawPos.x + 128, vDrawPos.y + 4], arg_sSelectedWeaponDisplayName, vHUDFontSize, clrPaleBlue, 0.95f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); }else{ if(arg_fBuyMode){ // always bright? @@ -332,7 +332,7 @@ drawPlayerInventory_place if(upgradeString != ""){ //if there is anything to draw... - Gfx_Text( [vDrawPos.x + 3, vDrawPos.y + 3 + 16], sprintf("(%s)", upgradeString), vButtonFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vDrawPos.x + 3, vDrawPos.y + 3 + 16], sprintf("(%s)", upgradeString), vHUDFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); } }//buymodecheck FOR drawing the upgrade options short-hand near the weapon. @@ -379,7 +379,7 @@ drawPlayerStats(void) string myTeamName = "team name here"; // like pointer vars setup in server/main.c to refer to each index? It might just work. drawfill( [drawerX, drawerY - 20], [127, 19], clrPaleBlue, 0.96f - 0.60f ); - Gfx_Text( [drawerX + 2, drawerY - 20 + 4], myTeamName, vButtonFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [drawerX + 2, drawerY - 20 + 4], myTeamName, vHUDFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); //} @@ -426,12 +426,12 @@ drawPlayerStats(void) if(getstati(STAT_RULE_MONEYALLOWED)){ drawfill( [drawerX, drawerY], [127, 19], clrPaleBlue, 0.96f - 0.60f ); offsetRight = drawSpriteNumber(ary_LCD_numberSet, drawerX + 8, drawerY + 2, getstati(STAT_MONEY), 8, BITS_DIGITOPT_NONE, clrPaleBlue, 0.92f); - Gfx_Text( [drawerX + 8 + offsetRight + 6, drawerY + 4], "Credits", vButtonFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [drawerX + 8 + offsetRight + 6, drawerY + 4], "Credits", vHUDFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); }//money allowed check drawfill( [drawerX, drawerY + 20], [127, 19], clrPaleBlue, 0.96f - 0.60f ); offsetRight = drawSpriteNumber(ary_LCD_numberSet, drawerX + 8, drawerY + 20 + 2, getstati(STAT_RULE_MAXWEIGHTSLOTS) - pl.iTotalSlots, 8, BITS_DIGITOPT_NONE, clrPaleBlue, 0.92f); - Gfx_Text( [drawerX + 8 + offsetRight + 6, drawerY + 20 + 4], "free slots", vButtonFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [drawerX + 8 + offsetRight + 6, drawerY + 20 + 4], "free slots", vHUDFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); }// drawPlayerStats @@ -468,7 +468,7 @@ drawTimer(void) } drawSpriteNumber(ary_LCD_numberSet, drawerX, drawerY, iMinutes, 3, BITS_DIGITOPT_DEFAULT, clrDraw, fOpac); - Gfx_Text( [drawerX + numberFontWidth*3 + 4, drawerY + 1], ":", vFontSizeNumSlash, clrDraw, fOpac, DRAWFLAG_ADDITIVE, FONT_ARIAL_NUMSLASH ); + Gfx_Text( [drawerX + numberFontWidth*3 + 3, drawerY + 0], ":", vFontSizeNumSlash, clrDraw, fOpac, DRAWFLAG_ADDITIVE, FONT_ARIAL_NUMSLASH ); drawSpriteNumber(ary_LCD_numberSet, drawerX + numberFontWidth*4, drawerY, iSeconds, 2, BITS_DIGITOPT_FILLER0, clrDraw, fOpac); }// drawTimer diff --git a/src/client/precache.qc b/src/client/precache.qc index a45e248..4802506 100644 --- a/src/client/precache.qc +++ b/src/client/precache.qc @@ -21,13 +21,20 @@ void ClientGame_Precache(void){ FX_Impact_Init(); //////////////////////////////////////////////////////////////////////////////////// - // NEW CTSShellEject::precache(); FX_TS_Explosion_Grenade_Init(); FX_Impact_Melee_Init(); MuzzleFlash_precache(); + // from Valve + // ALSO - important note. If this is precached serverside - at all, exclusively + // or in addition to this - this will still show up clientside at first. + // However, any "vid_restart" (or simialr reason to restart the window I assume) + // will make this model disappear (go checkerboard). + // And yes, even SharedGame_Precache is called by RendererRestart (in fact the + // very call is above in here, and ClientGame_Preche is called by RendererRestart). + precache_model("sprites/glow02.spr"); precache_sound("weapons/draw.wav"); diff --git a/src/client/seatlocal.h b/src/client/seatlocal.h index 104713f..9f214e0 100644 --- a/src/client/seatlocal.h +++ b/src/client/seatlocal.h @@ -31,22 +31,27 @@ struct float m_flHUDWeaponSelectTime; - //TAGGG - assuming this is a fine place to put this // It's the slower movement from holding shift down. int m_iInputSpeed; // Keeping for now, remove later float m_flUI_Display; - // CRITICAL: - // Should these be per pSeat instead? Unsure if that makes sense. float m_inputKeyTapped; float m_inputKeyDown; float m_inputMouseClicked; ClientInfo_t m_clientinfo; - float flBlockSpawnTime; + float m_flBlockSpawnInputTime; + + BOOL m_bUseItemsFreshPress; + // How many times has the use button been pressed before getting a server callback? + // Also need to handle determining what in a server callback lets this be reduced + int m_iUseItemsLatencyPresses; + + BOOL m_bUseItems; + } g_seatslocal[4], *pSeatLocal; diff --git a/src/client/ui.h b/src/client/ui.h index 712cc9a..62baab6 100644 --- a/src/client/ui.h +++ b/src/client/ui.h @@ -48,6 +48,8 @@ void UI_Draw(void); void UI_MouseClick(void); void UI_KeyDown(void); void UI_ChangeScreen(UI_SCREEN fNewScreenID); +void UI_HideCurrentScreen(void); + BOOL UI_CheckMouse(vector vPos, vector vReg); void UI_determineDrawGlobals(void); diff --git a/src/client/ui.qc b/src/client/ui.qc index 30c58ae..427f36b 100644 --- a/src/client/ui.qc +++ b/src/client/ui.qc @@ -82,16 +82,11 @@ UI_ChangeScreen(UI_SCREEN arg_NewScreenID) g_UI_queueInit = FALSE; if( - pSeatLocal->m_flUI_Display != UI_SCREEN::NONE && arg_NewScreenID != pSeatLocal->m_flUI_Display ){ // First, check the existing m_flUI_Display. If valid, call funHide for it // (does not apply to setting the screen to the same choice) - if( - ary_UI_Screen[pSeatLocal->m_flUI_Display-1].funHide != NULL - ){ - ary_UI_Screen[pSeatLocal->m_flUI_Display-1].funHide(); - } + UI_HideCurrentScreen(); } pSeatLocal->m_flUI_Display = (float)arg_NewScreenID; @@ -113,7 +108,7 @@ UI_ChangeScreen(UI_SCREEN arg_NewScreenID) // Questionably effective but better than nothing maybe. player pl = (player)pSeat->m_ePlayer; pl.gflags |= GF_SEMI_TOGGLED; - pSeatLocal->flBlockSpawnTime = time + 0.20; + pSeatLocal->m_flBlockSpawnInputTime = time + 0.13; return; } @@ -139,6 +134,18 @@ UI_ChangeScreen(UI_SCREEN arg_NewScreenID) } +// call the "funHide" method of the currently visible screen if it exists. +void +UI_HideCurrentScreen(void){ + + if(pSeatLocal->m_flUI_Display != UI_SCREEN::NONE){ + if(ary_UI_Screen[pSeatLocal->m_flUI_Display-1].funHide != NULL){ + ary_UI_Screen[pSeatLocal->m_flUI_Display-1].funHide(); + } + } +} + + // helper method to load the MoTD text from the server into this client's memory void UI_loadMOTD(void){ @@ -253,7 +260,7 @@ UI_determineDrawGlobals(void){ // font script file most likely, see examples in other codebaes. //Font_Load("folder/some_file.ext", &FONT_ARIAL_TITLE_TEST); - // This works, but not completely. Want some things to have differnet fonts, + // This works, but not completely. Want some things to have different fonts, // like the _title and normal variants of FONT_ARIAL above. /* Font_Load_Easy("arial", (int)font_arial_title_size, FONT_ARIAL_TITLE_EX); diff --git a/src/client/ui_buymenu.qc b/src/client/ui_buymenu.qc index 1018280..19cbd89 100644 --- a/src/client/ui_buymenu.qc +++ b/src/client/ui_buymenu.qc @@ -99,6 +99,10 @@ typedef struct CBuyMenu_BasicButton_s{ } CBuyMenu_BasicButton; +// "instantiate" methods are like imaginary constructors that aren't chained since they set +// the vtable to be for the child class of the struct-instance only. +// "init" methods called after are chained to get parent vars initialized too. +// "create" sets the button up with a lot of specifics at a time. void CBuyMenu_BasicButton_instantiate(CBuyMenu_BasicButton* arg_this); void CBuyMenu_BasicButton_init(CBuyMenu_BasicButton* arg_this); @@ -556,6 +560,7 @@ CBuyMenu_WeaponButton_funOnShow_Base(CBuyMenu_WeaponButton* arg_this) } } +// lots of custom behavior needed void CBuyMenu_WeaponButton_funOnRender_Base ( @@ -565,8 +570,7 @@ CBuyMenu_WeaponButton_funOnRender_Base ) { CBuyMenu_BasicButton_funOnRender_Base( - (CBuyMenu_BasicButton*)arg_this, arg_suggestedDrawPos, arg_iLayer, - arg_iButtonRow, arg_fIsSelected + (CBuyMenu_BasicButton*)arg_this, arg_suggestedDrawPos, arg_iLayer, arg_iButtonRow, arg_fIsSelected ); // I want to draw my sWeaponImagePath above myself. @@ -612,7 +616,7 @@ CBuyMenu_RemoveWeaponButton_init(CBuyMenu_RemoveWeaponButton* arg_this) - +// Now with the BuyMenu button implementations over, onto the vtables: void CBuyMenu_BasicButton_vtable[] = { (void)CBuyMenu_BasicButton_funOnClick_Base, @@ -631,6 +635,7 @@ void CBuyMenu_RemoveWeaponButton_vtable[] = { }; +// Be aware of the vtable for this class/subclass void CBuyMenu_BasicButton_instantiate(CBuyMenu_BasicButton* arg_this) { @@ -655,6 +660,9 @@ typedef void(CBuyMenu_BasicButton*) CBuyMenu_BasicButton_funOnClick_Base_type; typedef void(CBuyMenu_BasicButton*) CBuyMenu_BasicButton_funOnShow_Base_type; typedef void(CBuyMenu_BasicButton*, vector, int, int, BOOL) CBuyMenu_BasicButton_funOnRender_Base_type; +// And finally, make a virtual call. These use the name of the base "BasicButton" class but +// still end up calling the most specific method given the actual type of the instance +// (WeaponButton's call WeaponButton methods when present). void CBuyMenu_BasicButton_funOnClick_Base_vcall(CBuyMenu_BasicButton* arg_this){ void* method_raw = &arg_this->my_vtable[0]; CBuyMenu_BasicButton_funOnClick_Base_type myMethod = *(((CBuyMenu_BasicButton_funOnClick_Base_type*) method_raw)); @@ -669,6 +677,10 @@ void CBuyMenu_BasicButton_funOnRender_Base_vcall(CBuyMenu_BasicButton* arg_this, void* method_raw = &arg_this->my_vtable[2]; CBuyMenu_BasicButton_funOnRender_Base_type myMethod = *(((CBuyMenu_BasicButton_funOnRender_Base_type*) method_raw)); myMethod(arg_this, arg_suggestedDrawPos, arg_iLayer, arg_iButtonRow, arg_fIsSelected); + + // WRONG WAY! Do a straight call to BasicButton instead of the above to see + // WeaponButtons lose custom weapon-icon drawing + //CBuyMenu_BasicButton_funOnRender_Base(arg_this, arg_suggestedDrawPos, arg_iLayer, arg_iButtonRow, arg_fIsSelected); } @@ -1059,22 +1071,19 @@ buymenu_btn_RemoveItem_clicked(CBuyMenu_BasicButton* arg_this) weaponconfig_weapon_t* thisWeapo = &pSeatLocal->m_clientinfo.weaponconfig_temp.ary_myWeapons[i]; weapondata_basic_t* basicPointer = (weapondata_basic_t*) ary_weaponData[thisWeapo->weaponID]; - weapondata_basic_t basicRef = *(basicPointer); string buttonDisplayText; int hotKeyCode; if(i < 9) { // for i choices 0 through 8, use "i+1" to give 1-9. - buttonDisplayText = sprintf("%i: %s", (i+1i), basicRef.sDisplayName); + buttonDisplayText = sprintf("%i: %s", (i+1i), basicPointer->sDisplayName); hotKeyCode = 48+(i+1); // '0' + (i+1) } else if(i < 9+26) { - //now pick letters of the alphabet for the rest. - //uhhh. I don't know how to work with characters as a type or with ASCII values, so - //we'll just use this array of letters in the alphabet. - buttonDisplayText = sprintf("%s: %s", chr2str((float)i+65), basicRef.sDisplayName); + // now pick letters of the alphabet for the rest. + buttonDisplayText = sprintf("%s: %s", chr2str((float)i+65), basicPointer->sDisplayName); hotKeyCode = 97+(i-9); // 'a' + (i-9) }else{ // surpass that range? Not possible! @@ -1683,7 +1692,6 @@ UI_BuyMenu_Draw(void) backButtonRow = ary_layerFirstButton_softLength; } - //buymenu_btn_Back.funOnRender_Base(vBtnPos, i, backButtonRow, fIsSelected); CBuyMenu_BasicButton_funOnRender_Base_vcall(&buymenu_btn_Back, vBtnPos, i, backButtonRow, fIsSelected); vBtnPos.y += (vButtonSizStandard.y + 1); } diff --git a/src/client/ui_eventgrabber.qc b/src/client/ui_eventgrabber.qc index a7aa24a..9c7c452 100644 --- a/src/client/ui_eventgrabber.qc +++ b/src/client/ui_eventgrabber.qc @@ -39,14 +39,13 @@ CUIEventGrabber::Draw(void) void CUIEventGrabber::Input(float flEVType, float flKey, float flChar, float flDevID) { - // no need to do this. //g_vguiWidgetCount++; switch (flEVType) { case IE_KEYDOWN: - printf("CUIEventGrabber::Input %d time:%.2f\n", flKey, time); + //printf("CUIEventGrabber::Input %d time:%.2f\n", flKey, time); pSeatLocal->m_inputKeyDown = flKey; pSeatLocal->m_inputKeyTapped = flKey; //lasts only this frame @@ -78,9 +77,8 @@ void gFun_UI_EventGrabber_Initialize(void){ g_UI_EventGrabber = spawn(CUIEventGrabber); g_uiDesktop.Add(g_UI_EventGrabber); - printfline("gFun_UI_EventGrabber_Initialize: Added to VGUI. Right?"); - - printfline("(g_vguiWidgetCount: %i)", g_vguiWidgetCount); + //printfline("gFun_UI_EventGrabber_Initialize: Added to VGUI. Right?"); + //printfline("(g_vguiWidgetCount: %i)", g_vguiWidgetCount); // make it "visible", or rather, "active" for grabbing input events? @@ -101,6 +99,6 @@ void gFun_UI_EventGrabber_Hide(void){ void gFun_UI_EventGrabber_DebugMethod(void){ - printfline("HOW IS EVENGRAB DOIN %i %i", g_UI_EventGrabber.m_iFlags, (g_UI_EventGrabber.m_iFlags & 1) ); + printfline("HOW IS EVENGRAB DOIN %i %i", g_UI_EventGrabber.m_iFlags, (g_UI_EventGrabber.m_iFlags & 1) ); } diff --git a/src/client/vguiobjects.qc b/src/client/vguiobjects.qc index 6874e49..3e61a60 100644 --- a/src/client/vguiobjects.qc +++ b/src/client/vguiobjects.qc @@ -58,11 +58,11 @@ float VGUI_Button( string sLabel, vector vPosition, vector vSize) { if ( UI_CheckMouse( vPosition, vSize ) ) { - Gfx_Text( vLabelPos, sLabel, vButtonFontSize, g_UI_Color, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( vLabelPos, sLabel, vHUDFontSize, g_UI_Color, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); drawfill( vLabelPos + '0 10 0', [ stringwidth( sLabel, TRUE, '12 12' ), 1], g_UI_Color, VGUI_WINDOW_FGALPHA ); return TRUE; } else { - Gfx_Text( vLabelPos, sLabel, vButtonFontSize, g_UI_Color * 0.8, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( vLabelPos, sLabel, vHUDFontSize, g_UI_Color * 0.8, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); } return FALSE; diff --git a/src/client/view.qc b/src/client/view.qc index 08081a8..0e9b406 100644 --- a/src/client/view.qc +++ b/src/client/view.qc @@ -85,7 +85,7 @@ TS_View_SetViewModelFromStats(void) weapondata_basic_t* basicP; weapondynamic_t dynaRef; - printfline("TS_View_SetViewModelFromStats: I happen? activeweap:%d", pl.activeweapon); + //printfline("TS_View_SetViewModelFromStats: I happen? activeweap:%d", pl.activeweapon); basicP = pl.getEquippedWeaponData(); dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex]; @@ -346,6 +346,13 @@ TS_View_DrawCustom(player pl){ // another helper method // Draw the lasersight, and flashlight effects + +// IDEA: any way to give the effect of RF_DEPTHHACK (always draw on top of the map +// so that flashlight muzzle glow-effects don't clip through the map), or the RF_ADDITIVE +// that muzzle flashes use for being an effect in general? Probably unnecessary anyway. +// Flashlight glow effects do clip through the map in original TS so not a huge priority anyway, +// and showing up in front of the weapon would not be amazing. +// Effects like muzzleflashes don't even do anything special with depth-hackery so, eh. void TS_View_DrawExtraEffects(player pl, int thirdperson) { @@ -399,7 +406,7 @@ TS_View_DrawExtraEffects(player pl, int thirdperson) //for glock it is 40. //vector gunpos = gettaginfo(pSeat->eViewModel, 33); - float daDrawAlphahz = 1.0; + float drawAlpha = 1.0; const vector lasColor = [1.0, 0, 0]; const vector fsize = [2,2]; const vector fsizeDot = [18,18]; @@ -619,10 +626,10 @@ TS_View_DrawExtraEffects(player pl, int thirdperson) //makevectors(view_angles); //??? it seems we do not need this perhaps... // IN SHORT, we're riding the prior "makevectors(angGun);". R_BeginPolygon("sprites/laserbeam.spr_0.tga", 1, 0); - R_PolygonVertex(gunpos + v_right * fsize[0] - v_up * fsize[1], [1,1], lasColor, daDrawAlphahz); - R_PolygonVertex(gunpos - v_right * fsize[0] - v_up * fsize[1], [0,1], lasColor, daDrawAlphahz); - R_PolygonVertex(trace_endpos - v_right * fsize[0] + v_up * fsize[1], [0,0], lasColor, daDrawAlphahz); - R_PolygonVertex(trace_endpos + v_right * fsize[0] + v_up * fsize[1], [1,0], lasColor, daDrawAlphahz); + R_PolygonVertex(gunpos + v_right * fsize[0] - v_up * fsize[1], [1,1], lasColor, drawAlpha); + R_PolygonVertex(gunpos - v_right * fsize[0] - v_up * fsize[1], [0,1], lasColor, drawAlpha); + R_PolygonVertex(trace_endpos - v_right * fsize[0] + v_up * fsize[1], [0,0], lasColor, drawAlpha); + R_PolygonVertex(trace_endpos + v_right * fsize[0] + v_up * fsize[1], [1,0], lasColor, drawAlpha); R_EndPolygon(); } @@ -697,10 +704,10 @@ TS_View_DrawExtraEffects(player pl, int thirdperson) // IN SHORT, we're riding the prior "makevectors(angGun2);". R_BeginPolygon("sprites/laserbeam.spr_0.tga", 1, 0); - R_PolygonVertex(gunpos2 + v_right * fsize[0] - v_up * fsize[1], [1,1], lasColor, daDrawAlphahz); - R_PolygonVertex(gunpos2 - v_right * fsize[0] - v_up * fsize[1], [0,1], lasColor, daDrawAlphahz); - R_PolygonVertex(trace_endpos - v_right * fsize[0] + v_up * fsize[1], [0,0], lasColor, daDrawAlphahz); - R_PolygonVertex(trace_endpos + v_right * fsize[0] + v_up * fsize[1], [1,0], lasColor, daDrawAlphahz); + R_PolygonVertex(gunpos2 + v_right * fsize[0] - v_up * fsize[1], [1,1], lasColor, drawAlpha); + R_PolygonVertex(gunpos2 - v_right * fsize[0] - v_up * fsize[1], [0,1], lasColor, drawAlpha); + R_PolygonVertex(trace_endpos - v_right * fsize[0] + v_up * fsize[1], [0,0], lasColor, drawAlpha); + R_PolygonVertex(trace_endpos + v_right * fsize[0] + v_up * fsize[1], [1,0], lasColor, drawAlpha); R_EndPolygon(); } diff --git a/src/server/defs.h b/src/server/defs.h index 6c5c30f..b8f5a10 100644 --- a/src/server/defs.h +++ b/src/server/defs.h @@ -26,17 +26,14 @@ // Server cvars var int autocvar_mp_winlimit = 0; var int autocvar_mp_halftime = 0; -var int autocvar_mp_startmoney = 30000; //was 800 -//var float autocvar_mp_buytime = 90; +var int autocvar_mp_startmoney = 30000;// was 800 +var int autocvar_mp_maxmoney = 99999; // was 16000. var float autocvar_mp_freezetime = 6; var float autocvar_mp_roundtime = 5; var float autocvar_mp_timelimit = 60; var string autocvar_motdfile = "motd.txt"; var int autocvar_mp_friendlyfire = FALSE; -//TAGGG - are we even using all these? -var int autocvar_fcs_swapteams = FALSE; /* Swaps spawnpoints */ -var int autocvar_fcs_maxmoney = 99999; //TAGG - was 16000. var int autocvar_debug_spawnpointforced = 0; diff --git a/src/server/gamerules.qc b/src/server/gamerules.qc index 7c27c2f..95feabe 100644 --- a/src/server/gamerules.qc +++ b/src/server/gamerules.qc @@ -251,8 +251,8 @@ Money_AddMoney(player pl, int iMoneyValue) //dprint(sprintf("^2Money_AddMoney^7: giving %s $%i\n", pl.netname, iMoneyValue)); pl.money += iMoneyValue; - if (pl.money > autocvar_fcs_maxmoney) { - pl.money = autocvar_fcs_maxmoney; + if (pl.money > autocvar_mp_maxmoney) { + pl.money = autocvar_mp_maxmoney; } if (pl.money < 0) { diff --git a/src/server/gamerules_multiplayer.qc b/src/server/gamerules_multiplayer.qc index a15d225..3e36f15 100644 --- a/src/server/gamerules_multiplayer.qc +++ b/src/server/gamerules_multiplayer.qc @@ -90,7 +90,8 @@ TSMultiplayerRules::RespawnMain(void){ // respawn only breakables every so often. void TSMultiplayerRules::RespawnRoutine(void){ - printfline("TSMultiplayerRules::TimerUpdate - I HAVE RESPAWNED THE BREAKABLES. time:%d : starttime:%d : nextrespawntime:%d", time, global_gameStartTime, global_nextBreakableRespawn); + // Thanks, you can stop now + //printfline("TSMultiplayerRules::TimerUpdate - I HAVE RESPAWNED THE BREAKABLES. time:%d : starttime:%d : nextrespawntime:%d", time, global_gameStartTime, global_nextBreakableRespawn); //for (entity a = world; (a = findfloat(a, ::gflags, GF_CANRESPAWN));) { for (entity a = world; (a = findfloat(a, ::identity, IDENTITY_CANRESPAWN));) { @@ -316,7 +317,7 @@ TSMultiplayerRules::PlayerDeath(base_player pp) }// excess negative health gib check - printfline("setInventoryEquippedIndex Flag Z"); + //printfline("setInventoryEquippedIndex Flag Z"); TS_resetViewModel(pl); pl.setInventoryEquippedIndex(-1); diff --git a/src/server/init.qc b/src/server/init.qc index 69fe5a3..bebaf47 100644 --- a/src/server/init.qc +++ b/src/server/init.qc @@ -258,13 +258,9 @@ Game_Worldspawn(void) error("[MAPCYCLE] Loading failed.\n"); } */ - - // Let's make our version information clear - localcmd(sprintf("serverinfo fcs_ver %s\n", __DATE__)); - - + /*Bot_Init();*/ - + //How many weight slots does this player have? //...oh wait, we already receive whatever the actual playerSlots is, even if the inventorylogic diff --git a/src/shared/defs.h b/src/shared/defs.h index 36caab0..2b31a3f 100644 --- a/src/shared/defs.h +++ b/src/shared/defs.h @@ -14,6 +14,11 @@ enum TS_Team{ TEAM_4 = 3 }; + +// Uhh. Please work? +#define INPUT_BUTTON9 0x00000100 + + #ifdef SERVER //server CVar var float autocvar_weaponstay = 60; //default originally 15 diff --git a/src/shared/event_custom.qc b/src/shared/event_custom.qc index ac14e84..2222d1c 100644 --- a/src/shared/event_custom.qc +++ b/src/shared/event_custom.qc @@ -602,7 +602,15 @@ _TS_playerChangeFiremode(void ) { // Server receives the message void CSEv_TS_playerUseItems_(void){ + player pl = (player)self; _TS_playerUseItems(); + + // Send a message back too! + WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET ); + WriteByte( MSG_MULTICAST, EVENT_TS::USEITEMS_CHANGE_CALLBACK ); + msg_entity = pl; + multicast( [0,0,0], MULTICAST_ONE ); + } #endif @@ -614,12 +622,16 @@ TS_playerUseItems(void){ if(pl.inventoryEquippedIndex == -1){ return; } + //_TS_playerUseItems(); + + #ifdef CLIENT sendevent("TS_playerUseItems", ""); // and do it my side too? _TS_playerUseItems(); #else // SHOULD NOT HAPPEN, should call the CSEv_ version instead + #endif } @@ -655,10 +667,11 @@ _TS_playerUseItems(void){ }else{ -#if defined(CLIENT_CMD_SAFEMODE) && defined(CLIENT) + +#if defined(CLIENT_CMD_SAFEMODE) // Have a much simpler version instead #ifdef CLIENT - localsound("weapons/switch.wav", CHAN_AUTO, 1.0f); + localsound("weapons/switch.wav", CHAN_AUTO, 1.0f); #endif return; #endif @@ -672,7 +685,6 @@ _TS_playerUseItems(void){ dynaRef.iBitsUpgrade_on = legalBuyOpts; } - }else{ //variable number of bits? See how many bits are on right now. if(bitCount_on == 0){ @@ -699,6 +711,7 @@ _TS_playerUseItems(void){ } + // Let's be a clientside sound only. #ifdef CLIENT localsound("weapons/switch.wav", CHAN_AUTO, 1.0f); @@ -722,16 +735,52 @@ _TS_playerUseItems(void){ }// bitcount checks - - }/// _GUN or _IRONSIGHT type checks + }// _GUN or _IRONSIGHT type checks }// weaponEquippedID check - printfline("CSEv_TS_playerUseItems_"); } +// TEST, might get abandoned +#ifdef CLIENT +void +_TS_FRESH_playerUseItems(void){ + player pl = (player)self; + + printfline("CSEv_TS_playerUseItems_"); + + sendevent("TS_playerUseItems", ""); + + + if(pl.inventoryEquippedIndex != -1){ + + weapondynamic_t dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if(dynaRef.weaponTypeID == WEAPONDATA_TYPEID_GUN || dynaRef.weaponTypeID == WEAPONDATA_TYPEID_IRONSIGHT){ + weapondata_basic_t* basicP = pl.getEquippedWeaponData(); + + + int legalBuyOpts = (dynaRef.iBitsUpgrade & (*basicP).iBitsUpgrade) & (BITMASK_WEAPONOPT_TOGGLEABLE); + int bitCount = count1Bits(legalBuyOpts, BITMASK_WEAPONOPT_TOGGLEABLE_MIN, BITMASK_WEAPONOPT_TOGGLEABLE_MAX); + + if(bitCount == 0){ + + }else{ + // Let's be a clientside sound only. +//#ifdef CLIENT + localsound("weapons/switch.wav", CHAN_AUTO, 1.0f); +//#endif + } + + }// _GUN or _IRONSIGHT type checks + }// weaponEquippedID check + +} +#endif + + #ifdef SERVER // Server receives the message diff --git a/src/shared/event_enum.h b/src/shared/event_enum.h index 57c5548..7d482c3 100644 --- a/src/shared/event_enum.h +++ b/src/shared/event_enum.h @@ -14,6 +14,7 @@ enum EVENT_TS{ TEST_CALLBACK, SOUNDPITCHED, SOUNDPITCHED_CHANNEL, + USEITEMS_CHANGE_CALLBACK, TEST, }; diff --git a/src/shared/fx_ts_explosion_grenade.qc b/src/shared/fx_ts_explosion_grenade.qc index b024025..928d7d3 100644 --- a/src/shared/fx_ts_explosion_grenade.qc +++ b/src/shared/fx_ts_explosion_grenade.qc @@ -67,7 +67,7 @@ FX_TS_Explosion_Grenade_PlaySound(entity eSelf){ // there is a command, soundlength("x") that takes a path to a .wav file I think? // Probably unnecessary - Client_ShakeOnce(eSelf.origin, 512, 1.7, 2.1, 3.4); + Client_ShakeOnce(eSelf.origin, 950, 1.7, 2.1, 3.4); float randomChoice = random(); if(randomChoice < 0.2){ diff --git a/src/shared/input.qc b/src/shared/input.qc index 2d56a5b..70dee5b 100644 --- a/src/shared/input.qc +++ b/src/shared/input.qc @@ -70,7 +70,14 @@ Game_Input(void) }// pi.iState checks #endif + // Must be ingame to reach beyond here + /////////////////////////////////////////////////////////// + + // Anything special with my own vars for networking to work right here? +#ifdef CLIENT + pl.clientInputUpdate(); +#endif // This method, Game_Input, is called by Nuclide's pmove.qc in the same place @@ -96,7 +103,6 @@ Game_Input(void) - /* // FreeHL's way @@ -210,7 +216,7 @@ Game_Input(void) // passes the w_attack_next check, but, being another frame while held-down, this is not // a fresh semi-tap and so it does not count. // In a primary attack method, if everything else goes right, it calls the view animation - // method, which does something a bit differnet client and serverside. + // method, which does something a bit different client and serverside. // Both set w_attack_next, but only clientside changes the sequence played. // So only serverside being called resets the anim to re-play the previously picked sequence // (becuase w_attack_next is networked, so it reaches the client from there anyway). @@ -328,14 +334,25 @@ Game_Input(void) */ + + + if(input_buttons & INPUT_BUTTON9){ + //printfline("IM here what"); + //TS_playerUseItems(); + } + + + + + + }//Game_Input + void processInputs(void){ player pl = (player)self; - - if (input_buttons & INPUT_BUTTON0){ //printfline("!!! PRIMA !!! (%d %d)", ((input_buttons & INPUT_BUTTON0)!=0), ((input_buttons & INPUT_BUTTON3)!=0)); Weapons_Primary(); @@ -395,18 +412,18 @@ void PreSpawn_Input(void){ pSeatLocal->m_flUI_Display == UI_SCREEN::NONE && (input_buttons & INPUT_BUTTON0) && !(pl.gflags & GF_SEMI_TOGGLED) && - pSeatLocal->flBlockSpawnTime <= time + pSeatLocal->m_flBlockSpawnInputTime <= time ){ sendevent( "GamePlayerSpawn", ""); } /* if( - ((input_buttons & INPUT_BUTTON0) && pSeatLocal->flBlockSpawnTime > time) || + ((input_buttons & INPUT_BUTTON0) && pSeatLocal->m_flBlockSpawnInputTime > time) || pSeat->m_flInputBlockTime > time ) { - pSeatLocal->flBlockSpawnTime = time + 0.20f; + pSeatLocal->m_flBlockSpawnInputTime = time + 0.20f; pl.gflags |= GF_SEMI_TOGGLED; return; } @@ -446,8 +463,20 @@ void ClientGame_Input_Frame(void){ // inputs per some condition, like weapon-select being up. // TODO - changing what m_flInputBlockTime affects might be a good idea, - // affecting other inputs like crouch is unnecessary, that causes the player to uncrouch - // if changing weapons while crouched. + // affecting other inputs like crouch is unnecessary, that causes the player to + // uncrouch if changing weapons while crouched. + + + player pl = (player)pSeat->m_ePlayer; + + if(pl.iState != PLAYER_STATE::SPAWNED && pSeatLocal->m_flUI_Display != UI_SCREEN::NONE){ + // If buying, don't allow any movement inputs. + // The above is a similar check as "g_vguiWidgetCount > 0", but the buymenu does not + // use VGUI. + input_movevalues = [0,0,0]; + // does not stop rotation from left/right arrows, not that this was very important. + //input_angles = [0,0,0]; + } if(pSeat->m_iHUDWeaponSelected && pSeat->m_iInputAttack2){ //input_buttons & INPUT_BUTTON3 if(TS_HUD_CloseWeaponSelect(TRUE)){ @@ -475,6 +504,12 @@ void ClientGame_Input_Frame(void){ //self.flags &= ~FL_SNEAK; } //printfline("input_buttons: %d", (INPUT_BUTTON7 & input_buttons) ); + + if(pSeatLocal->m_bUseItems){ + pSeatLocal->m_bUseItems = FALSE; + input_buttons |= INPUT_BUTTON9; + } + } #endif diff --git a/src/shared/player.h b/src/shared/player.h index 1fcbf88..7613119 100644 --- a/src/shared/player.h +++ b/src/shared/player.h @@ -228,10 +228,6 @@ class player:base_player // SHARED vector vViewAngleOffsetTarget; - vector vViewAngleOffsetTarget1; - vector vViewAngleOffsetTarget2; - vector vViewAngleOffsetTarget3; - vector vViewAngleOffsetTarget4; PREDICTED_FLOAT(fAccuracyKickback); PREDICTED_FLOAT(fAccuracyKickbackStartCooldown); @@ -552,6 +548,10 @@ class player:base_player virtual void(int arg_weaponID, BOOL completeDrop) dropWeapon; virtual BOOL(void) anyAmmoPoolNonEmpty; virtual void(void) dropAmmo; +#else + + virtual void(void) clientInputUpdate; + virtual void(void) clientUseItemsCallback; #endif diff --git a/src/shared/player.qc b/src/shared/player.qc index e2998b1..86ba95a 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -362,7 +362,7 @@ so we can roll them back later. void player::PredictPreFrame(void) { - //printfline("---PREDIT PRE FRAME"); + //printfline("---PREDICT PRE FRAME"); /* the generic client attributes */ base_player::PredictPreFrame(); @@ -483,7 +483,7 @@ Where we roll back our values to the ones last sent/verified by the server. void player::PredictPostFrame(void) { - //printfline("---PREDIT POST FRAME"); + //printfline("---PREDICT POST FRAME"); /* @@ -1394,6 +1394,45 @@ player::updateTimers(void){ + + +#ifdef CLIENT + +void +_TS_FRESH_playerUseItems(void); + +// client only, check some other input-related CVars. +void +player::clientInputUpdate(void){ + + //printfline("---clientInputUpdate"); + + /* + if(pSeatLocal->m_bUseItemsFreshPress){ + pSeatLocal->m_bUseItemsFreshPress = FALSE; + pSeatLocal->m_iUseItemsLatencyPresses++; + _TS_FRESH_playerUseItems(); + } + + int i; + for(i = 0; i < pSeatLocal->m_iUseItemsLatencyPresses; i++){ + TS_playerUseItems(); + } + */ +} + +void +player::clientUseItemsCallback(void){ + + //pSeatLocal->m_iUseItemsLatencyPresses--; +} + +#endif + + + + + void player::setZoomLevel(int arg_iZoomLevel){ iZoomLevel = arg_iZoomLevel; diff --git a/src/shared/pmove.qc b/src/shared/pmove.qc index 1cc655a..64e96d2 100644 --- a/src/shared/pmove.qc +++ b/src/shared/pmove.qc @@ -34,10 +34,6 @@ -// TODO - are the default player and crouch collision bounds still fitting for TS? -// Foggy on the details there, could've been some change in height - - // First something config-oriented. If uncommented, a modified clone of Nuclide's // base_player::Physics_Crouch (overridden by player) is used to insert the checks for // stopping uncrouching too soon after certain melee attacks. Example: katana melee attack. @@ -47,8 +43,6 @@ ///////////////////////////////////////////////////////////////////// - - // Are these even used anywhere anymore? /* @@ -57,10 +51,6 @@ #define PHY_JUMP_CHAINDECAY 50 */ -// No need to override, same as nuclide's defaults. CS just did something different. -//#define PHY_VIEWPOS [0,0,24] -//#define PHY_VIEWPOS_CROUCHED [0,0,12] - /* const vector VEC_HULL_MIN = [-16,-16,-36]; const vector VEC_HULL_MAX = [16,16,36]; @@ -77,9 +67,11 @@ const vector VEC_CHULL_MAX = [16,16,18]; */ -// From Nuclide, needed for cloned crouch logic -#define PHY_VIEWPOS [0,0,24] -#define PHY_VIEWPOS_CROUCHED [0,0,12] +// TS does use different viewpos offsets (original: heights of 24 and 12) +#define PHY_VIEWPOS [0,0,28] +#define PHY_VIEWPOS_CROUCHED [0,0,16] + +// I think these have to stay the same in goldsrc, I doubt TS could change them #define PHY_HULL_MIN [-16,-16,-36] #define PHY_HULL_MAX [16,16,36] #define PHY_HULL_CROUCHED_MIN [-16,-16,-18] @@ -99,7 +91,7 @@ void TS_Physics_LedgeCheck(player pl); // TODO! Is this accurate to TS? Copied from FreeHL. -// Worth comparing with FreeCS too if it does anything differnetly here. +// Worth comparing with FreeCS too if it does anything differently here. // Anyway, doing this to remove the viewpunch vertical effect, // seems TS only does roll. void @@ -375,8 +367,7 @@ player::Physics_Run(void) //maxspeed = Physics_MaxSpeed(); //self.maxspeed = GamePMove_Maxspeed((player)self); - // unfortunately, this setting is useless for now. - // See a note in src/shared/sound.qc. In my files that is, not in raw Nuclide. + // this setting is useless for now this.maxspeed_raw = GamePMove_MaxspeedRaw(this); // Cheap way to alter the friction for now, any deeper of a way without a Nuclide diff --git a/src/shared/precache.qc b/src/shared/precache.qc index 90c4984..618cd43 100644 --- a/src/shared/precache.qc +++ b/src/shared/precache.qc @@ -13,7 +13,7 @@ void SharedGame_Precache(void){ - //printfline("***SharedGame_Precache called***"); + printfline("***SharedGame_Precache called***"); // good idea to have precache shared? Unsure, but it has script client and serverside @@ -69,9 +69,6 @@ void SharedGame_Precache(void){ // Same for others where that applies precache_sound("weapons/switch.wav"); - // from Valve, no need to clone this - precache_model("sprites/glow02.spr"); - //precache_sound("weapons/weapondrop.wav"); diff --git a/src/shared/util.qc b/src/shared/util.qc index f0d9f65..683038d 100644 --- a/src/shared/util.qc +++ b/src/shared/util.qc @@ -334,7 +334,7 @@ void entityRemoveRespawnFlag(CBaseEntity arg_this){ void TS_Weapons_ViewAnimation(int i, float fDuration) { - printfline("TS_Weapons_ViewAnimation: %i %.2f", i, fDuration); + //printfline("TS_Weapons_ViewAnimation: %i %.2f", i, fDuration); player pl = (player)self; pl.w_idle_next = fDuration; @@ -349,7 +349,7 @@ TS_Weapons_ViewAnimation(int i, float fDuration) void TS_Weapons_ViewAnimation_noLaserLock(int i, float fDuration) { - printfline("TS_Weapons_ViewAnimation_noLaserLock: %i %.2f", i, fDuration); + //printfline("TS_Weapons_ViewAnimation_noLaserLock: %i %.2f", i, fDuration); player pl = (player)self; pl.w_idle_next = fDuration; @@ -365,7 +365,7 @@ TS_Weapons_ViewAnimation_noLaserLock(int i, float fDuration) void TS_Weapons_ViewAnimation_EndIdle(int i, float fDuration) { - printfline("TS_Weapons_ViewAnimation_EndIdle: %i %.2f", i, fDuration); + //printfline("TS_Weapons_ViewAnimation_EndIdle: %i %.2f", i, fDuration); player pl = (player)self; pl.w_idle_next = fDuration; @@ -380,7 +380,7 @@ TS_Weapons_ViewAnimation_EndIdle(int i, float fDuration) void TS_Weapons_ViewAnimation_EndIdle_custom(int i, float fDuration, float fIdleEndOffset) { - printfline("TS_Weapons_ViewAnimation_EndIdle_custom: %i %.2f %.2f", i, fDuration, fIdleEndOffset); + //printfline("TS_Weapons_ViewAnimation_EndIdle_custom: %i %.2f %.2f", i, fDuration, fIdleEndOffset); player pl = (player)self; pl.w_idle_next = fDuration; diff --git a/src/shared/weapons.h b/src/shared/weapons.h index 36a1e5d..96e3994 100644 --- a/src/shared/weapons.h +++ b/src/shared/weapons.h @@ -459,7 +459,7 @@ typedef struct{ // on purchase. // TODO - it might be a good idea to make the buy's upgrade // options convey automatic upgrades. - //These may be overridden by a differnet buy config file later (TODO). + //These may be overridden by a different buy config file later (TODO). //-------------------------------------------------------------------------- int iPrice; int iSlots; // same idea as "Weight". More slots slows the player down and counts toward diff --git a/src/shared/weapons.qc b/src/shared/weapons.qc index e0e0a2d..b5a689b 100644 --- a/src/shared/weapons.qc +++ b/src/shared/weapons.qc @@ -97,128 +97,32 @@ weapon_base_setRightAttackDelay_AtLeast(player pl, float amount) } -MELEE_HIT_RESPONSE -weapon_base_coldcock( - player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, - float damageToDeal, float range -){ - MELEE_HIT_RESPONSE resultHit = MELEE_HIT_RESPONSE::NONE; + + + #ifdef SERVER - weapondata_basic_t baseRef = *basePRef; - makevectors( GET_VIEW_ANGLES ); - - vector vSource = (pl.origin + pl.view_ofs); - traceline(vSource, vSource + (v_forward * range), MOVE_HITMODEL, pl); - - if ( trace_fraction == 1.0 ) { - //did not hit anything - return MELEE_HIT_RESPONSE::NONE; - }else{ - // ? For what purpose now? - //vOrigin = trace_endpos - vTraceDirection * 2; - - if ( trace_ent.takedamage ) { - if ( trace_ent.iBleeds == TRUE ) { - //TAGGG - TODO, CHECK. Do FX_Impact parameters still line up with this. - FX_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal ); - resultHit = MELEE_HIT_RESPONSE::FLESH; - }else{ - // assume metal then? - resultHit = MELEE_HIT_RESPONSE::METAL; - } - Damage_Apply( trace_ent, pl, damageToDeal, (int)pl.activeweapon, DMG_BLUNT); - } else { - resultHit = MELEE_HIT_RESPONSE::NONE; - } - } - -#endif - - return resultHit; -}//weapon_base_coldcock - - +// Server-only helper method for melee hit effects. Handles calling FX_Impact_melee +// and gives the hit response for custom weapons script to work with. +// Assumes a recent "traceline" call has filled trace_ent and trace_endpos. MELEE_HIT_RESPONSE -weapon_base_onPrimaryAttack_melee( - player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, - float damageToDeal, float range -){ - makevectors( GET_VIEW_ANGLES ); - return weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, basePRef, arg_thisWeapon, damageToDeal, range, v_forward); -}// weapon_base_onPrimaryAttack_melee - -// After the server calls this method (possibly client later?), -// we expect trace_ent to store the thing we recently hit for playing custom sounds. -// Anything that doesn't want the general material-hit sounds / sparks on hitting metalic/generic stuff -// should not use this method, just copy it and work as needed (looking at you karate). -MELEE_HIT_RESPONSE -weapon_base_onPrimaryAttack_melee_fromCustomDirection( - player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, - float damageToDeal, float range, vector vTraceDirection -){ - MELEE_HIT_RESPONSE resultHit = MELEE_HIT_RESPONSE::NONE; - -#ifdef SERVER - // safe default in case this method finds nothing. - // Might be unnecessary to do this? - trace_ent = NULL; - - weapondata_basic_t baseRef = *basePRef; - - vector vSource; - - vSource = ( pl.origin + pl.view_ofs ); - traceline( vSource, vSource + ( vTraceDirection * range ), MOVE_HITMODEL, pl ); - - - if ( trace_fraction == 1.0 ) { - // did not hit anything - return MELEE_HIT_RESPONSE::NONE; - } - - // ? For what purpose now? - //vOrigin = trace_endpos - vTraceDirection * 2; - - - if ( trace_ent.takedamage ){ - if ( trace_ent.iBleeds == TRUE ) { - FX_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal ); - resultHit = MELEE_HIT_RESPONSE::FLESH; - // end early! - - //TAGGG - other Damage_Apply examples: - // snark hit - //Damage_Apply(this, world, 1, 0, DMG_GENERIC); - // crossbow bolt touch - //Damage_Apply(other, self.owner, Skill_GetValue("plr_xbow_bolt_monster", 50), WEAPON_CROSSBOW, DMG_BLUNT); - - // Also calling the damage type 'SLASH' for now, all dedicated melee weapons are knife or sword-like - Damage_Apply( trace_ent, pl, damageToDeal, (int)pl.activeweapon, DMG_SLASH); - return resultHit; - }else{ - // let the logic run as normal below, don't assume metal - // resultHit = MELEE_HIT_RESPONSE::METAL; - // return resultHit; - } - } - +weapon_base_meleeHitEffect(void) +{ // Not very useful //FX_Impact( IMPACT_MELEE, trace_endpos, trace_plane_normal ); + MELEE_HIT_RESPONSE resultHit = MELEE_HIT_RESPONSE::NONE; + float surf; - string tex; + string texName; string texFilter; surf = getsurfacenearpoint(trace_ent, trace_endpos); - tex = getsurfacetexture(trace_ent, surf); - - // no strtolower needed on tex first? Nuclide's shared/src/traceattack.qc doesn't - texFilter = Materials_FixName(tex); + texName = getsurfacetexture(trace_ent, surf); + texFilter = Materials_FixName(texName); //--- HELPFUL PRINTOUT --- //printfline("I hit: %s ::: %s", floatToChar((float)hash_get(hashMaterials, texFilter)), texFilter ); - //printfline("weapon_base_onPrimaryAttack_melee_fromCustomDirection - I hit: %s", chr2str((float)hash_get(hashMaterials, texFilter)) ); - + //printfline("weapon_base_meleeHitEffect - I hit: %s", chr2str((float)hash_get(hashMaterials, texFilter)) ); // FLESH, BLOODYFLESH, SLOSH, FOLIAGE, ALIEN, and CONCRETE are all guesses. // Several others might be anyway, just extra unsure of these, if any TS map @@ -273,15 +177,126 @@ weapon_base_onPrimaryAttack_melee_fromCustomDirection( resultHit = MELEE_HIT_RESPONSE::METAL; break; } + return resultHit; +} +#endif + + +// For the melee attack some guns have. +// Why no hit sound? It's that way in original TS, probably fine to just pipe calls to +// weapon_base_onPrimaryAttack_melee instead if those are wanted, nothing special in here +MELEE_HIT_RESPONSE +weapon_base_coldcock( + player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, + float damageToDeal, float range +){ + MELEE_HIT_RESPONSE resultHit = MELEE_HIT_RESPONSE::NONE; +#ifdef SERVER + trace_ent = NULL; + weapondata_basic_t baseRef = *basePRef; + makevectors( GET_VIEW_ANGLES ); - if ( trace_ent.takedamage ){ - // Deal it now then - Damage_Apply( trace_ent, pl, damageToDeal, (int)pl.activeweapon, DMG_SLASH); + vector vSource = (pl.origin + pl.view_ofs); + traceline(vSource, vSource + (v_forward * range), MOVE_HITMODEL, pl); + + if ( trace_fraction == 1.0 ) { + //did not hit anything + return MELEE_HIT_RESPONSE::NONE; + }else{ + // ? For what purpose now? + //vOrigin = trace_endpos - vTraceDirection * 2; + + if ( trace_ent.takedamage ) { + if ( trace_ent.iBleeds == TRUE ) { + //TAGGG - TODO, CHECK. Do FX_Impact parameters still line up with this. + FX_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal ); + resultHit = MELEE_HIT_RESPONSE::FLESH; + }else{ + // assume metal then? + resultHit = MELEE_HIT_RESPONSE::METAL; + } + Damage_Apply(trace_ent, pl, damageToDeal, (int)pl.activeweapon, DMG_BLUNT); + } else { + resultHit = MELEE_HIT_RESPONSE::NONE; + } } #endif + return resultHit; +}//weapon_base_coldcock + + +MELEE_HIT_RESPONSE +weapon_base_onPrimaryAttack_melee( + player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, + float damageToDeal, float range +){ + makevectors( GET_VIEW_ANGLES ); + return weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, basePRef, arg_thisWeapon, damageToDeal, range, v_forward); +}// weapon_base_onPrimaryAttack_melee + +// After the server calls this method (possibly client later?), +// we expect trace_ent to store the thing we recently hit for playing custom sounds. +// Anything that doesn't want the general material-hit sounds / sparks on hitting metalic/generic stuff +// should not use this method, just copy it and work as needed (looking at you karate). +MELEE_HIT_RESPONSE +weapon_base_onPrimaryAttack_melee_fromCustomDirection( + player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon, + float damageToDeal, float range, vector vTraceDirection +){ + MELEE_HIT_RESPONSE resultHit = MELEE_HIT_RESPONSE::NONE; + +#ifdef SERVER + weapondata_basic_t baseRef = *basePRef; + vector vSource; + + // safe default in case this method finds nothing. + // Might be unnecessary to do this? + trace_ent = NULL; + + vSource = ( pl.origin + pl.view_ofs ); + traceline( vSource, vSource + ( vTraceDirection * range ), MOVE_HITMODEL, pl ); + + if ( trace_fraction == 1.0 ) { + // did not hit anything + return MELEE_HIT_RESPONSE::NONE; + } + + // For what purpose now? Where to put a hit-effect cloud sometime maybe like + // original TS does? + //vOrigin = trace_endpos - vTraceDirection * 2; + + if ( trace_ent.takedamage ){ + if ( trace_ent.iBleeds == TRUE ) { + // The thing I hit takes damage and is organic? + // Do something different from weapon_base_meleeHitEffect. + + // Also calling the damage type 'SLASH' for now, all dedicated melee weapons are knife or sword-like + FX_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal ); + resultHit = MELEE_HIT_RESPONSE::FLESH; + Damage_Apply(trace_ent, pl, damageToDeal, (int)pl.activeweapon, DMG_SLASH); + + // other Damage_Apply examples: + // snark hit + //Damage_Apply(this, world, 1, 0, DMG_GENERIC); + // crossbow bolt touch + //Damage_Apply(other, self.owner, Skill_GetValue("plr_xbow_bolt_monster", 50), WEAPON_CROSSBOW, DMG_BLUNT); + + }else{ + // don't assume metal + // resultHit = MELEE_HIT_RESPONSE::METAL; + + resultHit = weapon_base_meleeHitEffect(); + Damage_Apply(trace_ent, pl, damageToDeal, (int)pl.activeweapon, DMG_SLASH); + } + + }else{ + // Does not take damage? That is all + resultHit = weapon_base_meleeHitEffect(); + } +#endif return resultHit; }// weapon_base_onPrimaryAttack_melee @@ -905,7 +920,7 @@ weapon_akimbo_fullAttackDualHack( // Used for akimbo weapons with semi fire modes (all akimbo pistols I think). -// Some akimbo SMG supports hold-fire in akimbo though, that will be handled a little differnetly. +// Some akimbo SMG supports hold-fire in akimbo though, that will be handled a little differently. // Same method with a choice or not, unsure what's best yet. // TAGGG - TODO, of course. // ----------------------------- @@ -1708,7 +1723,7 @@ weapon_gun_onDrawHUD(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_ clrDraw = clrMedRed; } drawSpriteNumber(ary_LCD_numberSet, vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 0, arg_thisWeapon.iClipLeft, 3, BITS_DIGITOPT_DEFAULT, clrDraw, 0.92f); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 64, vEquippedWeaponInfoDraw.y + 4], "/", vButtonFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 64, vEquippedWeaponInfoDraw.y + 4], "/", vHUDFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); if(pl.ary_ammoTotal[baseRef.iAmmoDataID] > 0){ clrDraw = clrPaleBlue; }else{ @@ -1734,7 +1749,7 @@ weapon_gun_onDrawHUD(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_ clrDraw = clrMedRed; } drawSpriteNumber(ary_LCD_numberSet, vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 0, arg_thisWeapon.iClipAkimboLeft, 3, BITS_DIGITOPT_DEFAULT, clrDraw, 0.92f); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 64, vEquippedWeaponInfoDraw.y + 4], "/", vButtonFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 64, vEquippedWeaponInfoDraw.y + 4], "/", vHUDFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); if(pl.ary_ammoTotal[baseRef.iAmmoDataID] > 0){ clrDraw = clrPaleBlue; }else{ @@ -1751,7 +1766,7 @@ weapon_gun_onDrawHUD(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_ clrDraw = clrMedRed; } drawSpriteNumber(ary_LCD_numberSet, vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 0, arg_thisWeapon.iClipLeft, 3, BITS_DIGITOPT_DEFAULT, clrDraw, 0.92f); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 64, vEquippedWeaponInfoDraw.y + 4], "/", vButtonFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 64, vEquippedWeaponInfoDraw.y + 4], "/", vHUDFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); if(pl.ary_ammoTotal[baseRef.iAmmoDataID] > 0){ clrDraw = clrPaleBlue; }else{ @@ -1783,17 +1798,17 @@ weapon_gun_onDrawHUD(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_ // IMPORTANT. If this weapon is akimbo we have to use the "getAkimboFiremodeName" // variant! drawfill( vEquippedWeaponInfoDraw, [128, 19], clrPaleBlue, 0.86f - 0.60f ); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], fireModeName, vButtonFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], fireModeName, vHUDFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); vEquippedWeaponInfoDraw.y -= 20; // ammo type name drawfill( vEquippedWeaponInfoDraw, [128, 19], clrPaleBlue, 0.86f - 0.60f ); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], ammoRef.sDisplayName, vButtonFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], ammoRef.sDisplayName, vHUDFontSize, clrPaleBlue, 0.86f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); vEquippedWeaponInfoDraw.y -= 20; // title drawfill( vEquippedWeaponInfoDraw, [128, 19], clrPaleBlue, 0.86f - 0.60f ); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vButtonFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vHUDFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); vEquippedWeaponInfoDraw.y -= 20; #endif }// weapon_gun_onDrawHUD @@ -1819,7 +1834,7 @@ weapon_throwable_onDrawHUD(player pl, weapondata_throwable_t* basePRef, weapondy // title drawfill( vEquippedWeaponInfoDraw, [128, 19], clrPaleBlue, 0.86f - 0.60f ); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vButtonFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vHUDFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); vEquippedWeaponInfoDraw.y -= 20; #endif }// weapon_throwable_onDrawHUD @@ -1846,7 +1861,7 @@ weapon_melee_onDrawHUD(player pl, weapondata_melee_t* basePRef, weapondynamic_t // title drawfill( vEquippedWeaponInfoDraw, [128, 19], clrPaleBlue, 0.86f - 0.60f ); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vButtonFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vHUDFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); vEquippedWeaponInfoDraw.y -= 20; #endif }// weapon_throwable_onDrawHUD diff --git a/src/shared/weapons/weapon_karate.qc b/src/shared/weapons/weapon_karate.qc index 7e1de38..951b278 100644 --- a/src/shared/weapons/weapon_karate.qc +++ b/src/shared/weapons/weapon_karate.qc @@ -379,7 +379,7 @@ w_karate_hud(void) //title drawfill( vEquippedWeaponInfoDraw, [128, 19], clrPaleBlue, 0.86f - 0.60f ); - Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vButtonFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); + Gfx_Text( [vEquippedWeaponInfoDraw.x + 2, vEquippedWeaponInfoDraw.y + 4], baseRef.sDisplayName, vHUDFontSize, clrPaleBlue, 0.98f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); vEquippedWeaponInfoDraw.y -= 20; #endif } diff --git a/zpak001.pk3dir/default.cfg b/zpak001.pk3dir/default.cfg index 1d7041c..21ffca1 100644 --- a/zpak001.pk3dir/default.cfg +++ b/zpak001.pk3dir/default.cfg @@ -1,7 +1,14 @@ -bind w +forward -bind s +back -bind a +moveleft -bind d +moveright +// Generic Binds +bind "`" "toggleconsole" +bind "~" "toggleconsole" +bind "ESC" "togglemenu" +bind "w" "+forward" +bind "s" "+back" +bind "a" "+moveleft" +bind "d" "+moveright" +bind "SPACE" "+jump" +bind "CTRL" "+duck" +bind "SHIFT" "+speed" bind "0" "slot10" bind "1" "slot1" bind "2" "slot2" @@ -17,86 +24,123 @@ bind "UPARROW" "+forward" bind "DOWNARROW" "+back" bind "LEFTARROW" "+left" bind "RIGHTARROW" "+right" -bind MOUSE1 +attack -bind MOUSE2 +attack2 +bind "MOUSE1" "+attack" +bind "ENTER" "+attack" +bind "MOUSE2" "+attack2" bind "MWHEELDOWN" "invnext" bind "MWHEELUP" "invprev" -bind r +reload -bind e +use -bind g drop -bind TAB +showscores -bind y messagemode -bind u messagemode2 -bind t "impulse 201" +bind "r" "+reload" +bind "e" "+use" +bind "g" "drop" +bind "TAB" "+showscores" +bind "y" "messagemode" +bind "u" "messagemode2" +bind "t" "impulse 201" +//bind "f" "impulse 100" +bind "f1" "vote yes" +bind "f2" "vote no" +bind "m" "chooseteam" +bind "b" "buy" +bind "f" "firemode" +bind "n" "useitems" +// stunt-related (TODO) +bind "MOUSE3" "+alt1" +// coldcock (some gun's melee) +bind "c" "+alt2" -bind SPACE +jump -bind CTRL +duck -bind SHIFT +speed +// default? +seta "model" "agent" -bind b "buy" -bind m "chooseteam" -bind ESC "togglemenu" +// Game Variables +seta "hostname" "Free Specialists Server" +seta "maxplayers" "8" +seta "mp_startmoney" "30000" +seta "mp_maxmoney" "16000" +seta "mp_freezetime" "6" +seta "mp_roundtime" "5" -// Game variables -seta maxplayers 8 -seta mp_startmoney "800" -seta mp_buytime 90 -seta mp_freezetime 6 -seta mp_c4timer 45 -seta mp_roundtime 5 -seta fcs_knifeonly 0 -seta fcs_swapteams 0 -seta fcs_nopickups 0 -seta fcs_reward_kill 300 -seta fcs_penalty_pain -150 -seta fcs_penalty_kill -1500 -seta fcs_maxmoney 16000 -seta fcs_fillweapons 0 -seta fcs_autoreload 0 +// 2D/HUD Variables +seta "con_color" "255 150 0" +seta "vgui_color" "255 170 0" +seta "cross_color" "0 255 0" -// Movement Variables -seta sv_maxspeed 240 -seta cl_forwardspeed 400 -seta cl_sidespeed 400 -seta cl_backspeed 400 -seta cl_movespeedkey 0.5 -seta sv_accelerate "5" -seta pm_bunnyspeedcap "0" -seta pm_stepdown 0 +// Minimum resolution recommended, a little less may still be OK. +// No idea why the screen ratio is included in vid_height. +seta "vid_height" "960 (4:3)" +seta "vid_width" "1280" -seta cl_bob 0 -seta v_bobcycle 0.8 -seta v_bob 0.01 -seta v_bobup 0.5 -seta r_particledesc default -seta con_textsize "12" -seta con_color "255 150 0" -seta vgui_color "255 170 0" -seta cross_color "0 255 0" +// This says to scale the UI as many times as width "1280" fits into the screen. +// So, once with a resolution 1280 wide, 1.5 times for a res 1920 wide +seta "vid_conautoscale" "0" +seta "vid_conwidth" "1280" +seta "vid_conheight" "0" -hostname "Free Specialists Server" +seta "r_autoscale" "0" + +seta "scr_conalpha" "1" +// menu-fn enforces a console textsize at startup. +//seta "con_textsize" "18" +//seta "con_textfont" "comic" + + +// Just in case +seta "debug_spawnpointforced" "0" +seta "cl_fullpitch" "0" +seta "r_ignoreentpvs" "0" + +// Seems bypassed by Nuclide, but can't hurt +seta "cfg_save_name" "nuclide" + + +// r_lightmap_format, common choices +// "e5bgr9" (FTE default if no line sets this) +// "rgb9e5" (seems same as above) +// "" (blanked; works best) +seta "r_lightmap_format" "" +seta "r_lightstylespeed" "10" +seta "r_lightstylesmooth" "0" + + +// Realtime Lighting +// NOTE - only "r_shadow_realtime_world" differs from the FTE default +// as of this time. It is 0 instead to stop a console warning +// "No lights detected in map.", unless somewhere would benefit from that. +seta "r_sun_colour" "0 0 0" //Specifies the colour of sunlight that appears in the form of crepuscular rays. +seta "r_shadow_shadowmapping" "1" //Enables soft shadows instead of stencil shadows. +seta "r_shadow_realtime_dlight_shadows" "0" //Allows dynamic realtime lights to cast shadows as they move. +seta "r_shadow_realtime_dlight" "0" //Enables the use of dynamic realtime lights, allowing explosions to use bumpmaps etc properly. +seta "r_shadow_realtime_world_shadows" "0" +seta "r_shadow_realtime_world" "0" + + +// OTHER +seta "lang" "en_us" +seta "maxpitch" "89" +seta "minpitch" "-89" +seta "cl_idlefps" "0" +seta "cl_cursor_scale" "1" +seta "con_logcenterprint" "0" +seta "con_notifylines" "0" +seta "cfg_save_auto" "1" +seta "scr_sshot_type" "tga" +seta "com_nogamedirnativecode" "0" + +seta "r_particledesc" "default" +seta "r_polygonoffset_submodel_offset" "0" +seta "r_polygonoffset_submodel_factor" "0" +seta "r_fullbrightSkins" "0" +seta "r_fb_models" "0" +seta "r_imageexensions" "tga bmp pcx" +seta "r_shadow_realtime_world_shadows" "0" +seta "r_shadow_realtime_dlight_shadows" "0" +seta "r_meshpitch" "1" +seta "r_viewmodel_fov" "" +seta "gl_blacklist_debug_glsl" "0" +seta "gl_overbright" "0" +seta "v_contentblend" "0" +seta "v_viewmodel_quake" "0" + +seta "scr_fov_mode" "4" +seta "fov" "80" +seta "viewsize" "100" -seta r_polygonoffset_submodel_offset "0" -seta r_polygonoffset_submodel_factor "0" -seta r_fullbrightSkins "0" -seta r_fb_models "0" -seta v_contentblend "0" -seta com_nogamedirnativecode "0" -seta cl_cursor_scale "1" -seta r_shadow_realtime_world_shadows "0" -seta r_shadow_realtime_dlight_shadows "0" -seta r_imageexensions "tga bmp pcx" -seta gl_blacklist_debug_glsl 0 -seta vid_conautoscale "1" -seta scr_conalpha "1" -seta scr_sshot_type "tga" -seta con_notifylines "0" -seta con_logcenterprint "0" -seta maxplayers "8" -seta lang "en_us" -seta cfg_save_auto "1" -seta r_meshpitch "1" -seta gl_overbright "0" -seta cl_idlefps "0" -seta maxpitch "89" -seta minpitch "-89"