Fix various compiler warnings.

This commit is contained in:
Marco Cawthorne 2023-02-14 12:54:06 -08:00
parent c939e790e8
commit 86dfb3ff1a
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
18 changed files with 106 additions and 71 deletions

Binary file not shown.

View File

@ -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++) {

View File

@ -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);

View File

@ -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();

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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" \

View File

@ -206,8 +206,6 @@ void
ambient_generic::Spawned(void)
{
super::Spawned();
precache_sound("common/null.wav");
}
void

View File

@ -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);

View File

@ -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
}

View File

@ -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
{

View File

@ -57,4 +57,5 @@ Achievement_IndicateProgress(string strName, int iCurrent, int iMax)
bool
Achievement_RequestStats(achievement_t *ptr, int count)
{
return false;
}

View File

@ -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);

View File

@ -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")

View File

@ -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)

View File

@ -260,6 +260,8 @@ private:
float m_flSeeTime;
/* animation cycles */
float m_flAnimTime;
nonvirtual void _LerpTurnToEnemy(float);
#endif
public:

View File

@ -85,6 +85,8 @@ NSWeapon::SendEntity(entity ePEnt, float flChanged)
WriteFloat(MSG_ENTITY, m_flSecondaryNext);
WriteFloat(MSG_ENTITY, m_flLastFired);
#endif
return (true);
}
void

View File

@ -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)
{