[nexuiz-commits] r7165 - in trunk/data/qcsrc: client server server/tturrets/system
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jul 8 11:46:36 EDT 2009
Author: div0
Date: 2009-07-08 11:46:36 -0400 (Wed, 08 Jul 2009)
New Revision: 7165
Modified:
trunk/data/qcsrc/client/miscfunctions.qc
trunk/data/qcsrc/client/movetypes.qc
trunk/data/qcsrc/client/sbar.qc
trunk/data/qcsrc/server/bots_scripting.qc
trunk/data/qcsrc/server/tturrets/system/system_misc.qc
Log:
fix warnings
Modified: trunk/data/qcsrc/client/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/client/miscfunctions.qc 2009-07-08 15:38:27 UTC (rev 7164)
+++ trunk/data/qcsrc/client/miscfunctions.qc 2009-07-08 15:46:36 UTC (rev 7165)
@@ -335,7 +335,7 @@
drawfill(pos + (dim_y + thickness) * '0 1 0', line_dim, color, alpha, drawflag);
}
-void drawpic_tiled(vector pos, string pic, vector size, vector area, vector color, float alpha, float drawflag)
+void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float alpha, float drawflag)
{
vector current_pos, end_pos, new_size, ratio;
end_pos = pos + area;
@@ -346,14 +346,14 @@
current_pos_x = pos_x;
while (current_pos_x < end_pos_x)
{
- new_size_x = min(size_x, end_pos_x - current_pos_x);
- new_size_y = min(size_y, end_pos_y - current_pos_y);
- ratio_x = new_size_x / size_x;
- ratio_y = new_size_y / size_y;
+ new_size_x = min(sz_x, end_pos_x - current_pos_x);
+ new_size_y = min(sz_y, end_pos_y - current_pos_y);
+ ratio_x = new_size_x / sz_x;
+ ratio_y = new_size_y / sz_y;
drawsubpic(current_pos, new_size, pic, '0 0 0', ratio, color, alpha, drawflag);
- current_pos_x += size_x;
+ current_pos_x += sz_x;
}
- current_pos_y += size_y;
+ current_pos_y += sz_y;
}
}
Modified: trunk/data/qcsrc/client/movetypes.qc
===================================================================
--- trunk/data/qcsrc/client/movetypes.qc 2009-07-08 15:38:27 UTC (rev 7164)
+++ trunk/data/qcsrc/client/movetypes.qc 2009-07-08 15:46:36 UTC (rev 7165)
@@ -359,7 +359,7 @@
void Movetype_Physics_NoMatchServer() // optimized
{
- float n, i, dt, movedt;
+ float movedt;
movedt = time - self.move_time;
self.move_time = time;
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2009-07-08 15:38:27 UTC (rev 7164)
+++ trunk/data/qcsrc/client/sbar.qc 2009-07-08 15:46:36 UTC (rev 7165)
@@ -894,7 +894,7 @@
* Makes a table for a team (for all playing players in DM) and fills it
*/
-vector Sbar_Scoreboard_MakeTable(vector pos, entity tm, float teamplay, vector rgb, vector bg_size)
+vector Sbar_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
{
float body_table_height, i, pos_x_save;
vector tmp, column_dim;
@@ -1023,7 +1023,7 @@
{
vector rgb, pos, tmp, sbar_save;
entity pl, tm;
- float specs, i;
+ float specs;
float center_x;
if(time > lastpingstime + 10)
@@ -1077,7 +1077,7 @@
if(ts_primary != ts_secondary)
Sbar_DrawXNum(sbar + pos - '4.5 0 0' * sbar_fontsize_y + '0 2.5 0' * sbar_fontsize_y, tm.(teamscores[ts_secondary]), 4, sbar_fontsize_y * 1, rgb, 0, 1, 1, DRAWFLAG_NORMAL);
- pos = Sbar_Scoreboard_MakeTable(pos, tm, teamplay, rgb, bg_size);
+ pos = Sbar_Scoreboard_MakeTable(pos, tm, rgb, bg_size);
}
}
else
@@ -1088,7 +1088,7 @@
tm = teams.sort_next;
- pos = Sbar_Scoreboard_MakeTable(pos, tm, teamplay, rgb, bg_size);
+ pos = Sbar_Scoreboard_MakeTable(pos, tm, rgb, bg_size);
}
tmp = pos + '0 1.5 0' * sbar_fontsize_y;
Modified: trunk/data/qcsrc/server/bots_scripting.qc
===================================================================
--- trunk/data/qcsrc/server/bots_scripting.qc 2009-07-08 15:38:27 UTC (rev 7164)
+++ trunk/data/qcsrc/server/bots_scripting.qc 2009-07-08 15:46:36 UTC (rev 7165)
@@ -65,8 +65,8 @@
#define MAX_BOT_PLACES 4
.float bot_places_count;
-.entity bot_places[MAX_BOT_PLACES];
-.string bot_placenames[MAX_BOT_PLACES];
+.entity bot_places[MAX_BOT_PLACES]; FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(bot_places);
+.string bot_placenames[MAX_BOT_PLACES]; FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(bot_placenames);
entity bot_getplace(string placename)
{
entity e;
@@ -1119,164 +1119,173 @@
bot_barriertime = time;
}
-// This function should be (the only) called directly from the bot ai loop
-// It maps commands to functions and deal with complex interactions between commands and execution states
-// NOTE: Of course you need to include your commands here too :)
-float bot_execute_commands()
+float bot_execute_commands_once()
{
local float status, ispressingkey;
- do
- {
+ if(self.deadflag!=DEAD_NO)
+ return 0;
- if(self.deadflag!=DEAD_NO)
- return FALSE;
+ // Find command
+ bot_setcurrentcommand();
- // Find command
- bot_setcurrentcommand();
+ // Keep pressing keys raised by the "presskey" command
+ ispressingkey = !!bot_presskeys();
- // Keep pressing keys raised by the "presskey" command
- ispressingkey = bot_presskeys();
+ if(bot_cmd==world)
+ return ispressingkey;
- if(bot_cmd==world)
- return ispressingkey;
-
- // Ignore all commands except continue when the bot is paused
- if(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
- if(bot_cmd.bot_cmd_type!=BOT_CMD_CONTINUE)
+ // Ignore all commands except continue when the bot is paused
+ if(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
+ if(bot_cmd.bot_cmd_type!=BOT_CMD_CONTINUE)
+ {
+ if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
{
- if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
- {
- bot_command_executed(TRUE);
- print( "WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.\n");
- }
- return TRUE;
- }
-
- // Handle conditions
- if not(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE)
- if(self.bot_cmd_condition_status & CMD_CONDITION_TRUE && self.bot_cmd_condition_status & CMD_CONDITION_FALSE_BLOCK)
- {
bot_command_executed(TRUE);
- continue;
+ print( "WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.\n");
}
- else if(self.bot_cmd_condition_status & CMD_CONDITION_FALSE && self.bot_cmd_condition_status & CMD_CONDITION_TRUE_BLOCK)
- {
- bot_command_executed(TRUE);
- continue;
- }
+ return 1;
+ }
- // Map commands to functions
- switch(bot_cmd.bot_cmd_type)
- {
- case BOT_CMD_NULL:
- return ispressingkey;
- break;
- case BOT_CMD_PAUSE:
- status = bot_cmd_pause();
- break;
- case BOT_CMD_CONTINUE:
- status = bot_cmd_continue();
- break;
- case BOT_CMD_WAIT:
- status = bot_cmd_wait();
- break;
- case BOT_CMD_WAIT_UNTIL:
- status = bot_cmd_wait_until();
- break;
- case BOT_CMD_TURN:
- status = bot_cmd_turn();
- break;
- case BOT_CMD_MOVETO:
- status = bot_cmd_moveto();
- break;
- case BOT_CMD_MOVETOTARGET:
- status = bot_cmd_movetotarget();
- break;
- case BOT_CMD_RESETGOAL:
- status = bot_cmd_resetgoal();
- break;
- case BOT_CMD_CC:
- status = bot_cmd_cc();
- break;
- case BOT_CMD_IF:
- status = bot_cmd_if();
- break;
- case BOT_CMD_ELSE:
- status = bot_cmd_else();
- break;
- case BOT_CMD_FI:
- status = bot_cmd_fi();
- break;
- case BOT_CMD_RESETAIM:
- status = bot_cmd_resetaim();
- break;
- case BOT_CMD_AIM:
- status = bot_cmd_aim();
- break;
- case BOT_CMD_AIMTARGET:
- status = bot_cmd_aimtarget();
- break;
- case BOT_CMD_PRESSKEY:
- status = bot_cmd_presskey();
- break;
- case BOT_CMD_RELEASEKEY:
- status = bot_cmd_releasekey();
- break;
- case BOT_CMD_SELECTWEAPON:
- status = bot_cmd_select_weapon();
- break;
- case BOT_CMD_IMPULSE:
- status = bot_cmd_impulse();
- break;
- case BOT_CMD_BARRIER:
- status = bot_cmd_barrier();
- break;
- case BOT_CMD_CONSOLE:
- localcmd(strcat(bot_cmd.bot_cmd_parm_string, "\n"));
- status = CMD_STATUS_FINISHED;
- break;
- default:
- print(strcat("ERROR: Invalid command on queue with id '",ftos(bot_cmd.bot_cmd_type),"'\n"));
- return FALSE;
- }
+ // Handle conditions
+ if not(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE)
+ if(self.bot_cmd_condition_status & CMD_CONDITION_TRUE && self.bot_cmd_condition_status & CMD_CONDITION_FALSE_BLOCK)
+ {
+ bot_command_executed(TRUE);
+ return -1;
+ }
+ else if(self.bot_cmd_condition_status & CMD_CONDITION_FALSE && self.bot_cmd_condition_status & CMD_CONDITION_TRUE_BLOCK)
+ {
+ bot_command_executed(TRUE);
+ return -1;
+ }
- if (status==CMD_STATUS_ERROR)
- print(strcat("ERROR: The command '",bot_cmd_string[bot_cmd.bot_cmd_type],"' returned an error status\n"));
+ // Map commands to functions
+ switch(bot_cmd.bot_cmd_type)
+ {
+ case BOT_CMD_NULL:
+ return ispressingkey;
+ break;
+ case BOT_CMD_PAUSE:
+ status = bot_cmd_pause();
+ break;
+ case BOT_CMD_CONTINUE:
+ status = bot_cmd_continue();
+ break;
+ case BOT_CMD_WAIT:
+ status = bot_cmd_wait();
+ break;
+ case BOT_CMD_WAIT_UNTIL:
+ status = bot_cmd_wait_until();
+ break;
+ case BOT_CMD_TURN:
+ status = bot_cmd_turn();
+ break;
+ case BOT_CMD_MOVETO:
+ status = bot_cmd_moveto();
+ break;
+ case BOT_CMD_MOVETOTARGET:
+ status = bot_cmd_movetotarget();
+ break;
+ case BOT_CMD_RESETGOAL:
+ status = bot_cmd_resetgoal();
+ break;
+ case BOT_CMD_CC:
+ status = bot_cmd_cc();
+ break;
+ case BOT_CMD_IF:
+ status = bot_cmd_if();
+ break;
+ case BOT_CMD_ELSE:
+ status = bot_cmd_else();
+ break;
+ case BOT_CMD_FI:
+ status = bot_cmd_fi();
+ break;
+ case BOT_CMD_RESETAIM:
+ status = bot_cmd_resetaim();
+ break;
+ case BOT_CMD_AIM:
+ status = bot_cmd_aim();
+ break;
+ case BOT_CMD_AIMTARGET:
+ status = bot_cmd_aimtarget();
+ break;
+ case BOT_CMD_PRESSKEY:
+ status = bot_cmd_presskey();
+ break;
+ case BOT_CMD_RELEASEKEY:
+ status = bot_cmd_releasekey();
+ break;
+ case BOT_CMD_SELECTWEAPON:
+ status = bot_cmd_select_weapon();
+ break;
+ case BOT_CMD_IMPULSE:
+ status = bot_cmd_impulse();
+ break;
+ case BOT_CMD_BARRIER:
+ status = bot_cmd_barrier();
+ break;
+ case BOT_CMD_CONSOLE:
+ localcmd(strcat(bot_cmd.bot_cmd_parm_string, "\n"));
+ status = CMD_STATUS_FINISHED;
+ break;
+ default:
+ print(strcat("ERROR: Invalid command on queue with id '",ftos(bot_cmd.bot_cmd_type),"'\n"));
+ return 0;
+ }
- // Move execution pointer
- if(status==CMD_STATUS_EXECUTING)
+ if (status==CMD_STATUS_ERROR)
+ print(strcat("ERROR: The command '",bot_cmd_string[bot_cmd.bot_cmd_type],"' returned an error status\n"));
+
+ // Move execution pointer
+ if(status==CMD_STATUS_EXECUTING)
+ {
+ return 1;
+ }
+ else
+ {
+ if(cvar("g_debug_bot_commands"))
{
- return TRUE;
- }
- else
- {
- if(cvar("g_debug_bot_commands"))
+ local string parms;
+
+ switch(bot_cmd_parm_type[bot_cmd.bot_cmd_type])
{
- local string parms;
-
- switch(bot_cmd_parm_type[bot_cmd.bot_cmd_type])
- {
- case BOT_CMD_PARAMETER_FLOAT:
- parms = ftos(bot_cmd.bot_cmd_parm_float);
- break;
- case BOT_CMD_PARAMETER_STRING:
- parms = bot_cmd.bot_cmd_parm_string;
- break;
- case BOT_CMD_PARAMETER_VECTOR:
- parms = vtos(bot_cmd.bot_cmd_parm_vector);
- break;
- default:
- parms = "";
- break;
- }
- clientcommand(self,strcat("say ^7", bot_cmd_string[bot_cmd.bot_cmd_type]," ",parms,"\n"));
+ case BOT_CMD_PARAMETER_FLOAT:
+ parms = ftos(bot_cmd.bot_cmd_parm_float);
+ break;
+ case BOT_CMD_PARAMETER_STRING:
+ parms = bot_cmd.bot_cmd_parm_string;
+ break;
+ case BOT_CMD_PARAMETER_VECTOR:
+ parms = vtos(bot_cmd.bot_cmd_parm_vector);
+ break;
+ default:
+ parms = "";
+ break;
}
-
- bot_command_executed(TRUE);
+ clientcommand(self,strcat("say ^7", bot_cmd_string[bot_cmd.bot_cmd_type]," ",parms,"\n"));
}
- } while(status==CMD_STATUS_FINISHED);
+ bot_command_executed(TRUE);
+ }
- return status;
+ if(status == CMD_STATUS_FINISHED)
+ return -1;
+
+ return CMD_STATUS_ERROR;
}
+
+// This function should be (the only) called directly from the bot ai loop
+// It maps commands to functions and deal with complex interactions between commands and execution states
+// NOTE: Of course you need to include your commands here too :)
+float bot_execute_commands()
+{
+ float f;
+ do
+ {
+ f = bot_execute_commands_once();
+ }
+ while(f < 0);
+ return f;
+}
Modified: trunk/data/qcsrc/server/tturrets/system/system_misc.qc
===================================================================
--- trunk/data/qcsrc/server/tturrets/system/system_misc.qc 2009-07-08 15:38:27 UTC (rev 7164)
+++ trunk/data/qcsrc/server/tturrets/system/system_misc.qc 2009-07-08 15:46:36 UTC (rev 7165)
@@ -365,6 +365,15 @@
trace_endpos = endpoint;
}
+void turrets_precache_debug_models()
+{
+ precache_model ("models/turrets/c512.md3");
+ precache_model ("models/pathlib/goodsquare.md3");
+ precache_model ("models/pathlib/badsquare.md3");
+ precache_model ("models/pathlib/square.md3");
+ precache_model ("models/pathlib/edge.md3");
+}
+
void turrets_precash()
{
precache_model ("models/turrets/base-gib1.md3");
@@ -395,12 +404,5 @@
//precache_model ("models/turrets/plasma.md3");
//precache_model ("models/turrets/tesla_head.md3");
//precache_model ("models/turrets/tesla_base.md3");
-
-#if 0
- precache_model ("models/turrets/c512.md3");
- precache_model ("models/pathlib/goodsquare.md3");
- precache_model ("models/pathlib/badsquare.md3");
- precache_model ("models/pathlib/square.md3");
- precache_model ("models/pathlib/edge.md3");
-#endif
+ //turrets_precache_debug_models();
}
More information about the nexuiz-commits
mailing list