From 86dfb3ff1af2c4205139893f5a52b3950400b696 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Tue, 14 Feb 2023 12:54:06 -0800 Subject: [PATCH] Fix various compiler warnings. --- src/client/NSView.h | Bin 4794 -> 4793 bytes src/client/cmd.qc | 1 - src/client/crosshair.qc | 2 +- src/client/entry.qc | 2 + src/client/font.qc | 5 +- src/client/titles.qc | 15 +++++ src/client/way.qc | 18 +++--- src/gs-entbase/shared/ambient_generic.qc | 2 - src/gs-entbase/shared/trigger_camera.qc | 4 +- src/menu-fn/m_customgame.qc | 79 ++++++++++++++--------- src/menu-fn/w_3dview.qc | 4 +- src/platform/achievements.qc | 1 + src/server/NSGameRules.qc | 4 +- src/server/entry.qc | 8 +-- src/shared/NSClientPlayer.qc | 21 +++--- src/shared/NSMonster.h | 2 + src/shared/NSWeapon.qc | 2 + src/vgui/ui_button.qc | 7 +- 18 files changed, 106 insertions(+), 71 deletions(-) diff --git a/src/client/NSView.h b/src/client/NSView.h index 0f6b046f6cad0fa59caa73429288832f7e1d2edd..9d105044a9abb4557e4ce842731120de79d72fb9 100644 GIT binary patch delta 12 Tcmdm`x>I!nC)Z{!t_>Uj9ts2i delta 14 Vcmdm~x=VEfCl@2bW=^gR8~`H?1ONa4 diff --git a/src/client/cmd.qc b/src/client/cmd.qc index 493462c2..d87657da 100644 --- a/src/client/cmd.qc +++ b/src/client/cmd.qc @@ -203,7 +203,6 @@ CMD_ListParticles(void) static void CMD_ListTitles(void) { - string tmp; int i = 0i; for (i = 0; i < g_titles_count; i++) { diff --git a/src/client/crosshair.qc b/src/client/crosshair.qc index 9454f53a..a5f1b7ea 100644 --- a/src/client/crosshair.qc +++ b/src/client/crosshair.qc @@ -64,7 +64,7 @@ Cross_DrawSubRGBA(string strMat, vector vecSize, vector vecSrcPos, vector vecSrc } else { vector vecSrc; vector vecDst; - player pl = pSeat->m_ePlayer; + player pl = (player)pSeat->m_ePlayer; vecSrc = pSeat->m_vecPredictedOrigin + pSeat->m_ePlayer.view_ofs; makevectors(view_angles); diff --git a/src/client/entry.qc b/src/client/entry.qc index 73b16d13..82756031 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -61,6 +61,8 @@ CSQC_Init(float apilevel, string enginename, float engineversion) precache_sound("common/wpn_moveselect.wav"); precache_sound("common/wpn_select.wav"); + precache_sound("common/null.wav"); + /* VGUI */ VGUI_Init(); diff --git a/src/client/font.qc b/src/client/font.qc index 88ffc710..8190b4a0 100644 --- a/src/client/font.qc +++ b/src/client/font.qc @@ -85,9 +85,10 @@ Font_Load(string strFile, font_s &fntNew) print(sprintf("loaded font definition for %s\n", strFile)); - if (strRenderSize != "") + if (strRenderSize != "") { + print(sprintf("rendersize: %S\n", strRenderSize)); fntNew.iID = (int)loadfont("", strFontPath, strRenderSize, -1, 0, 0); - else + } else fntNew.iID = (int)loadfont("", strFontPath, ftos((float)fntNew.iScaleY), -1, 0, 0); } diff --git a/src/client/titles.qc b/src/client/titles.qc index 8ab60904..3295e6b0 100644 --- a/src/client/titles.qc +++ b/src/client/titles.qc @@ -38,6 +38,21 @@ typedef struct titles_s titles_t *g_titles; int g_titles_count; +titles_t g_title_null = +{ + .m_strName = "", + .m_strMessage = "", + .m_flPosX = 0.0f, + .m_flPosY = -1.0f, + .m_iEffect = 0, + .m_vecColor1 = [1,1,1], + .m_vecColor2 = [1,1,1], + .m_flFadeIn = 0.5f, + .m_flFadeOut = 0.5f, + .m_flHoldTime = 0.0f, + .m_flFXTime = 2.5f +}; + string Titles_ParseFunString(string temp) { diff --git a/src/client/way.qc b/src/client/way.qc index 8a4c30e2..cd0eb0ac 100644 --- a/src/client/way.qc +++ b/src/client/way.qc @@ -19,7 +19,7 @@ Way_Init(void) { /* main waypoint menu */ { - titles_t way_menu; + titles_t way_menu = g_title_null; way_menu.m_strName = "WAY_MENU"; way_menu.m_strMessage = "1.\tAdd...\n" \ "2.\tLink/Unlink...\n" \ @@ -36,7 +36,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_file; + titles_t way_file = g_title_null; way_file.m_strName = "WAY_FILE"; way_file.m_strMessage = "1.\tSave current file (data/mapname.way)\n" \ "\n" \ @@ -53,7 +53,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_add; + titles_t way_add = g_title_null; way_add.m_strName = "WAY_ADD"; way_add.m_strMessage = "1.\tAdd ^1Single^7 Waypoint\n" \ "2.\tAdd ^1Chain^7 Waypoint^7 (last-to-new)\n" \ @@ -71,7 +71,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_link; + titles_t way_link = g_title_null; way_link.m_strName = "WAY_LINK"; way_link.m_strMessage = "1.\tLink 1-way (2 steps)\n" \ "2.\tLink 2-way (2 steps)\n" \ @@ -88,7 +88,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_remove; + titles_t way_remove = g_title_null; way_remove.m_strName = "WAY_REMOVE"; way_remove.m_strMessage = "\n" \ "\n" \ @@ -105,7 +105,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_flags; + titles_t way_flags = g_title_null; way_flags.m_strName = "WAY_FLAGS"; way_flags.m_strMessage = "1.\tFlag ^3JUMP^7 (2 steps)\n" \ "2.\tFlag ^2CROUCH^7 (2 steps)\n" \ @@ -122,7 +122,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_radius; + titles_t way_radius = g_title_null; way_radius.m_strName = "WAY_RADIUS"; way_radius.m_strMessage = "1.\tSet closest way-radius (0)\n" \ "2.\tSet closest way-radius (8)\n" \ @@ -139,7 +139,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_text; + titles_t way_text = g_title_null; way_text.m_strName = "WAY_AUTOLINK"; way_text.m_strMessage = "1.\tDefault radius (256)\n" \ "2.\t32 radius\n" \ @@ -156,7 +156,7 @@ Way_Init(void) } /* add waypoint menu */ { - titles_t way_move; + titles_t way_move = g_title_null; way_move.m_strName = "WAY_MOVE"; way_move.m_strMessage = "1.\tMove nearest +1 X-axis\n" \ "2.\tMove nearest -1 X-axis\n" \ diff --git a/src/gs-entbase/shared/ambient_generic.qc b/src/gs-entbase/shared/ambient_generic.qc index ddccb69d..9eea37ad 100644 --- a/src/gs-entbase/shared/ambient_generic.qc +++ b/src/gs-entbase/shared/ambient_generic.qc @@ -206,8 +206,6 @@ void ambient_generic::Spawned(void) { super::Spawned(); - - precache_sound("common/null.wav"); } void diff --git a/src/gs-entbase/shared/trigger_camera.qc b/src/gs-entbase/shared/trigger_camera.qc index 8e99ca8a..d95fe489 100644 --- a/src/gs-entbase/shared/trigger_camera.qc +++ b/src/gs-entbase/shared/trigger_camera.qc @@ -85,7 +85,7 @@ trigger_camera::trigger_camera(void) void trigger_camera::ReceiveEntity(float flNew, float flFlags) { - float flWait; + float flWait = 0.0f; print(sprintf("camera update %d %d %x\n", entnum, flNew, flFlags)); @@ -293,7 +293,7 @@ trigger_camera::Trigger(entity act, triggermode_t state) print(sprintf("trigger_camera for %S is now %S\n", act.netname, targetname)); /* kill the other cams the player may be attached to */ - for (trigger_camera cam = world; (cam = (trigger_camera)find(cam, ::classname, "trigger_camera"));) { + for (trigger_camera cam = __NULL__; (cam = (trigger_camera)find(cam, ::classname, "trigger_camera"));) { if (cam.m_eLooker == act) { cam.m_eLooker = __NULL__; cam.SetSendFlags(-1); diff --git a/src/menu-fn/m_customgame.qc b/src/menu-fn/m_customgame.qc index 1d1de417..4ac6c146 100644 --- a/src/menu-fn/m_customgame.qc +++ b/src/menu-fn/m_customgame.qc @@ -324,6 +324,34 @@ games_find_in_gamedir(string filename, string gamedirname) sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full)); fh = search_fopen(sh, 0); + print(sprintf("looking for %s in %s\n", filename, strcat(gamedirname, "/", full))); + + /* we found one */ + if (fh >= 0) { + search_end(sh); + break; + } + search_end(sh); + } + search_end(psh); + } + + /* we do not. let's search for pk3's to sift through */ + if (fh < 0) { + /* let's search for every pk3 in the gamedir and search for a liblist, one at a time. */ + psh = search_begin("dlcache/*.pk3.*", SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, gamedirname); + + /* loop through each pk3 in reverse (newest to old) */ + for (int i = search_getsize(psh); i >= 0; i--) { + string full = search_getfilename(psh, i); + print(sprintf("%s\n", full)); + + if (!full) + continue; + + sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full)); + fh = search_fopen(sh, 0); + print(sprintf("looking for %s in %s\n", filename, strcat(gamedirname, "/", full))); /* we found one */ if (fh >= 0) { @@ -522,12 +550,12 @@ customgame_btnactivate_start(void) else if (games[nextgame].info_type == GAMEINFO_LIBLIST) { /* some games/mods inherit other directories */ if (games[nextgame].fallback_dir) { - localcmd(sprintf("gamedir \"logos;platform;%s;%s;%s\"\n", games[nextgame].base_dir, games[nextgame].fallback_dir, games[nextgame].gamedir)); + localcmd(sprintf("gamedir \"platform;%s;%s;%s\"\n", games[nextgame].base_dir, games[nextgame].fallback_dir, games[nextgame].gamedir)); } else { - localcmd(sprintf("gamedir \"logos;platform;%s;%s\"\n", games[nextgame].base_dir, games[nextgame].gamedir)); + localcmd(sprintf("gamedir \"platform;%s;%s\"\n", games[nextgame].base_dir, games[nextgame].gamedir)); } } else - localcmd(sprintf("gamedir \"logos;platform;%s;%s\"\n", games[nextgame].base_dir, games[nextgame].gamedir)); + localcmd(sprintf("gamedir \"platform;%s;%s\"\n", games[nextgame].base_dir, games[nextgame].gamedir)); #endif localcmd("stopmusic\nsnd_restart\nwait\nvid_reload\n"); @@ -536,8 +564,6 @@ customgame_btnactivate_start(void) localcmd("menu_musicstart\n"); } - - #if 1 void customgame_installstart(int gameid) @@ -561,9 +587,8 @@ void customgame_installend(void) { int gid = g_iModInstallCache; - print("install-end!\n"); - - localcmd(sprintf("fs_changegame %s http://www.frag-net.com/mods/%s.fmf\n", g_strModInstallCache, g_strModInstallCache)); + print(sprintf("Installation ended for %S!\n", g_strModInstallCache)); + localcmd(sprintf("game %s\n", g_strModInstallCache)); game_writeinstallcache(-1, g_strModInstallCache); } @@ -711,7 +736,7 @@ games_setdefaultpkgs(int id) } void -games_init_2(void) +games_init_mods(void) { int id; int foundself = 0; @@ -719,19 +744,10 @@ games_init_2(void) gameinfo_count = 0; for (id = 0; (gamedirname = getgamedirinfo(id, 0)); id++) { - /* in case FTE does not report the current game we're playing, sigh */ - if (gamedirname == cvar_string("game")) - foundself = 1; - - gameinfo_count++; - } - - /* append current game to the very end */ - if (!foundself) { - //games_set(gameinfo_count); gameinfo_count++; } + /* re-allocate the game list */ memfree(games); games = memalloc(sizeof(gameinfo_t) * gameinfo_count); @@ -743,12 +759,6 @@ games_init_2(void) for (id = 0; id < gameinfo_count; id++) { gamedirname = getgamedirinfo(id, 0); - /* handle the case if we didn't get reported our own game */ - if (!foundself) - if (id == (gameinfo_count-1)) { - gamedirname = cvar_string("game"); - } - /* Fill in the defaults */ games[id].game = gamedirname; games[id].gamedir = gamedirname; @@ -809,8 +819,10 @@ games_init(void) { int id = 0; string gamedirname = cvar_string("game"); - gameinfo_count++; + + gameinfo_count = 1; /* we start at 1 game, ours */ games = memalloc(sizeof(gameinfo_t) * gameinfo_count); + /* Fill in the defaults */ games[id].game = gamedirname; games[id].gamedir = gamedirname; @@ -840,9 +852,12 @@ games_init(void) games[id].pkgid = -1; games[id].steambg = 0; gameinfo_current = 0; + + /* only run this when not in web-client mode */ +#ifndef WEBMENU + /* set the default packages for a given game */ games_setdefaultpkgs(id); -#ifndef WEBMENU if (games_check_manifest(id, gamedirname) == 1) { NSLog("[MENU] Found manifest for %s", gamedirname); games[id].info_type = GAMEINFO_MANIFEST; @@ -857,6 +872,8 @@ games_init(void) games[id].info_type = GAMEINFO_NONE; } #endif + + /* set the current game to be us */ games_set(id); } @@ -938,8 +955,10 @@ menu_customgame_draw(void) customgame_dlgWait.Draw(); WField_Static(162, 180, "Indexing all local games, please wait...", 320, 260, col_prompt_text, 1.0f, 2, font_label_p); + + /* once we started rendering the message, start parsing mods */ if (g_customgame_initialized == 1) - games_init_2(); + games_init_mods(); g_customgame_initialized++; return; @@ -964,6 +983,7 @@ menu_customgame_draw(void) WLabel_Static(571, 143, m_reslbl[IDS_MODLIST_PLAYERS], 11, 11, [1,1,1], 1.0f, 0, font_arial); + /* draw a frame for when we're refreshing the mod list */ if (g_iModServerLoading) { customgame_dlgWait.Draw(); WField_Static(162, 180, m_reslbl[IDS_MODREQ_TITLE], 320, 260, @@ -971,13 +991,14 @@ menu_customgame_draw(void) } + /* draw a frame with progress during package install */ #if 1 if (g_iModInstallCache >= 0i) { customgame_installframe(); } #endif - customgame_sbMods.SetMax(gameinfo_count-1); /* don't show our current game */ + customgame_sbMods.SetMax(gameinfo_count-1); #endif } diff --git a/src/menu-fn/w_3dview.qc b/src/menu-fn/w_3dview.qc index 11f8d060..d93c90c8 100644 --- a/src/menu-fn/w_3dview.qc +++ b/src/menu-fn/w_3dview.qc @@ -14,10 +14,10 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -noref .vector colormod; -noref .vector angles; noref .float colormap; noref .float frame, frame2, lerpfrac, renderflags, frame1time; +noref .vector angles; +noref .vector colormod; enumflags { diff --git a/src/platform/achievements.qc b/src/platform/achievements.qc index 3d3b617e..14f24f17 100644 --- a/src/platform/achievements.qc +++ b/src/platform/achievements.qc @@ -57,4 +57,5 @@ Achievement_IndicateProgress(string strName, int iCurrent, int iMax) bool Achievement_RequestStats(achievement_t *ptr, int count) { + return false; } diff --git a/src/server/NSGameRules.qc b/src/server/NSGameRules.qc index a1caae30..2310c226 100644 --- a/src/server/NSGameRules.qc +++ b/src/server/NSGameRules.qc @@ -340,8 +340,8 @@ NSGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type g_dmg_iFlags = type; g_dmg_iWeapon = w; - NSLog("Damage: %s damages %s with %i damage", c.classname, t.classname, dmg); - NSLog("\tHit-body: %i", g_dmg_iHitBody); + NSLog("Damage: %s damages %s with %d damage", c.classname, t.classname, dmg); + NSLog("\tHit-body: %d", g_dmg_iHitBody); NSLog("\tFlags: %i", g_dmg_iFlags); NSLog("\tWeapon: %i", g_dmg_iWeapon); diff --git a/src/server/entry.qc b/src/server/entry.qc index 92b95cf0..81a03be2 100644 --- a/src/server/entry.qc +++ b/src/server/entry.qc @@ -282,15 +282,15 @@ SV_ParseClientCommand(string cmd) switch (argv(0)) { case "say": if (argc == 2) - g_grMode.ChatMessageAll(self, argv(1)); + g_grMode.ChatMessageAll((NSClient)self, argv(1)); else - g_grMode.ChatMessageAll(self, substring(cmd, 5, -2)); + g_grMode.ChatMessageAll((NSClient)self, substring(cmd, 5, -2)); break; case "say_team": if (argc == 2) - g_grMode.ChatMessageTeam(self, argv(1)); + g_grMode.ChatMessageTeam((NSClient)self, argv(1)); else - g_grMode.ChatMessageTeam(self, substring(cmd, 10, -2)); + g_grMode.ChatMessageTeam((NSClient)self, substring(cmd, 10, -2)); break; case "spectate": if (self.classname != "player") diff --git a/src/shared/NSClientPlayer.qc b/src/shared/NSClientPlayer.qc index 6a11cd7d..b76824c8 100644 --- a/src/shared/NSClientPlayer.qc +++ b/src/shared/NSClientPlayer.qc @@ -124,7 +124,9 @@ NSClientPlayer::PostFrame(void) void NSClientPlayer::ProcessInput(void) -{ +{ + NSVehicle veh = (NSVehicle)vehicle; + if (Util_IsPaused()) return; @@ -138,8 +140,6 @@ NSClientPlayer::ProcessInput(void) /* allow vehicles to prevent weapon logic from happening */ if (vehicle && !Client_InIntermission()) { - NSVehicle veh = (NSVehicle)vehicle; - if (veh.PlayerInput) veh.PlayerInput(); } @@ -166,7 +166,6 @@ NSClientPlayer::ProcessInput(void) impulse = 0; #endif - NSVehicle veh = (NSVehicle)vehicle; bool canfire = true; /* can't fire in some vehicles */ @@ -179,19 +178,19 @@ NSClientPlayer::ProcessInput(void) canfire = false; if (canfire == false) { - Weapons_Release(this); + Weapons_Release((player)this); return; } /* weapon system */ if (input_buttons & INPUT_BUTTON3) - Weapons_Secondary(this); + Weapons_Secondary((player)this); else if (input_buttons & INPUT_BUTTON0) - Weapons_Primary(this); + Weapons_Primary((player)this); else if (input_buttons & INPUT_BUTTON4) - Weapons_Reload(this); + Weapons_Reload((player)this); else - Weapons_Release(this); + Weapons_Release((player)this); } /* this is where it gets mod specific really fast, @@ -291,7 +290,7 @@ NSClientPlayer::predraw(void) /* draw a 3D voice blob over its head */ Voice_Draw3D(this); - Weapons_PreDraw(this, true); + Weapons_PreDraw((player)this, true); /* force drawing us if it's our local player and we're meant to show */ if (entnum == player_localentnum) @@ -310,7 +309,7 @@ NSClientPlayer::predraw(void) /* give mods a chance to de-render attachments */ UpdatePlayerAttachments(false); - Weapons_PreDraw(this, false); + Weapons_PreDraw((player)this, false); /* this is here just to make sure our view hides us if it's the local player */ if (entnum == player_localentnum) diff --git a/src/shared/NSMonster.h b/src/shared/NSMonster.h index 4265e086..14618fa9 100644 --- a/src/shared/NSMonster.h +++ b/src/shared/NSMonster.h @@ -260,6 +260,8 @@ private: float m_flSeeTime; /* animation cycles */ float m_flAnimTime; + + nonvirtual void _LerpTurnToEnemy(float); #endif public: diff --git a/src/shared/NSWeapon.qc b/src/shared/NSWeapon.qc index 5a06b544..1b934a13 100644 --- a/src/shared/NSWeapon.qc +++ b/src/shared/NSWeapon.qc @@ -85,6 +85,8 @@ NSWeapon::SendEntity(entity ePEnt, float flChanged) WriteFloat(MSG_ENTITY, m_flSecondaryNext); WriteFloat(MSG_ENTITY, m_flLastFired); #endif + + return (true); } void diff --git a/src/vgui/ui_button.qc b/src/vgui/ui_button.qc index 88cd54a6..173ea81f 100644 --- a/src/vgui/ui_button.qc +++ b/src/vgui/ui_button.qc @@ -42,6 +42,7 @@ public: /* overrides */ virtual void Draw(void); virtual bool Input(float,float,float,float); + virtual void Spawned(void); private: vector m_vecIMGSize; @@ -81,12 +82,6 @@ VGUIButton::SetIconColor(vector vecColor) m_vecIconColor = vecColor; }; -void -VGUIButton::SetSize(vector vecSize) -{ - m_vecSize = vecSize; -} - void VGUIButton::SetTitle(string strName) {