Migrate more strings

FossilOrigin-Name: e7b5d33cada1ff8db653655ab2c77ead76ab7625a5d2f793b9aee3ec21e3778b
This commit is contained in:
Jonathan Schleifer 2025-03-03 23:52:52 +00:00
parent b00de734e8
commit 2860953c0b
24 changed files with 692 additions and 556 deletions

View file

@ -13,7 +13,7 @@ int frame[] = {178, 184, 190, 137, 183, 189, 197, 164, 46, 51, 54, 32, 0, 0, 40,
int range[] = {6, 6, 8, 28, 1, 1, 1, 1, 8, 19, 4, 18, 40, 1, 6, 15, 1, 1, 1, 1};
void
renderclient(dynent *d, bool team, char *mdlname, bool hellpig, float scale)
renderclient(dynent *d, bool team, OFString *mdlname, bool hellpig, float scale)
{
int n = 3;
float speed = 100.0f;
@ -27,7 +27,7 @@ renderclient(dynent *d, bool team, char *mdlname, bool hellpig, float scale)
} else {
n = (intptr_t)d % 3;
r = range[n];
};
}
basetime = d->lastaction;
int t = lastmillis - d->lastaction;
if (t < 0 || t > 20000)
@ -61,15 +61,15 @@ renderclient(dynent *d, bool team, char *mdlname, bool hellpig, float scale)
speed = 1200 / d->maxspeed * scale;
if (hellpig)
speed = 300 / d->maxspeed;
};
}
if (hellpig) {
n++;
scale *= 32;
mz -= 1.9f;
};
}
rendermodel(mdlname, frame[n], range[n], 0, 1.5f, d->o.x, mz, d->o.y,
d->yaw + 90, d->pitch / 2, team, scale, speed, 0, basetime);
};
}
extern int democlientnum;
@ -79,9 +79,9 @@ renderclients()
dynent *d;
loopv(players) if ((d = players[i]) &&
(!demoplayback || i != democlientnum))
renderclient(
d, isteam(player1->team, d->team), "monster/ogro", false, 1.0f);
};
renderclient(d, isteam(player1->team, d->team), @"monster/ogro",
false, 1.0f);
}
// creation of scoreboard pseudo-menu
@ -161,15 +161,15 @@ renderscores()
// sendmap/getmap commands, should be replaced by more intuitive map downloading
void
sendmap(const char *mapname)
sendmap(OFString *mapname)
{
@autoreleasepool {
if (*mapname)
if (mapname.length > 0)
save_world(mapname);
changemap(@(mapname));
mapname = getclientmap().UTF8String;
changemap(mapname);
mapname = getclientmap();
int mapsize;
uchar *mapdata = readmap(mapname, &mapsize);
uchar *mapdata = readmap(mapname.UTF8String, &mapsize);
if (!mapdata)
return;
ENetPacket *packet = enet_packet_create(
@ -177,10 +177,11 @@ sendmap(const char *mapname)
uchar *start = packet->data;
uchar *p = start + 2;
putint(p, SV_SENDMAP);
sendstring(mapname, p);
sendstring(mapname.UTF8String, 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.UTF8String);
free(mapdata);
enet_packet_destroy(packet);
return;
@ -191,10 +192,10 @@ sendmap(const 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.UTF8String);
sprintf_sd(msg)(
"[map %s uploaded to server, \"getmap\" to receive it]",
mapname);
mapname.UTF8String);
toserver(msg);
}
}
@ -213,5 +214,5 @@ getmap()
conoutf(@"requesting map from server...");
}
COMMAND(sendmap, ARG_1CSTR)
COMMAND(sendmap, ARG_1STR)
COMMAND(getmap, ARG_NONE)