本文整理汇总了C++中conoutf函数的典型用法代码示例。如果您正苦于以下问题:C++ conoutf函数的具体用法?C++ conoutf怎么用?C++ conoutf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了conoutf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: installtex
bool installtex(int tnum, char *texname, int &xs, int &ys, bool clamp)
{
SDL_Surface *s = IMG_Load(texname);
if(!s) { conoutf("couldn't load texture %s", texname); return false; };
if(s->format->BitsPerPixel!=24) { conoutf("texture must be 24bpp: %s", texname); return false; };
// loopi(s->w*s->h*3) { uchar *p = (uchar *)s->pixels+i; *p = 255-*p; };
glBindTexture(GL_TEXTURE_2D, tnum);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, clamp ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); //NEAREST);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
xs = s->w;
ys = s->h;
while(xs>glmaxtexsize || ys>glmaxtexsize) { xs /= 2; ys /= 2; };
void *scaledimg = s->pixels;
if(xs!=s->w)
{
conoutf("warning: quality loss: scaling %s", texname); // for voodoo cards under linux
scaledimg = alloc(xs*ys*3);
gluScaleImage(GL_RGB, s->w, s->h, GL_UNSIGNED_BYTE, s->pixels, xs, ys, GL_UNSIGNED_BYTE, scaledimg);
};
if(gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, xs, ys, GL_RGB, GL_UNSIGNED_BYTE, scaledimg)) fatal("could not build mipmaps");
if(xs!=s->w) free(scaledimg);
SDL_FreeSurface(s);
return true;
};
示例2: sendmap
void sendmap(char *mapname)
{
if(*mapname) save_world(mapname);
changemap(mapname);
mapname = getclientmap();
int mapsize;
uchar *mapdata = readmap(mapname, &mapsize);
if(!mapdata) return;
ENetPacket *packet = enet_packet_create(NULL, MAXTRANS + mapsize, ENET_PACKET_FLAG_RELIABLE);
uchar *start = packet->data;
uchar *p = start+2;
putint(p, SV_SENDMAP);
sendstring(mapname, p);
putint(p, mapsize);
if(65535 - (p - start) < mapsize)
{
conoutf("map %s is too large to send", mapname);
free(mapdata);
enet_packet_destroy(packet);
return;
};
memcpy(p, mapdata, mapsize);
p += mapsize;
free(mapdata);
*(ushort *)start = ENET_HOST_TO_NET_16(p-start);
enet_packet_resize(packet, p-start);
sendpackettoserv(packet);
conoutf("sending map %s to server...", mapname);
sprintf_sd(msg)("[map %s uploaded to server, \"getmap\" to receive it]", mapname);
toserver(msg);
}
示例3: stopsound
void audiomanager::musicpreload(int id)
{
if(nosound) return;
stopsound();
if(musicvol && (id>=M_FLAGGRAB && id<=M_LASTMINUTE2))
{
char *name = musics[id];
conoutf("preloading music #%d : %s", id, name);
if(gamemusic->open(name))
{
defformatstring(whendone)("musicvol %d", musicvol);
musicdonecmd = newstring(whendone);
//conoutf("when done: %s", musicdonecmd);
const int preloadfadetime = 3;
gamemusic->fadein(lastmillis, preloadfadetime);
gamemusic->fadeout(lastmillis+2*preloadfadetime, preloadfadetime);
if(!gamemusic->playback(false))
{
conoutf("could not play music: %s", name);
return;
}
setmusicvol(1); // not 0 !
}
else conoutf("could not open music: %s", name);
}
else setmusicvol(musicvol); // call "musicpreload -1" to ensure musicdonecmd runs - but it should w/o that
}
示例4: arenarespawn
void arenarespawn()
{
if(arenarespawnwait)
{
if(arenarespawnwait<lastmillis)
{
arenarespawnwait = 0;
conoutf("new round starting... fight!");
respawnself();
};
}
else if(arenadetectwait==0 || arenadetectwait<lastmillis)
{
arenadetectwait = 0;
int alive = 0, dead = 0;
char *lastteam = NULL;
bool oneteam = true;
loopv(players) if(players[i]) arenacount(players[i], alive, dead, lastteam, oneteam);
arenacount(player1, alive, dead, lastteam, oneteam);
if(dead>0 && (alive<=1 || (m_teammode && oneteam)))
{
conoutf("arena round is over! next round in 5 seconds...");
if(alive) conoutf("team %s is last man standing", lastteam);
else conoutf("everyone died!");
arenarespawnwait = lastmillis+5000;
arenadetectwait = lastmillis+10000;
player1->roll = 0;
};
};
示例5: init
void init(fpsent *d, int at, int ocn, int sk, int bn, int pm, const char *name, const char *team)
{
loadwaypoints();
fpsent *o = newclient(ocn);
d->aitype = at;
bool resetthisguy = false;
if(!d->name[0])
{
if(aidebug) conoutf("%s assigned to %s at skill %d", colorname(d, name), o ? colorname(o) : "?", sk);
else conoutf("connected: %s", colorname(d, name));
resetthisguy = true;
}
else
{
if(d->ownernum != ocn)
{
if(aidebug) conoutf("%s reassigned to %s", colorname(d, name), o ? colorname(o) : "?");
resetthisguy = true;
}
if(d->skill != sk && aidebug) conoutf("%s changed skill to %d", colorname(d, name), sk);
}
copystring(d->name, name, MAXNAMELEN+1);
copystring(d->team, team, MAXTEAMLEN+1);
d->ownernum = ocn;
d->skill = sk;
d->playermodel = chooserandomplayermodel(pm);
if(resetthisguy) removeweapons(d);
if(player1->clientnum == d->ownernum) create(d);
else if(d->ai) destroy(d);
}
示例6: run
void run(const char *map) {
if (started) {
conoutf("Stopping old server instance ..");
stop();
}
conoutf("Starting server, please wait ..");
#ifndef WIN32
if (!fork()) {
const char *a0 = "bin_unix/server_" BINARY_OS_STR "_"
BINARY_ARCH_STR;
defformatstring(a1, "-g%s", logger::names[logger::current_level]);
defformatstring(a2, "-l%s", server_log_file);
defformatstring(a3, "-mmap/%s.tar.gz", map);
execl(a0, a0, a1, a2, a3, "-shutdown-if-idle",
"-shutdown-if-empty", (char*)NULL);
exit(0);
}
#else
#ifdef WIN64
const char *exe = "bin_win64\\server_" BINARY_OS_STR "_"
BINARY_ARCH_STR ".exe";
#else
const char *exe = "bin_win32\\server_" BINARY_OS_STR "_"
BINARY_ARCH_STR ".exe";
#endif
char buf[4096];
char *cptr = buf;
defformatstring(a1, "-g%s", logger::names[logger::current_level]);
defformatstring(a2, "-l%s", server_log_file);
defformatstring(a3, "-mmap/%s.tar.gz", map);
const char a4[] = "-shutdown-if-idle";
const char a5[] = "-shutdown-if-empty";
size_t len = strlen(a1);
memcpy(cptr, a1, len); cptr += len; *(cptr++) = ' ';
len = strlen(a2);
memcpy(cptr, a2, len); cptr += len; *(cptr++) = ' ';
len = strlen(a3);
memcpy(cptr, a3, len); cptr += len; *(cptr++) = ' ';
len = sizeof(a4) - 1;
memcpy(cptr, a4, len); cptr += len; *(cptr++) = ' ';
len = sizeof(a5) - 1;
memcpy(cptr, a5, len); cptr += len; *cptr = '\0';
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&si, sizeof(pi));
CreateProcess(exe, buf, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
#endif
started = true;
}
示例7: savegame
void savegame(char *name)
{
if(!m_classicsp) { conoutf("can only save classic sp games"); return; };
sprintf_sd(fn)("savegames/%s.csgz", name);
savestate(fn);
stop();
conoutf("wrote %s", fn);
};
示例8: conoutf
static use *checkuse(int type)
{
if(!loadinguse)
conoutf(CON_ERROR, "\fs\f3ERROR:\fr use not defined or being loaded");
else if(loadinguse->type < type)
conoutf(CON_ERROR, "\fs\f3ERROR:\fr trying to set an unavailable use property");
else
return loadinguse;
return NULL;
}
示例9: paste
void paste()
{
EDITMP;
if(!copybuf) { conoutf("nothing to paste"); return; };
sel.xs = copybuf->xs;
sel.ys = copybuf->ys;
correctsel();
if(!selset || sel.xs!=copybuf->xs || sel.ys!=copybuf->ys) { conoutf("incorrect selection"); return; };
makeundo();
copybuf->x = sel.x;
copybuf->y = sel.y;
blockpaste(*copybuf);
};
示例10: record
void record(char *name)
{
if(m_sp) { conoutf("cannot record singleplayer games"); return; };
int cn = getclientnum();
if(cn<0) return;
sprintf_sd(fn)("demos/%s.cdgz", name);
savestate(fn);
gzputi(cn);
conoutf("started recording demo to %s", fn);
demorecording = true;
starttime = lastmillis;
ddamage = bdamage = 0;
};
示例11: ignorelist
static void ignorelist()
{
if (ips.isempty())
{
conoutf("ip ignore list is empty");
return;
}
conoutf("ignoring %u ip%s", (uint)ips.getsize(), plural(ips.getsize()));
int counter = 0;
ips.loopips(showignoredip, &counter);
}
示例12: conoutf
void Client::initConnect(int cn, int protocol)
{
conoutf("Client::initConnect");
if(protocol!=CubeJ::PROTOCOL_VERSION)
{
conoutf(CON_ERROR, "you are using a different game protocol (you: %d, server: %d)", CubeJ::PROTOCOL_VERSION, protocol);
disconnect();
return;
}
self.clientnum = cn;
CubeJ::MsgDataType<CubeJ::MSG_REQ_CONNECT> data(self.name);
SendMessage(data);
}
示例13: trydisconnect
void trydisconnect()
{
if(connpeer)
{
conoutf("aborting connection attempt");
abortconnect();
}
else if(curpeer)
{
conoutf("attempting to disconnect...");
disconnect(!discmillis);
}
else conoutf("not connected");
}
示例14: trydisconnect
void trydisconnect(bool local)
{
if(connpeer)
{
conoutf("aborting connection attempt");
abortconnect();
}
else if(curpeer)
{
conoutf("attempting to disconnect...");
disconnect(!discmillis);
}
else if(local && haslocalclients()) localdisconnect();
else conoutf("not connected");
}
示例15: takefromplayer
void takefromplayer(char *name, char *ok, char *notok)
{
rpgobj *o = playerobj->take(name);
if(o)
{
stack[0]->add(o, false);
conoutf("\f2you hand over a %s", o->name);
if(currentquest)
{
conoutf("\f2you finish a quest for %s", currentquest->npc);
currentquest->completed = true;
}
}
execute(o ? ok : notok);
}