本文整理汇总了C++中G_bprint函数的典型用法代码示例。如果您正苦于以下问题:C++ G_bprint函数的具体用法?C++ G_bprint怎么用?C++ G_bprint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_bprint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VoteYes
void VoteYes()
{
int votes;
if( !get_votes( OV_ELECT ) )
return;
if( self->v.elect_type != etNone ) {
G_sprint(self, 2, "You cannot vote for yourself\n");
return;
}
if( self->v.elect ) {
G_sprint(self, 2, "--- your vote is still good ---\n");
return;
}
// register the vote
self->v.elect = 1;
G_bprint(2, "%s gives %s vote\n", self->s.v.netname, g_his( self ));
// calculate how many more votes are needed
if ( (votes = get_votes_req( OV_ELECT, true )) )
G_bprint(2, "\x90%d\x91 more vote%s needed\n", votes, count_s( votes ));
vote_check_elect ();
}
示例2: ReadyThink
void ReadyThink ()
{
float i1;
char *txt, *gr;
gedict_t *p=NULL, *p2=NULL;
p2 = PROG_TO_EDICT( self->s.v.owner );
if( ( p2->ct == ctPlayer && !( p2->ready ) ) // forcestart breaked via break command
|| ( p2->ct == ctSpec && !k_force ) // forcestart breaked via forcebreak command (spectator admin)
)
{
k_force = 0;
G_bprint(2, "%s interrupts countdown\n", p2->netname );
ent_remove ( self );
return;
}
k_attendees = CountPlayers();
if ( !isCanStart(NULL, true) ) {
k_force = 0;
G_bprint(2, "Forcestart canceled\n");
ent_remove ( self );
return;
}
self->attack_finished--;
i1 = self->attack_finished;
if( i1 <= 0 )
{
k_force = 0;
AdminMatchStart();
ent_remove ( self );
return;
}
txt = va( "%s second%s left before game starts", dig3( i1 ), ( i1 == 1 ? "" : "s") );
gr = va( "\n%s!", redtext("Get ready") );
for( p = world; (p = find_client( p )); )
if ( p->ct == ctPlayer )
G_centerprint(p, "%s%s", txt, (p->ready ? "" : gr));
else
G_centerprint(p, "%s", txt);
self->s.v.nextthink = g_globalvars.time + 1;
}
示例3: vote_check_coop
// { votecoop
void vote_check_coop ()
{
int veto;
if ( ( deathmatch && match_in_progress ) || intermission_running || match_over )
return;
if ( !get_votes( OV_COOP ) )
return;
veto = is_admins_vote( OV_COOP );
if( veto || !get_votes_req( OV_COOP, true ) )
{
vote_clear( OV_COOP );
// toggle coop mode
cvar_fset( "coop", coop = !cvar("coop") );
// set appropriate deathmatch
cvar_fset( "deathmatch", deathmatch = !coop );
if ( veto )
G_bprint( 2, "%s\n", redtext(va("Coop mode %s by admin veto", OnOff(cvar("coop")))) );
else
G_bprint( 2, "%s\n", redtext(va("Coop mode %s by majority vote", OnOff(cvar("coop")))) );
// and reload map
if ( cvar("k_bloodfest") )
changelevel( coop ? g_globalvars.mapname : cvar_string( "k_defmap" ) );
else
changelevel( coop ? "start" : g_globalvars.mapname );
return;
}
}
示例4: AdminMatchStart
void AdminMatchStart ()
{
gedict_t *p;
int i = 0;
for( p = world; (p = find_plr( p )); )
{
if( p->ready ) {
i++;
}
else
{
G_bprint(2, "%s was kicked by admin forcestart\n", p->netname);
G_sprint(p, 2, "Bye bye! Pay attention next time.\n");
stuffcmd(p, "disconnect\n"); // FIXME: stupid way
}
}
k_attendees = i;
if( k_attendees ) {
StartTimer();
}
else
{
G_bprint(2, "Can't start! More players needed.\n");
EndMatch( 1 );
}
}
示例5: vote_check_pickup
// !!! do not confuse rpickup and pickup
void vote_check_pickup ()
{
gedict_t *p;
int veto;
if ( match_in_progress || k_captains )
return;
if ( !get_votes( OV_PICKUP ) )
return;
veto = is_admins_vote( OV_PICKUP );
if( veto || !get_votes_req( OV_PICKUP, true ) ) {
vote_clear( OV_PICKUP );
if ( veto )
G_bprint(2, "console: admin veto for pickup\n");
else
G_bprint(2, "console: a pickup game it is then\n");
for( p = world; (p = find_plr( p )); ) {
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO,
"break\n"
"color 0\n"
"team \"\"\n"
"skin base\n");
}
return;
}
}
示例6: ToggleMapLock
void ToggleMapLock ()
{
float tmp;
if( !is_adm( self ) )
return;
tmp = cvar( "k_lockmap" );
if( tmp )
{
cvar_fset( "k_lockmap", 0 );
if( !match_in_progress )
G_bprint(2, "%s unlocks map\n", self->netname);
else
G_sprint(self, 2, "Map unlocked\n");
return;
}
cvar_fset( "k_lockmap", 1 );
if( !match_in_progress )
G_bprint(2, "%s locks map\n", self->netname);
else
G_sprint(self, 2, "Map is locked\n");
}
示例7: DoKick
qbool DoKick(gedict_t *victim, gedict_t *kicker)
{
if (!victim || !kicker)
return false;
if( victim == kicker )
{
G_bprint(2, "%s kicked %s\n", getname(kicker), g_himself( kicker ));
// hehe
G_sprint(kicker, 2, "Say \"bye\" and then type \"disconnect\" next time\n");
stuffcmd(kicker, "disconnect\n"); // FIXME: stupid way
if ( !FTE_sv )
localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
}
else
{
if ( !is_can_kick(victim, kicker) )
return false;
G_bprint(2, "%s was kicked by %s\n", getname(victim), getname(kicker));
G_sprint(victim, 2, "You were kicked from the server\n");
stuffcmd(victim, "disconnect\n"); // FIXME: stupid way
if ( !FTE_sv )
localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
}
return true;
}
示例8: vote_check_antilag
void vote_check_antilag ()
{
int veto;
if ( match_in_progress || intermission_running || match_over )
return;
if ( !get_votes( OV_ANTILAG ) )
return;
veto = is_admins_vote( OV_ANTILAG );
if( veto || !get_votes_req( OV_ANTILAG, true ) )
{
vote_clear( OV_ANTILAG );
// toggle antilag mode.
trap_cvar_set_float( "sv_antilag", (float)(cvar( "sv_antilag" ) ? 0 : 2));
if ( veto )
G_bprint(2, "%s\n", redtext(va("Antilag mode %s by admin veto", OnOff(2 == cvar("sv_antilag")))));
else
G_bprint(2, "%s\n", redtext(va("Antilag mode %s by majority vote", OnOff(2 == cvar("sv_antilag")))));
return;
}
}
示例9: vote_check_teamoverlay
void vote_check_teamoverlay ()
{
int veto;
if ( match_in_progress || intermission_running || match_over )
return;
if ( !get_votes( OV_TEAMOVERLAY ) )
return;
veto = is_admins_vote( OV_TEAMOVERLAY );
if( veto || !get_votes_req( OV_TEAMOVERLAY, true ) )
{
vote_clear( OV_TEAMOVERLAY );
// Toggle teamoverlay.
cvar_fset("k_teamoverlay", !cvar("k_teamoverlay"));
if ( veto )
G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by admin veto", OnOff(cvar("k_teamoverlay")))));
else
G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by majority vote", OnOff(cvar("k_teamoverlay")))));
return;
}
}
示例10: vote_check_rpickup
// !!! do not confuse rpickup and pickup
void vote_check_rpickup ()
{
float frnd;
int i, tn, pl_cnt, pl_idx;
gedict_t *p;
int veto;
if ( match_in_progress || k_captains )
return;
if ( !get_votes( OV_RPICKUP ) )
return;
// Firstly obtain the number of players we have in total on server
pl_cnt = CountPlayers();
if ( pl_cnt < 4 )
return;
veto = is_admins_vote( OV_RPICKUP );
if( veto || !get_votes_req( OV_RPICKUP, true ) ) {
vote_clear( OV_RPICKUP );
for( p = world; (p = find_plr( p )); )
p->k_teamnumber = 0;
for( tn = 1; pl_cnt > 0; pl_cnt-- ) {
frnd = g_random(); // bound is macros - so u _can't_ put g_random inside bound
pl_idx = bound(0, (int)( frnd * pl_cnt ), pl_cnt-1 ); // select random player between 0 and pl_cnt
for( i = 0, p = world; (p = find_plr( p )); ) {
if ( p->k_teamnumber )
continue;
if ( i == pl_idx ) {
p->k_teamnumber = tn;
tn = (tn == 1 ? 2 : 1); // next random player will be in other team
if( p->k_teamnumber == 1 )
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "break\ncolor 4\nskin \"\"\nteam red\n");
else
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "break\ncolor 13\nskin \"\"\nteam blue\n");
break;
}
i++;
}
}
if ( veto )
G_bprint(2, "console: admin veto for %s\n", redtext("random pickup"));
else
G_bprint(2, "console: %s game it is then\n", redtext("random pickup"));
return;
}
}
示例11: BotImpulseMenu
int BotImpulseMenu()
{
int subItem = 0;
subItem = self->nextimpulse;
self->nextimpulse = 0;
switch ( self->current_menu )
{
case MENU_TEAM:
if( self->bot_lastmenu == MENU_TEAM )
{
if( self->bot_lastmenucount++ > 5)
{
G_bprint(2,"%s :cannot join team %d\n",self->s.v.netname, self->bot_team);
botDisconnect( self );
return 0;
}
}else
{
self->bot_lastmenu = MENU_TEAM;
self->bot_lastmenucount = 1;
}
return self->bot_team;
case MENU_CLASS:
if( self->bot_lastmenu == MENU_CLASS )
{
if( self->bot_lastmenucount++ > 5)
{
G_bprint(2,"%s :cannot select class %d\n",self->s.v.netname, self->bot_skin);
botDisconnect( self );
return 0;
}
}else
{
self->bot_lastmenu = MENU_CLASS;
self->bot_lastmenucount = 1;
}
return self->bot_skin;
case MENU_SPY:
return 4;
case MENU_SPY_SKIN:
return 8;
case MENU_SPY_COLOR:
return self->bot_team;
case MENU_ENGINEER:
return ( subItem ) ? subItem : 4;
case MENU_ENGINEER_FIX_SENTRYGUN:
return ( subItem ) ? ( self->s.v.button0 = 0, subItem ) : 5;
case MENU_DISPENSER:
return 3;
default:
return self->s.v.impulse;
}
}
示例12: sv_lock
void sv_lock ()
{
int lock_time = 15;
if ( !k_sv_locktime ) {
G_bprint(2, "%s %s for %s seconds\n",
getname(self), redtext("locked server"), dig3(lock_time));
k_sv_locktime = g_globalvars.time + lock_time;
}
else {
G_bprint(2, "%s %s\n", getname(self), redtext("unlocked server"));
k_sv_locktime = 0;
}
}
示例13: Vote_Elect_Yes
void Vote_Elect_Yes()
{
int f1, needed_votes;
gedict_t* p = world;
if(!k_vote) return;
if(self->k_voted) {
G_sprint(self, 2, "--- your vote is still good ---\n");
return;
}
// register the vote
k_vote ++;
G_bprint(2, "%s gives his vote\n",self->s.v.netname);
f1 = CountPlayers();
needed_votes = (int)(f1 * elect_percentage / 100)+1 - k_vote;
//if( elect_percentage * f1 < 100 * k_vote )
if( needed_votes < 1)
{
k_vote = 0;
current_vote = -1;
while((p = trap_find(p, FOFS(s.v.classname), "player")))
{
if( p->s.v.netname[0] ) p->k_voted = 0;
}
p = trap_find(world, FOFS(s.v.classname), "voteguard");
if(p) {
p->s.v.classname = "";
dremove(p);
}
G_bprint(2, "%s ηαιξσ αδνιξ στατυσ!\n", elect_player->s.v.netname);
G_sprint(elect_player, 2, "Type γνδ αδνιξ for admin commands.\n");
elect_player->is_admin = elect_level;
return;
}
// calculate how many more votes are needed
self->k_voted = 1;
if( needed_votes > 1)
G_bprint(2, "%d total votes needed\nType ", needed_votes);
else
G_bprint(2, "%d total vote needed\nType ", needed_votes);
}
示例14: BotMoveTowardsLinkedMarker
static void BotMoveTowardsLinkedMarker(gedict_t* self, vec3_t dir_move) {
vec3_t temp;
gedict_t* goalentity_ = &g_edicts[self->s.v.goalentity];
gedict_t* linked = self->fb.linked_marker;
qbool onGround = ((int)self->s.v.flags & FL_ONGROUND);
qbool curlJump = ((int)self->fb.path_state & BOTPATH_CURLJUMP_HINT);
VectorAdd(linked->s.v.absmin, linked->s.v.view_ofs, temp);
VectorSubtract(temp, self->s.v.origin, temp);
normalize(temp, dir_move);
if (curlJump && (onGround || self->s.v.velocity[2] > 0)) {
vec3_t up = { 0, 0, 1 };
if (self->isBot && self->fb.debug_path) {
G_bprint (PRINT_HIGH, "%3.2f: Moving %3d > %3d, dir %3.1f %3.1f %3.1f\n", g_globalvars.time, self->fb.touch_marker->fb.index + 1, self->fb.linked_marker->fb.index + 1, PASSVEC3 (dir_move));
}
RotatePointAroundVector (dir_move, up, dir_move, self->fb.angle_hint);
if (self->isBot && self->fb.debug_path) {
G_bprint (PRINT_HIGH, "%3.2f: Rotating %d, %3.1f %3.1f %3.1f\n", g_globalvars.time, self->fb.angle_hint, PASSVEC3 (dir_move));
}
}
if (self->isBot && self->fb.debug_path) {
//G_bprint (PRINT_HIGH, "%3.2f: Moving %3d > %3d, dir %3.1f %3.1f %3.1f\n", g_globalvars.time, self->fb.touch_marker->fb.index + 1, self->fb.linked_marker->fb.index + 1, PASSVEC3 (dir_move));
}
if (self->fb.path_state & DELIBERATE_BACKUP) {
if (linked->fb.arrow_time > g_globalvars.time) {
VectorInverse (dir_move);
}
else {
self->fb.path_state &= ~DELIBERATE_BACKUP;
}
}
else if (linked == self->fb.touch_marker) {
if (goalentity_ == self->fb.touch_marker) {
if (WaitingToRespawn(self->fb.touch_marker)) {
VectorClear(dir_move);
}
}
else {
VectorClear(dir_move);
}
}
}
示例15: FlagThink
void FlagThink()
{
if ( !isCTF() )
return;
self->s.v.nextthink = g_globalvars.time + 0.1;
if (self->cnt == FLAG_AT_BASE)
return;
if (self->cnt == FLAG_DROPPED)
{
self->cnt2 += 0.1;
if ( g_globalvars.time > self->super_time )
{
RegenFlag( self );
G_bprint( 2, "The %s flag has been returned\n", redtext( ( (int) self->s.v.items & IT_KEY1) ? "BLUE" : "RED" ) );
}
return;
}
if (self->cnt == FLAG_RETURNED)
{
setorigin( self, PASSVEC3(self->s.v.oldorigin) );
self->cnt = FLAG_AT_BASE;
return;
}
self->cnt2 += 0.1;
}