Make conoutf take an OFString
FossilOrigin-Name: f8f97851f3ec3f0920a95912e7bfe58995f5ca1bcd4c5b5ee3532cb1809eab46
This commit is contained in:
parent
faf0a4096e
commit
7f42da935a
21 changed files with 240 additions and 221 deletions
|
@ -13,25 +13,28 @@ int
|
|||
getclientnum()
|
||||
{
|
||||
return clientnum;
|
||||
};
|
||||
}
|
||||
|
||||
bool
|
||||
multiplayer()
|
||||
{
|
||||
// check not correct on listen server?
|
||||
if (clienthost)
|
||||
conoutf("operation not available in multiplayer");
|
||||
conoutf(@"operation not available in multiplayer");
|
||||
|
||||
return clienthost != NULL;
|
||||
};
|
||||
}
|
||||
|
||||
bool
|
||||
allowedittoggle()
|
||||
{
|
||||
bool allow = !clienthost || gamemode == 1;
|
||||
|
||||
if (!allow)
|
||||
conoutf("editing in multiplayer requires coopedit mode (1)");
|
||||
conoutf(@"editing in multiplayer requires coopedit mode (1)");
|
||||
|
||||
return allow;
|
||||
};
|
||||
}
|
||||
|
||||
VARF(rate, 0, 0, 25000,
|
||||
if (clienthost && (!rate || rate > 1000))
|
||||
|
@ -51,20 +54,21 @@ throttle()
|
|||
assert(ENET_PEER_PACKET_THROTTLE_SCALE == 32);
|
||||
enet_peer_throttle_configure(clienthost->peers,
|
||||
throttle_interval * 1000, throttle_accel, throttle_decel);
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
newname(char *name)
|
||||
{
|
||||
c2sinit = false;
|
||||
strn0cpy(player1->name, name, 16);
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
newteam(char *name)
|
||||
{
|
||||
c2sinit = false;
|
||||
strn0cpy(player1->team, name, 5);
|
||||
};
|
||||
}
|
||||
|
||||
COMMANDN(team, newteam, ARG_1STR);
|
||||
COMMANDN(name, newname, ARG_1STR);
|
||||
|
@ -73,7 +77,7 @@ void
|
|||
writeclientinfo(FILE *f)
|
||||
{
|
||||
fprintf(f, "name \"%s\"\nteam \"%s\"\n", player1->name, player1->team);
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
connects(char *servername)
|
||||
|
@ -81,10 +85,10 @@ connects(char *servername)
|
|||
disconnect(1); // reset state
|
||||
addserver(servername);
|
||||
|
||||
conoutf("attempting to connect to %s", servername);
|
||||
conoutf(@"attempting to connect to %s", servername);
|
||||
ENetAddress address = {ENET_HOST_ANY, CUBE_SERVER_PORT};
|
||||
if (enet_address_set_host(&address, servername) < 0) {
|
||||
conoutf("could not resolve server %s", servername);
|
||||
conoutf(@"could not resolve server %s", servername);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -96,10 +100,10 @@ connects(char *servername)
|
|||
connecting = lastmillis;
|
||||
connattempts = 0;
|
||||
} else {
|
||||
conoutf("could not connect to server");
|
||||
conoutf(@"could not connect to server");
|
||||
disconnect();
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
disconnect(int onlyclean, int async)
|
||||
|
@ -119,7 +123,7 @@ disconnect(int onlyclean, int async)
|
|||
};
|
||||
|
||||
if (clienthost && !connecting)
|
||||
conoutf("disconnected");
|
||||
conoutf(@"disconnected");
|
||||
clienthost = NULL;
|
||||
connecting = 0;
|
||||
connattempts = 0;
|
||||
|
@ -134,37 +138,38 @@ disconnect(int onlyclean, int async)
|
|||
if (!onlyclean) {
|
||||
stop();
|
||||
localconnect();
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
trydisconnect()
|
||||
{
|
||||
if (!clienthost) {
|
||||
conoutf("not connected");
|
||||
conoutf(@"not connected");
|
||||
return;
|
||||
};
|
||||
}
|
||||
if (connecting) {
|
||||
conoutf("aborting connection attempt");
|
||||
conoutf(@"aborting connection attempt");
|
||||
disconnect();
|
||||
return;
|
||||
};
|
||||
conoutf("attempting to disconnect...");
|
||||
}
|
||||
conoutf(@"attempting to disconnect...");
|
||||
disconnect(0, !disconnecting);
|
||||
};
|
||||
}
|
||||
|
||||
string ctext;
|
||||
void
|
||||
toserver(char *text)
|
||||
{
|
||||
conoutf("%s:\f %s", player1->name, text);
|
||||
conoutf(@"%s:\f %s", player1->name, text);
|
||||
strn0cpy(ctext, text, 80);
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
echo(char *text)
|
||||
{
|
||||
conoutf("%s", text);
|
||||
};
|
||||
conoutf(@"%s", text);
|
||||
}
|
||||
|
||||
COMMAND(echo, ARG_VARI);
|
||||
COMMANDN(say, toserver, ARG_VARI);
|
||||
|
@ -186,7 +191,7 @@ addmsg(int rel, int num, int type, ...)
|
|||
fatal(s);
|
||||
};
|
||||
if (messages.length() == 100) {
|
||||
conoutf("command flood protection (type %d)", type);
|
||||
conoutf(@"command flood protection (type %d)", type);
|
||||
return;
|
||||
};
|
||||
ivector &msg = messages.add();
|
||||
|
@ -197,14 +202,14 @@ addmsg(int rel, int num, int type, ...)
|
|||
va_start(marker, type);
|
||||
loopi(num - 1) msg.add(va_arg(marker, int));
|
||||
va_end(marker);
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
server_err()
|
||||
{
|
||||
conoutf("server network error, disconnecting...");
|
||||
conoutf(@"server network error, disconnecting...");
|
||||
disconnect();
|
||||
};
|
||||
}
|
||||
|
||||
int lastupdate = 0, lastping = 0;
|
||||
string toservermap;
|
||||
|
@ -345,11 +350,11 @@ gets2c() // get updates from the server
|
|||
if (!clienthost)
|
||||
return;
|
||||
if (connecting && lastmillis / 3000 > connecting / 3000) {
|
||||
conoutf("attempting to connect...");
|
||||
conoutf(@"attempting to connect...");
|
||||
connecting = lastmillis;
|
||||
++connattempts;
|
||||
if (connattempts > 3) {
|
||||
conoutf("could not connect to server");
|
||||
conoutf(@"could not connect to server");
|
||||
disconnect();
|
||||
return;
|
||||
};
|
||||
|
@ -358,14 +363,14 @@ gets2c() // get updates from the server
|
|||
clienthost != NULL && enet_host_service(clienthost, &event, 0) > 0)
|
||||
switch (event.type) {
|
||||
case ENET_EVENT_TYPE_CONNECT:
|
||||
conoutf("connected to server");
|
||||
conoutf(@"connected to server");
|
||||
connecting = 0;
|
||||
throttle();
|
||||
break;
|
||||
|
||||
case ENET_EVENT_TYPE_RECEIVE:
|
||||
if (disconnecting)
|
||||
conoutf("attempting to disconnect...");
|
||||
conoutf(@"attempting to disconnect...");
|
||||
else
|
||||
localservertoclient(event.packet->data,
|
||||
event.packet->dataLength);
|
||||
|
|
|
@ -179,7 +179,7 @@ sendmap(char *mapname)
|
|||
sendstring(mapname, p);
|
||||
putint(p, mapsize);
|
||||
if (65535 - (p - start) < mapsize) {
|
||||
conoutf("map %s is too large to send", mapname);
|
||||
conoutf(@"map %s is too large to send", mapname);
|
||||
free(mapdata);
|
||||
enet_packet_destroy(packet);
|
||||
return;
|
||||
|
@ -190,7 +190,7 @@ sendmap(char *mapname)
|
|||
*(ushort *)start = ENET_HOST_TO_NET_16(p - start);
|
||||
enet_packet_resize(packet, p - start);
|
||||
sendpackettoserv(packet);
|
||||
conoutf("sending map %s to server...", mapname);
|
||||
conoutf(@"sending map %s to server...", mapname);
|
||||
sprintf_sd(msg)(
|
||||
"[map %s uploaded to server, \"getmap\" to receive it]", mapname);
|
||||
toserver(msg);
|
||||
|
@ -207,7 +207,7 @@ getmap()
|
|||
*(ushort *)start = ENET_HOST_TO_NET_16(p - start);
|
||||
enet_packet_resize(packet, p - start);
|
||||
sendpackettoserv(packet);
|
||||
conoutf("requesting map from server...");
|
||||
conoutf(@"requesting map from server...");
|
||||
}
|
||||
|
||||
COMMAND(sendmap, ARG_1STR);
|
||||
|
|
|
@ -158,7 +158,7 @@ arenarespawn()
|
|||
if (arenarespawnwait) {
|
||||
if (arenarespawnwait < lastmillis) {
|
||||
arenarespawnwait = 0;
|
||||
conoutf("new round starting... fight!");
|
||||
conoutf(@"new round starting... fight!");
|
||||
respawnself();
|
||||
};
|
||||
} else if (arenadetectwait == 0 || arenadetectwait < lastmillis) {
|
||||
|
@ -171,12 +171,12 @@ arenarespawn()
|
|||
arenacount(player1, alive, dead, lastteam, oneteam);
|
||||
if (dead > 0 && (alive <= 1 || (m_teammode && oneteam))) {
|
||||
conoutf(
|
||||
"arena round is over! next round in 5 seconds...");
|
||||
@"arena round is over! next round in 5 seconds...");
|
||||
if (alive)
|
||||
conoutf(
|
||||
"team %s is last man standing", lastteam);
|
||||
@"team %s is last man standing", lastteam);
|
||||
else
|
||||
conoutf("everyone died!");
|
||||
conoutf(@"everyone died!");
|
||||
arenarespawnwait = lastmillis + 5000;
|
||||
arenadetectwait = lastmillis + 10000;
|
||||
player1->roll = 0;
|
||||
|
@ -218,7 +218,7 @@ respawn()
|
|||
if (player1->state == CS_DEAD) {
|
||||
player1->attacking = false;
|
||||
if (m_arena) {
|
||||
conoutf("waiting for new round to start...");
|
||||
conoutf(@"waiting for new round to start...");
|
||||
return;
|
||||
};
|
||||
if (m_sp) {
|
||||
|
@ -299,8 +299,8 @@ entinmap(dynent *
|
|||
d->o.x -= dx;
|
||||
d->o.y -= dy;
|
||||
};
|
||||
conoutf(
|
||||
"can't find entity spawn spot! (%d, %d)", (int)d->o.x, (int)d->o.y);
|
||||
conoutf(@"can't find entity spawn spot! (%d, %d)", (int)d->o.x,
|
||||
(int)d->o.y);
|
||||
// leave ent at original pos, possibly stuck
|
||||
};
|
||||
|
||||
|
@ -422,24 +422,24 @@ selfdamage(int damage, int actor, dynent *act)
|
|||
// on amount of damage
|
||||
if ((player1->health -= damage) <= 0) {
|
||||
if (actor == -2) {
|
||||
conoutf("you got killed by %s!", act->name);
|
||||
conoutf(@"you got killed by %s!", act->name);
|
||||
} else if (actor == -1) {
|
||||
actor = getclientnum();
|
||||
conoutf("you suicided!");
|
||||
conoutf(@"you suicided!");
|
||||
addmsg(1, 2, SV_FRAGS, --player1->frags);
|
||||
} else {
|
||||
dynent *a = getclient(actor);
|
||||
if (a) {
|
||||
if (isteam(a->team, player1->team)) {
|
||||
conoutf("you got fragged by a teammate "
|
||||
"(%s)",
|
||||
conoutf(@"you got fragged by a "
|
||||
@"teammate (%s)",
|
||||
a->name);
|
||||
} else {
|
||||
conoutf(
|
||||
"you got fragged by %s", a->name);
|
||||
};
|
||||
};
|
||||
};
|
||||
@"you got fragged by %s", a->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
showscores(true);
|
||||
addmsg(1, 2, SV_DIED, actor);
|
||||
player1->lifesequence++;
|
||||
|
@ -452,8 +452,8 @@ selfdamage(int damage, int actor, dynent *act)
|
|||
player1->lastaction = lastmillis;
|
||||
} else {
|
||||
playsound(S_PAIN6);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
timeupdate(int timeremain)
|
||||
|
@ -461,13 +461,13 @@ timeupdate(int timeremain)
|
|||
if (!timeremain) {
|
||||
intermission = true;
|
||||
player1->attacking = false;
|
||||
conoutf("intermission:");
|
||||
conoutf("game has ended!");
|
||||
conoutf(@"intermission:");
|
||||
conoutf(@"game has ended!");
|
||||
showscores(true);
|
||||
} else {
|
||||
conoutf("time remaining: %d minutes", timeremain);
|
||||
};
|
||||
};
|
||||
conoutf(@"time remaining: %d minutes", timeremain);
|
||||
}
|
||||
}
|
||||
|
||||
dynent *
|
||||
getclient(int cn) // ensure valid entity
|
||||
|
@ -479,7 +479,7 @@ getclient(int cn) // ensure valid entity
|
|||
while (cn >= players.length())
|
||||
players.add(NULL);
|
||||
return players[cn] ? players[cn] : (players[cn] = newdynent());
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
initclient()
|
||||
|
@ -493,8 +493,8 @@ startmap(char *name) // called just after a map load
|
|||
{
|
||||
if (netmapstart() && m_sp) {
|
||||
gamemode = 0;
|
||||
conoutf("coop sp not supported yet");
|
||||
};
|
||||
conoutf(@"coop sp not supported yet");
|
||||
}
|
||||
sleepwait = 0;
|
||||
monsterclear();
|
||||
projreset();
|
||||
|
@ -512,7 +512,7 @@ startmap(char *name) // called just after a map load
|
|||
showscores(false);
|
||||
intermission = false;
|
||||
framesinmap = 0;
|
||||
conoutf("game mode is %s", modestr(gamemode));
|
||||
conoutf(@"game mode is %s", modestr(gamemode));
|
||||
};
|
||||
|
||||
COMMANDN(map, changemap, ARG_1STR);
|
||||
|
|
|
@ -10,7 +10,7 @@ extern string clientpassword;
|
|||
void
|
||||
neterr(char *s)
|
||||
{
|
||||
conoutf("illegal network message (%s)", s);
|
||||
conoutf(@"illegal network message (%s)", s);
|
||||
disconnect();
|
||||
};
|
||||
|
||||
|
@ -76,8 +76,8 @@ localservertoclient(
|
|||
cn = getint(p);
|
||||
int prot = getint(p);
|
||||
if (prot != PROTOCOL_VERSION) {
|
||||
conoutf("you are using a different game "
|
||||
"protocol (you: %d, server: %d)",
|
||||
conoutf(@"you are using a different game "
|
||||
@"protocol (you: %d, server: %d)",
|
||||
PROTOCOL_VERSION, prot);
|
||||
disconnect();
|
||||
return;
|
||||
|
@ -90,13 +90,13 @@ localservertoclient(
|
|||
// on this server, set map
|
||||
sgetstr();
|
||||
if (text[0] && strcmp(text, clientpassword)) {
|
||||
conoutf("you need to set the correct password "
|
||||
"to join this server!");
|
||||
conoutf(@"you need to set the correct password "
|
||||
@"to join this server!");
|
||||
disconnect();
|
||||
return;
|
||||
};
|
||||
if (getint(p) == 1) {
|
||||
conoutf("server is FULL, disconnecting..");
|
||||
conoutf(@"server is FULL, disconnecting..");
|
||||
};
|
||||
break;
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ localservertoclient(
|
|||
|
||||
case SV_TEXT:
|
||||
sgetstr();
|
||||
conoutf("%s:\f %s", d->name, text);
|
||||
conoutf(@"%s:\f %s", d->name, text);
|
||||
break;
|
||||
|
||||
case SV_MAPCHANGE:
|
||||
|
@ -155,7 +155,7 @@ localservertoclient(
|
|||
if (mapchanged)
|
||||
setspawn(n, true);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_MAPRELOAD: // server requests next map
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ localservertoclient(
|
|||
getalias(nextmapalias); // look up map in the cycle
|
||||
changemap(map ? map : getclientmap());
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_INITC2S: // another client either connected or changed
|
||||
// name/team
|
||||
|
@ -174,26 +174,26 @@ localservertoclient(
|
|||
if (d->name[0]) // already connected
|
||||
{
|
||||
if (strcmp(d->name, text))
|
||||
conoutf("%s is now known as %s",
|
||||
conoutf(@"%s is now known as %s",
|
||||
d->name, text);
|
||||
} else // new client
|
||||
{
|
||||
c2sinit =
|
||||
false; // send new players my info again
|
||||
conoutf("connected: %s", text);
|
||||
conoutf(@"connected: %s", text);
|
||||
};
|
||||
strcpy_s(d->name, text);
|
||||
sgetstr();
|
||||
strcpy_s(d->team, text);
|
||||
d->lifesequence = getint(p);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_CDIS:
|
||||
cn = getint(p);
|
||||
if (!(d = getclient(cn)))
|
||||
break;
|
||||
conoutf("player %s disconnected",
|
||||
conoutf(@"player %s disconnected",
|
||||
d->name[0] ? d->name : "[incompatible client]");
|
||||
zapdynent(players[cn]);
|
||||
break;
|
||||
|
@ -211,7 +211,7 @@ localservertoclient(
|
|||
createrays(s, e);
|
||||
shootv(gun, s, e, d);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_DAMAGE: {
|
||||
int target = getint(p);
|
||||
|
@ -224,40 +224,40 @@ localservertoclient(
|
|||
playsound(
|
||||
S_PAIN1 + rnd(5), &getclient(target)->o);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_DIED: {
|
||||
int actor = getint(p);
|
||||
if (actor == cn) {
|
||||
conoutf("%s suicided", d->name);
|
||||
conoutf(@"%s suicided", d->name);
|
||||
} else if (actor == clientnum) {
|
||||
int frags;
|
||||
if (isteam(player1->team, d->team)) {
|
||||
frags = -1;
|
||||
conoutf("you fragged a teammate (%s)",
|
||||
conoutf(@"you fragged a teammate (%s)",
|
||||
d->name);
|
||||
} else {
|
||||
frags = 1;
|
||||
conoutf("you fragged %s", d->name);
|
||||
};
|
||||
conoutf(@"you fragged %s", d->name);
|
||||
}
|
||||
addmsg(1, 2, SV_FRAGS, player1->frags += frags);
|
||||
} else {
|
||||
dynent *a = getclient(actor);
|
||||
if (a) {
|
||||
if (isteam(a->team, d->name)) {
|
||||
conoutf("%s fragged his "
|
||||
"teammate (%s)",
|
||||
conoutf(@"%s fragged his "
|
||||
@"teammate (%s)",
|
||||
a->name, d->name);
|
||||
} else {
|
||||
conoutf("%s fragged %s",
|
||||
conoutf(@"%s fragged %s",
|
||||
a->name, d->name);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
playsound(S_DIE1 + rnd(2), &d->o);
|
||||
d->lifesequence++;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_FRAGS:
|
||||
players[cn]->frags = getint(p);
|
||||
|
@ -277,7 +277,7 @@ localservertoclient(
|
|||
(float)ents[i].z};
|
||||
playsound(S_ITEMSPAWN, &v);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_ITEMACC: // server acknowledges that I picked up this
|
||||
// item
|
||||
|
@ -312,9 +312,9 @@ localservertoclient(
|
|||
case SV_EDITE:
|
||||
editequalisexy(v != 0, b);
|
||||
break;
|
||||
};
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_EDITENT: // coop edit of ent
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ localservertoclient(
|
|||
if (ents[i].type == LIGHT || to == LIGHT)
|
||||
calclight();
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_PING:
|
||||
getint(p);
|
||||
|
@ -361,18 +361,18 @@ localservertoclient(
|
|||
|
||||
case SV_RECVMAP: {
|
||||
sgetstr();
|
||||
conoutf("received map \"%s\" from server, reloading..",
|
||||
conoutf(@"received map \"%s\" from server, reloading..",
|
||||
text);
|
||||
int mapsize = getint(p);
|
||||
writemap(text, mapsize, p);
|
||||
p += mapsize;
|
||||
changemapserv(text, gamemode);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
case SV_SERVMSG:
|
||||
sgetstr();
|
||||
conoutf("%s", text);
|
||||
conoutf(@"%s", text);
|
||||
break;
|
||||
|
||||
case SV_EXT: // so we can messages without breaking previous
|
||||
|
@ -381,10 +381,10 @@ localservertoclient(
|
|||
for (int n = getint(p); n; n--)
|
||||
getint(p);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
neterr("type");
|
||||
return;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ alias(char *name, char *action)
|
|||
b.action = exchangestr(b.action, action);
|
||||
else
|
||||
conoutf(
|
||||
"cannot redefine builtin %s with an alias",
|
||||
@"cannot redefine builtin %s with an alias",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ parseexp(char *&p, int right) // parse any nested set of () or []
|
|||
brak--;
|
||||
else if (!c) {
|
||||
p--;
|
||||
conoutf("missing \"%c\"", right);
|
||||
conoutf(@"missing \"%c\"", right);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ lookup(char *n) // find value of ident referenced with $ in exp
|
|||
}
|
||||
}
|
||||
|
||||
conoutf("unknown alias lookup: %s", n + 1);
|
||||
conoutf(@"unknown alias lookup: %s", n + 1);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ execute(char *p, bool isdown) // all evaluation happens here, recursively
|
|||
if (ID == nil) {
|
||||
val = ATOI(c);
|
||||
if (!val && *c != '0')
|
||||
conoutf("unknown command: %s", c);
|
||||
conoutf(@"unknown command: %s", c);
|
||||
} else {
|
||||
switch (ID.type) {
|
||||
// game defined commands
|
||||
|
@ -395,14 +395,15 @@ execute(char *p, bool isdown) // all evaluation happens here, recursively
|
|||
// var with no value
|
||||
// just prints its
|
||||
// current value
|
||||
conoutf("%s = %d", c,
|
||||
conoutf(@"%s = %d", c,
|
||||
*ID.storage);
|
||||
else {
|
||||
if (ID.min > ID.max) {
|
||||
conoutf("variab"
|
||||
"le is "
|
||||
"read-"
|
||||
"only");
|
||||
conoutf(
|
||||
@"variable "
|
||||
@"is "
|
||||
@"read-"
|
||||
@"only");
|
||||
} else {
|
||||
int i1 =
|
||||
ATOI(w[1]);
|
||||
|
@ -419,21 +420,34 @@ execute(char *p, bool isdown) // all evaluation happens here, recursively
|
|||
? ID.min
|
||||
: ID.max;
|
||||
conoutf(
|
||||
"va"
|
||||
"li"
|
||||
"d "
|
||||
"ra"
|
||||
"ng"
|
||||
"e "
|
||||
"fo"
|
||||
"r "
|
||||
"%s"
|
||||
" i"
|
||||
"s "
|
||||
"%d"
|
||||
".."
|
||||
"%"
|
||||
"d",
|
||||
@"v"
|
||||
@"a"
|
||||
@"l"
|
||||
@"i"
|
||||
@"d"
|
||||
@" "
|
||||
@"r"
|
||||
@"a"
|
||||
@"n"
|
||||
@"g"
|
||||
@"e"
|
||||
@" "
|
||||
@"f"
|
||||
@"o"
|
||||
@"r"
|
||||
@" "
|
||||
@"%"
|
||||
@"s"
|
||||
@" "
|
||||
@"i"
|
||||
@"s"
|
||||
@" "
|
||||
@"%"
|
||||
@"d"
|
||||
@"."
|
||||
@"."
|
||||
@"%"
|
||||
@"d",
|
||||
c,
|
||||
ID.min,
|
||||
ID.max);
|
||||
|
@ -533,7 +547,7 @@ void
|
|||
exec(char *cfgfile)
|
||||
{
|
||||
if (!execfile(cfgfile))
|
||||
conoutf("could not read \"%s\"", cfgfile);
|
||||
conoutf(@"could not read \"%s\"", cfgfile);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -50,10 +50,10 @@ conline(const char *sf, bool highlight) // add a line to the console buffer
|
|||
};
|
||||
|
||||
void
|
||||
conoutf(const char *s, ...)
|
||||
conoutf(OFString *str, ...)
|
||||
{
|
||||
sprintf_sdv(sf, s);
|
||||
s = sf;
|
||||
sprintf_sdv(sf, str.UTF8String);
|
||||
const char *s = sf;
|
||||
int n = 0;
|
||||
while (strlen(s) > WORDWRAP) // cut strings to fit on screen
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ conoutf(const char *s, ...)
|
|||
strn0cpy(t, s, WORDWRAP + 1);
|
||||
conline(t, n++ != 0);
|
||||
s += WORDWRAP;
|
||||
};
|
||||
}
|
||||
conline(s, n != 0);
|
||||
};
|
||||
|
||||
|
@ -114,7 +114,7 @@ bindkey(char *key, char *action)
|
|||
strcpy_s(keyms[i].action, action);
|
||||
return;
|
||||
};
|
||||
conoutf("unknown key \"%s\"", key);
|
||||
conoutf(@"unknown key \"%s\"", key);
|
||||
};
|
||||
|
||||
COMMANDN(bind, bindkey, ARG_2STR);
|
||||
|
|
|
@ -87,7 +87,7 @@ noteditmode()
|
|||
{
|
||||
correctsel();
|
||||
if (!editmode)
|
||||
conoutf("this function is only allowed in edit mode");
|
||||
conoutf(@"this function is only allowed in edit mode");
|
||||
return !editmode;
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ bool
|
|||
noselection()
|
||||
{
|
||||
if (!selset)
|
||||
conoutf("no selection");
|
||||
conoutf(@"no selection");
|
||||
return !selset;
|
||||
};
|
||||
|
||||
|
@ -258,7 +258,7 @@ editundo()
|
|||
{
|
||||
EDITMP;
|
||||
if (undos.empty()) {
|
||||
conoutf("nothing more to undo");
|
||||
conoutf(@"nothing more to undo");
|
||||
return;
|
||||
};
|
||||
block *p = undos.pop();
|
||||
|
@ -282,14 +282,14 @@ paste()
|
|||
{
|
||||
EDITMP;
|
||||
if (!copybuf) {
|
||||
conoutf("nothing to paste");
|
||||
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");
|
||||
conoutf(@"incorrect selection");
|
||||
return;
|
||||
};
|
||||
makeundo();
|
||||
|
@ -440,7 +440,7 @@ edittype(int type)
|
|||
if (type == CORNER &&
|
||||
(sel.xs != sel.ys || sel.xs == 3 || sel.xs > 4 && sel.xs != 8 ||
|
||||
sel.x & ~-sel.xs || sel.y & ~-sel.ys)) {
|
||||
conoutf("corner selection must be power of 2 aligned");
|
||||
conoutf(@"corner selection must be power of 2 aligned");
|
||||
return;
|
||||
};
|
||||
edittypexy(type, sel);
|
||||
|
|
|
@ -184,10 +184,10 @@ realpickup(int n, dynent *d)
|
|||
|
||||
case I_QUAD:
|
||||
radditem(n, d->quadmillis);
|
||||
conoutf("you got the quad!");
|
||||
conoutf(@"you got the quad!");
|
||||
break;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// these functions are called when the client touches the item
|
||||
|
||||
|
@ -201,8 +201,8 @@ additem(int i, int &v, int spawnsec)
|
|||
m_classicsp ? 100000
|
||||
: spawnsec); // first ask the server for an ack
|
||||
ents[i].spawned = false; // even if someone else gets it first
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
teleport(int n, dynent *d) // also used by monsters
|
||||
|
@ -211,7 +211,7 @@ teleport(int n, dynent *d) // also used by monsters
|
|||
for (;;) {
|
||||
e = findentity(TELEDEST, e + 1);
|
||||
if (e == beenhere || e < 0) {
|
||||
conoutf("no teleport destination for tag %d", tag);
|
||||
conoutf(@"no teleport destination for tag %d", tag);
|
||||
return;
|
||||
};
|
||||
if (beenhere < 0)
|
||||
|
@ -332,9 +332,9 @@ checkquad(int time)
|
|||
if (player1->quadmillis && (player1->quadmillis -= time) < 0) {
|
||||
player1->quadmillis = 0;
|
||||
playsoundc(S_PUPOUT);
|
||||
conoutf("quad damage is over");
|
||||
};
|
||||
};
|
||||
conoutf(@"quad damage is over");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
putitems(uchar *&p) // puts items in network stream and also spawns them locally
|
||||
|
@ -344,8 +344,8 @@ putitems(uchar *&p) // puts items in network stream and also spawns them locally
|
|||
{
|
||||
putint(p, i);
|
||||
ents[i].spawned = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
resetspawns()
|
||||
|
|
|
@ -106,7 +106,7 @@ main(int argc, char **argv)
|
|||
|
||||
processInitQueue();
|
||||
|
||||
#define log(s) conoutf("init: %s", s)
|
||||
#define log(s) conoutf(@"init: %s", s)
|
||||
log("sdl");
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
|
@ -144,10 +144,10 @@ main(int argc, char **argv)
|
|||
maxcl = atoi(a);
|
||||
break;
|
||||
default:
|
||||
conoutf("unknown commandline option");
|
||||
conoutf(@"unknown commandline option");
|
||||
}
|
||||
else
|
||||
conoutf("unknown commandline argument");
|
||||
conoutf(@"unknown commandline argument");
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
dvector monsters;
|
||||
int nextmonster, spawnremain, numkilled, monstertotal, mtimestart;
|
||||
|
||||
VARF(skill, 1, 3, 10, conoutf("skill is now %d", skill));
|
||||
VARF(skill, 1, 3, 10, conoutf(@"skill is now %d", skill));
|
||||
|
||||
dvector &
|
||||
getmonsters()
|
||||
|
@ -52,7 +52,7 @@ dynent *
|
|||
basicmonster(int type, int yaw, int state, int trigger, int move)
|
||||
{
|
||||
if (type >= NUMMONSTERTYPES) {
|
||||
conoutf("warning: unknown monster in spawn: %d", type);
|
||||
conoutf(@"warning: unknown monster in spawn: %d", type);
|
||||
type = 0;
|
||||
};
|
||||
dynent *m = newdynent();
|
||||
|
@ -340,7 +340,7 @@ monsterpain(dynent *m, int damage, dynent *d)
|
|||
playsound(monstertypes[m->mtype].diesound, &m->o);
|
||||
int remain = monstertotal - numkilled;
|
||||
if (remain > 0 && remain <= 5)
|
||||
conoutf("only %d monster(s) remaining", remain);
|
||||
conoutf(@"only %d monster(s) remaining", remain);
|
||||
} else {
|
||||
playsound(monstertypes[m->mtype].painsound, &m->o);
|
||||
};
|
||||
|
@ -349,9 +349,9 @@ monsterpain(dynent *m, int damage, dynent *d)
|
|||
void
|
||||
endsp(bool allkilled)
|
||||
{
|
||||
conoutf(
|
||||
allkilled ? "you have cleared the map!" : "you reached the exit!");
|
||||
conoutf("score: %d kills in %d seconds", numkilled,
|
||||
conoutf(allkilled ? @"you have cleared the map!"
|
||||
: @"you reached the exit!");
|
||||
conoutf(@"score: %d kills in %d seconds", numkilled,
|
||||
(lastmillis - mtimestart) / 1000);
|
||||
monstertotal = 0;
|
||||
startintermission();
|
||||
|
@ -362,7 +362,7 @@ monsterthink()
|
|||
{
|
||||
if (m_dmsp && spawnremain && lastmillis > nextmonster) {
|
||||
if (spawnremain-- == monstertotal)
|
||||
conoutf("The invasion has begun!");
|
||||
conoutf(@"The invasion has begun!");
|
||||
nextmonster = lastmillis + 1000;
|
||||
spawnmonster();
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ extern void writecfg();
|
|||
// console
|
||||
extern void keypress(int code, bool isdown, int cooked);
|
||||
extern void renderconsole();
|
||||
extern void conoutf(const char *s, ...);
|
||||
extern void conoutf(OFString *s, ...);
|
||||
extern char *getcurcommand();
|
||||
extern void writebinds(FILE *f);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void
|
|||
mipstats(int a, int b, int c)
|
||||
{
|
||||
if (showm)
|
||||
conoutf("1x1/2x2/4x4: %d / %d / %d", a, b, c);
|
||||
conoutf(@"1x1/2x2/4x4: %d / %d / %d", a, b, c);
|
||||
};
|
||||
|
||||
COMMAND(showmip, ARG_NONE);
|
||||
|
|
|
@ -210,7 +210,7 @@ loadsky(char *basename)
|
|||
sprintf_sd(name)("packages/%s_%s.jpg", basename, side[i]);
|
||||
int xs, ys;
|
||||
if (!installtex(texnum + i, path(name), xs, ys, true))
|
||||
conoutf("could not load sky textures");
|
||||
conoutf(@"could not load sky textures");
|
||||
};
|
||||
strcpy_s(lastsky, basename);
|
||||
};
|
||||
|
|
|
@ -48,8 +48,8 @@ gl_init(int w, int h)
|
|||
if (strstr(exts, "GL_EXT_texture_env_combine"))
|
||||
hasoverbright = true;
|
||||
else
|
||||
conoutf("WARNING: cannot use overbright lighting, using old "
|
||||
"lighting model!");
|
||||
conoutf(@"WARNING: cannot use overbright lighting, using old "
|
||||
@"lighting model!");
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glmaxtexsize);
|
||||
|
||||
|
@ -77,11 +77,11 @@ 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);
|
||||
conoutf(@"couldn't load texture %s", texname);
|
||||
return false;
|
||||
};
|
||||
if (s->format->BitsPerPixel != 24) {
|
||||
conoutf("texture must be 24bpp: %s", texname);
|
||||
conoutf(@"texture must be 24bpp: %s", texname);
|
||||
return false;
|
||||
};
|
||||
// loopi(s->w*s->h*3) { uchar *p = (uchar *)s->pixels+i; *p = 255-*p; };
|
||||
|
@ -103,7 +103,7 @@ installtex(int tnum, char *texname, int &xs, int &ys, bool clamp)
|
|||
};
|
||||
void *scaledimg = s->pixels;
|
||||
if (xs != s->w) {
|
||||
conoutf("warning: quality loss: scaling %s",
|
||||
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,
|
||||
|
@ -274,8 +274,8 @@ VARFP(gamma, 30, 100, 300, {
|
|||
float f = gamma / 100.0f;
|
||||
if (SDL_SetGamma(f, f, f) == -1) {
|
||||
conoutf(
|
||||
"Could not set gamma (card/driver doesn't support it?)");
|
||||
conoutf("sdl: %s", SDL_GetError());
|
||||
@"Could not set gamma (card/driver doesn't support it?)");
|
||||
conoutf(@"sdl: %s", SDL_GetError());
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ savestate(char *fn)
|
|||
stop();
|
||||
f = gzopen(fn, "wb9");
|
||||
if (!f) {
|
||||
conoutf("could not write %s", fn);
|
||||
conoutf(@"could not write %s", fn);
|
||||
return;
|
||||
};
|
||||
gzwrite(f, (void *)"CUBESAVE", 8);
|
||||
|
@ -104,21 +104,21 @@ savestate(char *fn)
|
|||
{
|
||||
gzput(players[i] == NULL);
|
||||
gzwrite(f, players[i], sizeof(dynent));
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
savegame(char *name)
|
||||
{
|
||||
if (!m_classicsp) {
|
||||
conoutf("can only save classic sp games");
|
||||
conoutf(@"can only save classic sp games");
|
||||
return;
|
||||
};
|
||||
}
|
||||
sprintf_sd(fn)("savegames/%s.csgz", name);
|
||||
savestate(fn);
|
||||
stop();
|
||||
conoutf("wrote %s", fn);
|
||||
};
|
||||
conoutf(@"wrote %s", fn);
|
||||
}
|
||||
|
||||
void
|
||||
loadstate(char *fn)
|
||||
|
@ -128,9 +128,9 @@ loadstate(char *fn)
|
|||
return;
|
||||
f = gzopen(fn, "rb9");
|
||||
if (!f) {
|
||||
conoutf("could not open %s", fn);
|
||||
conoutf(@"could not open %s", fn);
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
string buf;
|
||||
gzread(f, buf, 8);
|
||||
|
@ -148,24 +148,24 @@ loadstate(char *fn)
|
|||
// client & server have updated
|
||||
return;
|
||||
out:
|
||||
conoutf("aborting: savegame/demo from a different version of cube or "
|
||||
"cpu architecture");
|
||||
conoutf(@"aborting: savegame/demo from a different version of cube or "
|
||||
@"cpu architecture");
|
||||
stop();
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
loadgame(char *name)
|
||||
{
|
||||
sprintf_sd(fn)("savegames/%s.csgz", name);
|
||||
loadstate(fn);
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
loadgameout()
|
||||
{
|
||||
stop();
|
||||
conoutf("loadgame incomplete: savegame from a different version of "
|
||||
"this map");
|
||||
conoutf(@"loadgame incomplete: savegame from a different version of "
|
||||
@"this map");
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -212,7 +212,7 @@ loadgamerest()
|
|||
gzread(f, d, sizeof(dynent));
|
||||
};
|
||||
|
||||
conoutf("savegame restored");
|
||||
conoutf(@"savegame restored");
|
||||
if (demoloading)
|
||||
startdemo();
|
||||
else
|
||||
|
@ -230,7 +230,7 @@ void
|
|||
record(char *name)
|
||||
{
|
||||
if (m_sp) {
|
||||
conoutf("cannot record singleplayer games");
|
||||
conoutf(@"cannot record singleplayer games");
|
||||
return;
|
||||
};
|
||||
int cn = getclientnum();
|
||||
|
@ -239,7 +239,7 @@ record(char *name)
|
|||
sprintf_sd(fn)("demos/%s.cdgz", name);
|
||||
savestate(fn);
|
||||
gzputi(cn);
|
||||
conoutf("started recording demo to %s", fn);
|
||||
conoutf(@"started recording demo to %s", fn);
|
||||
demorecording = true;
|
||||
starttime = lastmillis;
|
||||
ddamage = bdamage = 0;
|
||||
|
@ -282,11 +282,11 @@ incomingdemodata(uchar *buf, int len, bool extras)
|
|||
if (ddamage) {
|
||||
gzputv(dorig);
|
||||
ddamage = 0;
|
||||
};
|
||||
}
|
||||
// FIXME: add all other client state which is not send through
|
||||
// the network
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
demo(char *name)
|
||||
|
@ -294,23 +294,23 @@ demo(char *name)
|
|||
sprintf_sd(fn)("demos/%s.cdgz", name);
|
||||
loadstate(fn);
|
||||
demoloading = true;
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
stopreset()
|
||||
{
|
||||
conoutf("demo stopped (%d msec elapsed)", lastmillis - starttime);
|
||||
conoutf(@"demo stopped (%d msec elapsed)", lastmillis - starttime);
|
||||
stop();
|
||||
loopv(players) zapdynent(players[i]);
|
||||
disconnect(0, 0);
|
||||
};
|
||||
}
|
||||
|
||||
VAR(demoplaybackspeed, 10, 100, 1000);
|
||||
int
|
||||
scaletime(int t)
|
||||
{
|
||||
return (int)(t * (100.0f / demoplaybackspeed)) + starttime;
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
readdemotime()
|
||||
|
@ -318,9 +318,9 @@ readdemotime()
|
|||
if (gzeof(f) || (playbacktime = gzgeti()) == -1) {
|
||||
stopreset();
|
||||
return;
|
||||
};
|
||||
}
|
||||
playbacktime = scaletime(playbacktime);
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
startdemo()
|
||||
|
@ -328,12 +328,12 @@ startdemo()
|
|||
democlientnum = gzgeti();
|
||||
demoplayback = true;
|
||||
starttime = lastmillis;
|
||||
conoutf("now playing demo");
|
||||
conoutf(@"now playing demo");
|
||||
dynent *d = getclient(democlientnum);
|
||||
assert(d);
|
||||
*d = *player1;
|
||||
readdemotime();
|
||||
};
|
||||
}
|
||||
|
||||
VAR(demodelaymsec, 0, 120, 500);
|
||||
|
||||
|
@ -378,7 +378,7 @@ demoplaybackstep()
|
|||
int len = gzgeti();
|
||||
if (len < 1 || len > MAXTRANS) {
|
||||
conoutf(
|
||||
"error: huge packet during demo play (%d)", len);
|
||||
@"error: huge packet during demo play (%d)", len);
|
||||
stopreset();
|
||||
return;
|
||||
};
|
||||
|
@ -483,7 +483,7 @@ stopn()
|
|||
stopreset();
|
||||
else
|
||||
stop();
|
||||
conoutf("demo stopped");
|
||||
conoutf(@"demo stopped");
|
||||
};
|
||||
|
||||
COMMAND(record, ARG_1STR);
|
||||
|
|
|
@ -306,7 +306,7 @@ updatefrommaster()
|
|||
uchar *reply = retrieveservers(buf, MAXUPD);
|
||||
if (!*reply || strstr((char *)reply, "<html>") ||
|
||||
strstr((char *)reply, "<HTML>"))
|
||||
conoutf("master server not replying");
|
||||
conoutf(@"master server not replying");
|
||||
else {
|
||||
servers.setsize(0);
|
||||
execute((char *)reply);
|
||||
|
|
10
src/sound.mm
10
src/sound.mm
|
@ -63,7 +63,7 @@ initsound()
|
|||
#ifdef USE_MIXER
|
||||
if (Mix_OpenAudio(SOUNDFREQ, MIX_DEFAULT_FORMAT, 2, soundbufferlen) <
|
||||
0) {
|
||||
conoutf("sound init failed (SDL_mixer): %s",
|
||||
conoutf(@"sound init failed (SDL_mixer): %s",
|
||||
(size_t)Mix_GetError());
|
||||
nosound = true;
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ initsound()
|
|||
if (FSOUND_GetVersion() < FMOD_VERSION)
|
||||
fatal("old FMOD dll");
|
||||
if (!FSOUND_Init(SOUNDFREQ, MAXCHAN, FSOUND_INIT_GLOBALFOCUS)) {
|
||||
conoutf("sound init failed (FMOD): %d", FSOUND_GetError());
|
||||
conoutf(@"sound init failed (FMOD): %d", FSOUND_GetError());
|
||||
nosound = true;
|
||||
};
|
||||
#endif
|
||||
|
@ -106,7 +106,7 @@ music(char *name)
|
|||
FSOUND_SetPaused(chan, false);
|
||||
};
|
||||
} else {
|
||||
conoutf("could not play music: %s", sn);
|
||||
conoutf(@"could not play music: %s", sn);
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
@ -228,7 +228,7 @@ playsound(int n, vec *loc)
|
|||
return; // avoid bursts of sounds with heavy packetloss and in
|
||||
// sp
|
||||
if (n < 0 || n >= samples.length()) {
|
||||
conoutf("unregistered sound: %d", n);
|
||||
conoutf(@"unregistered sound: %d", n);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -243,7 +243,7 @@ playsound(int n, vec *loc)
|
|||
#endif
|
||||
|
||||
if (!samples[n]) {
|
||||
conoutf("failed to load sample: %s", buf);
|
||||
conoutf(@"failed to load sample: %s", buf);
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ selectgun(int a, int b, int c)
|
|||
if (s != player1->gunselect)
|
||||
playsoundc(S_WEAPLOAD);
|
||||
player1->gunselect = s;
|
||||
// conoutf("%s selected", (int)guns[s].name);
|
||||
// conoutf(@"%s selected", (int)guns[s].name);
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -293,11 +293,11 @@ delent()
|
|||
{
|
||||
int e = closestent();
|
||||
if (e < 0) {
|
||||
conoutf("no more entities");
|
||||
conoutf(@"no more entities");
|
||||
return;
|
||||
};
|
||||
int t = ents[e].type;
|
||||
conoutf("%s entity deleted", entnames[t]);
|
||||
conoutf(@"%s entity deleted", entnames[t]);
|
||||
ents[e].type = NOTUSED;
|
||||
addmsg(1, 10, SV_EDITENT, e, NOTUSED, 0, 0, 0, 0, 0, 0, 0);
|
||||
if (t == LIGHT)
|
||||
|
@ -308,7 +308,7 @@ int
|
|||
findtype(char *what)
|
||||
{
|
||||
loopi(MAXENTTYPES) if (strcmp(what, entnames[i]) == 0) return i;
|
||||
conoutf("unknown entity type \"%s\"", what);
|
||||
conoutf(@"unknown entity type \"%s\"", what);
|
||||
return NOTUSED;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,12 +128,12 @@ writemap(char *mname, int msize, uchar *mdata)
|
|||
backup(cgzname, bakname);
|
||||
FILE *f = fopen(cgzname, "wb");
|
||||
if (!f) {
|
||||
conoutf("could not write map to %s", cgzname);
|
||||
conoutf(@"could not write map to %s", cgzname);
|
||||
return;
|
||||
};
|
||||
fwrite(mdata, 1, msize, f);
|
||||
fclose(f);
|
||||
conoutf("wrote map %s as file %s", mname, cgzname);
|
||||
conoutf(@"wrote map %s as file %s", mname, cgzname);
|
||||
}
|
||||
|
||||
uchar *
|
||||
|
@ -142,7 +142,7 @@ readmap(char *mname, int *msize)
|
|||
setnames(mname);
|
||||
uchar *mdata = (uchar *)loadfile(cgzname, msize);
|
||||
if (!mdata) {
|
||||
conoutf("could not read map %s", cgzname);
|
||||
conoutf(@"could not read map %s", cgzname);
|
||||
return NULL;
|
||||
};
|
||||
return mdata;
|
||||
|
@ -165,7 +165,7 @@ save_world(char *mname)
|
|||
backup(cgzname, bakname);
|
||||
gzFile f = gzopen(cgzname, "wb9");
|
||||
if (!f) {
|
||||
conoutf("could not write map to %s", cgzname);
|
||||
conoutf(@"could not write map to %s", cgzname);
|
||||
return;
|
||||
};
|
||||
hdr.version = MAPVERSION;
|
||||
|
@ -237,7 +237,7 @@ save_world(char *mname)
|
|||
};
|
||||
spurge;
|
||||
gzclose(f);
|
||||
conoutf("wrote map file %s", cgzname);
|
||||
conoutf(@"wrote map file %s", cgzname);
|
||||
settagareas();
|
||||
};
|
||||
|
||||
|
@ -251,7 +251,7 @@ load_world(char *mname) // still supports all map formats that have existed
|
|||
setnames(mname);
|
||||
gzFile f = gzopen(cgzname, "rb9");
|
||||
if (!f) {
|
||||
conoutf("could not read map %s", cgzname);
|
||||
conoutf(@"could not read map %s", cgzname);
|
||||
return;
|
||||
};
|
||||
gzread(f, &hdr, sizeof(header) - sizeof(int) * 16);
|
||||
|
@ -357,9 +357,9 @@ load_world(char *mname) // still supports all map formats that have existed
|
|||
settagareas();
|
||||
int xs, ys;
|
||||
loopi(256) if (texuse) lookuptexture(i, xs, ys);
|
||||
conoutf("read map %s (%d milliseconds)", cgzname,
|
||||
conoutf(@"read map %s (%d milliseconds)", cgzname,
|
||||
SDL_GetTicks() - lastmillis);
|
||||
conoutf("%s", hdr.maptitle);
|
||||
conoutf(@"%s", hdr.maptitle);
|
||||
startmap(mname);
|
||||
loopl(256)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue