Remove all default arguments from protos.h
FossilOrigin-Name: ef1d7e47f7204700ed6e3b1191a1bdcb6e1d0257586183bc6571b8ff92464042
This commit is contained in:
parent
d9d56601bb
commit
2085a651bd
18 changed files with 81 additions and 69 deletions
|
@ -124,14 +124,15 @@ padArguments(OFArray<OFString *> *arguments, size_t count)
|
|||
if (isDown) {
|
||||
arguments = padArguments(arguments, 2);
|
||||
return ((int(__cdecl *)(int))_function)(
|
||||
execute(arguments[1]));
|
||||
execute(arguments[1], isDown));
|
||||
}
|
||||
break;
|
||||
case ARG_2EXP:
|
||||
if (isDown) {
|
||||
arguments = padArguments(arguments, 3);
|
||||
return ((int(__cdecl *)(int, int))_function)(
|
||||
execute(arguments[1]), execute(arguments[2]));
|
||||
execute(arguments[1], isDown),
|
||||
execute(arguments[2], isDown));
|
||||
}
|
||||
break;
|
||||
case ARG_1EST:
|
||||
|
|
14
src/Cube.mm
14
src/Cube.mm
|
@ -296,7 +296,7 @@ VARP(minmillis, 0, 5, 1000);
|
|||
- (void)applicationWillTerminate:(OFNotification *)notification
|
||||
{
|
||||
stop();
|
||||
disconnect(true);
|
||||
disconnect(true, false);
|
||||
writecfg();
|
||||
cleangl();
|
||||
cleansound();
|
||||
|
@ -357,11 +357,17 @@ VARP(minmillis, 0, 5, 1000);
|
|||
}
|
||||
@end
|
||||
|
||||
// failure exit
|
||||
void
|
||||
fatal(OFString *s, OFString *o) // failure exit
|
||||
fatal(OFConstantString *s, ...)
|
||||
{
|
||||
OFString *msg =
|
||||
[OFString stringWithFormat:@"%@%@ (%s)\n", s, o, SDL_GetError()];
|
||||
va_list args;
|
||||
va_start(args, s);
|
||||
OFMutableString *msg = [[OFMutableString alloc] initWithFormat:s
|
||||
arguments:args];
|
||||
va_end(args);
|
||||
|
||||
[msg appendFormat:@" (%s)\n", SDL_GetError()];
|
||||
|
||||
[Cube.sharedInstance showMessage:msg];
|
||||
[OFApplication terminateWithStatus:1];
|
||||
|
|
|
@ -251,7 +251,7 @@ updateworld(int millis) // main game update loop
|
|||
curtime = millis - lastmillis;
|
||||
if (sleepwait && lastmillis > sleepwait) {
|
||||
sleepwait = 0;
|
||||
execute(sleepcmd);
|
||||
execute(sleepcmd, true);
|
||||
}
|
||||
physicsframe();
|
||||
checkquad(curtime);
|
||||
|
@ -445,11 +445,11 @@ selfdamage(int damage, int actor, DynamicEntity *act)
|
|||
player1.state = CS_DEAD;
|
||||
player1.pitch = 0;
|
||||
player1.roll = 60;
|
||||
playsound(S_DIE1 + rnd(2));
|
||||
playsound(S_DIE1 + rnd(2), NULL);
|
||||
spawnstate(player1);
|
||||
player1.lastaction = lastmillis;
|
||||
} else
|
||||
playsound(S_PAIN6);
|
||||
playsound(S_PAIN6, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -94,7 +94,7 @@ writeclientinfo(OFStream *stream)
|
|||
void
|
||||
connects(OFString *servername)
|
||||
{
|
||||
disconnect(1); // reset state
|
||||
disconnect(true, false); // reset state
|
||||
addserver(servername);
|
||||
|
||||
conoutf(@"attempting to connect to %@", servername);
|
||||
|
@ -113,12 +113,12 @@ connects(OFString *servername)
|
|||
connattempts = 0;
|
||||
} else {
|
||||
conoutf(@"could not connect to server");
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
disconnect(int onlyclean, int async)
|
||||
disconnect(bool onlyclean, bool async)
|
||||
{
|
||||
if (clienthost) {
|
||||
if (!connecting && !disconnecting) {
|
||||
|
@ -162,7 +162,7 @@ trydisconnect()
|
|||
}
|
||||
if (connecting) {
|
||||
conoutf(@"aborting connection attempt");
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
return;
|
||||
}
|
||||
conoutf(@"attempting to disconnect...");
|
||||
|
@ -233,7 +233,7 @@ void
|
|||
server_err()
|
||||
{
|
||||
conoutf(@"server network error, disconnecting...");
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
}
|
||||
|
||||
int lastupdate = 0, lastping = 0;
|
||||
|
@ -382,7 +382,7 @@ gets2c() // get updates from the server
|
|||
++connattempts;
|
||||
if (connattempts > 3) {
|
||||
conoutf(@"could not connect to server");
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ gets2c() // get updates from the server
|
|||
|
||||
case ENET_EVENT_TYPE_DISCONNECT:
|
||||
if (disconnecting)
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
else
|
||||
server_err();
|
||||
return;
|
||||
|
|
|
@ -14,7 +14,7 @@ void
|
|||
neterr(OFString *s)
|
||||
{
|
||||
conoutf(@"illegal network message (%@)", s);
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -67,7 +67,7 @@ localservertoclient(uchar *buf, int len)
|
|||
{
|
||||
if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len)
|
||||
neterr(@"packet length");
|
||||
incomingdemodata(buf, len);
|
||||
incomingdemodata(buf, len, false);
|
||||
|
||||
uchar *end = buf + len;
|
||||
uchar *p = buf + 2;
|
||||
|
@ -86,7 +86,7 @@ localservertoclient(uchar *buf, int len)
|
|||
conoutf(@"you are using a different game "
|
||||
@"protocol (you: %d, server: %d)",
|
||||
PROTOCOL_VERSION, prot);
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
return;
|
||||
}
|
||||
toservermap = @"";
|
||||
|
@ -100,7 +100,7 @@ localservertoclient(uchar *buf, int len)
|
|||
strcmp(text, clientpassword.UTF8String)) {
|
||||
conoutf(@"you need to set the correct password "
|
||||
@"to join this server!");
|
||||
disconnect();
|
||||
disconnect(false, false);
|
||||
return;
|
||||
}
|
||||
if (getint(&p) == 1)
|
||||
|
@ -221,7 +221,7 @@ localservertoclient(uchar *buf, int len)
|
|||
e.z = getint(&p) / DMF;
|
||||
if (gun == GUN_SG)
|
||||
createrays(&s, &e);
|
||||
shootv(gun, &s, &e, d);
|
||||
shootv(gun, &s, &e, d, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,8 @@ parseexp(char *&p, int right)
|
|||
if (left == '(') {
|
||||
OFString *t;
|
||||
@try {
|
||||
t = [OFString stringWithFormat:@"%d", execute(@(s))];
|
||||
t = [OFString
|
||||
stringWithFormat:@"%d", execute(@(s), true)];
|
||||
} @finally {
|
||||
free(s);
|
||||
}
|
||||
|
@ -329,7 +330,7 @@ execfile(OFIRI *cfgfile)
|
|||
return false;
|
||||
}
|
||||
|
||||
execute(command);
|
||||
execute(command, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -407,7 +408,7 @@ intset(OFString *name, int v)
|
|||
void
|
||||
ifthen(OFString *cond, OFString *thenp, OFString *elsep)
|
||||
{
|
||||
execute((![cond hasPrefix:@"0"] ? thenp : elsep));
|
||||
execute((![cond hasPrefix:@"0"] ? thenp : elsep), true);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -418,22 +419,22 @@ loopa(OFString *times, OFString *body)
|
|||
loopi(t)
|
||||
{
|
||||
intset(@"i", i);
|
||||
execute(body);
|
||||
execute(body, true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
whilea(OFString *cond, OFString *body)
|
||||
{
|
||||
while (execute(cond))
|
||||
execute(body);
|
||||
while (execute(cond, true))
|
||||
execute(body, true);
|
||||
}
|
||||
|
||||
void
|
||||
onrelease(bool on, OFString *body)
|
||||
{
|
||||
if (!on)
|
||||
execute(body);
|
||||
execute(body, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -177,7 +177,7 @@ history(int n)
|
|||
|
||||
if (!rec && n >= 0 && n < vhistory.count) {
|
||||
rec = true;
|
||||
execute(vhistory[vhistory.count - n - 1]);
|
||||
execute(vhistory[vhistory.count - n - 1], true);
|
||||
rec = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ bool selset = false;
|
|||
sqr *s = S(sel->x + x, sel->y + y); \
|
||||
b; \
|
||||
} \
|
||||
remip(sel); \
|
||||
remip(sel, 0); \
|
||||
}
|
||||
|
||||
int cx, cy, ch;
|
||||
|
@ -440,7 +440,7 @@ replace()
|
|||
}
|
||||
}
|
||||
block b = { 0, 0, ssize, ssize };
|
||||
remip(&b);
|
||||
remip(&b, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -518,7 +518,7 @@ void
|
|||
setvdeltaxy(int delta, const block *sel)
|
||||
{
|
||||
loopselxy(s->vdelta = max(s->vdelta + delta, 0));
|
||||
remipmore(sel);
|
||||
remipmore(sel, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -563,7 +563,7 @@ arch(int sidedelta, int _a)
|
|||
(y == 0 || y == sel->ys - 1 ? sidedelta : 0))
|
||||
: (archverts[sel->ys - 1][y] +
|
||||
(x == 0 || x == sel->xs - 1 ? sidedelta : 0)));
|
||||
remipmore(sel);
|
||||
remipmore(sel, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -581,7 +581,7 @@ slope(int xd, int yd)
|
|||
// Ugly hack to make the macro work.
|
||||
block *sel = sel_;
|
||||
loopselxy(s->vdelta = xd * x + yd * y + off);
|
||||
remipmore(sel);
|
||||
remipmore(sel, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -596,7 +596,7 @@ perlin(int scale, int seed, int psize)
|
|||
perlinarea(&sel, scale, seed, psize);
|
||||
sel.xs++;
|
||||
sel.ys++;
|
||||
remipmore(&sel);
|
||||
remipmore(&sel, 0);
|
||||
sel.xs--;
|
||||
sel.ys--;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ renderentities()
|
|||
(float)S(e.x, e.y)->floor + mmi.zoff + e.attr3,
|
||||
e.y),
|
||||
(float)((e.attr1 + 7) - (e.attr1 + 7) % 15), 0,
|
||||
false, 1.0f, 10.0f, mmi.snap);
|
||||
false, 1.0f, 10.0f, mmi.snap, 0);
|
||||
} else {
|
||||
if (OUTBORD(e.x, e.y))
|
||||
continue;
|
||||
|
|
24
src/protos.h
24
src/protos.h
|
@ -7,7 +7,7 @@ extern void setvar(OFString *name, int i);
|
|||
extern int getvar(OFString *name);
|
||||
extern bool identexists(OFString *name);
|
||||
extern bool addcommand(OFString *name, void (*fun)(), int narg);
|
||||
extern int execute(OFString *p, bool down = true);
|
||||
extern int execute(OFString *p, bool down);
|
||||
extern void exec(OFString *cfgfile);
|
||||
extern bool execfile(OFIRI *cfgfile);
|
||||
extern void resetcomplete();
|
||||
|
@ -71,7 +71,7 @@ extern void setarraypointers();
|
|||
// client
|
||||
extern void localservertoclient(uchar *buf, int len);
|
||||
extern void connects(OFString *servername);
|
||||
extern void disconnect(int onlyclean = 0, int async = 0);
|
||||
extern void disconnect(bool onlyclean, bool async);
|
||||
extern void toserver(OFString *text);
|
||||
extern void addmsg(int rel, int num, int type, ...);
|
||||
extern bool multiplayer();
|
||||
|
@ -114,10 +114,10 @@ extern void renderscores();
|
|||
// world
|
||||
extern void setupworld(int factor);
|
||||
extern void empty_world(int factor, bool force);
|
||||
extern void remip(const block *b, int level = 0);
|
||||
extern void remipmore(const block *b, int level = 0);
|
||||
extern void remip(const block *b, int level);
|
||||
extern void remipmore(const block *b, int level);
|
||||
extern int closestent();
|
||||
extern int findentity(int type, int index = 0);
|
||||
extern int findentity(int type, int index);
|
||||
extern void trigger(int tag, int type, bool savegame);
|
||||
extern void resettagareas();
|
||||
extern void settagareas();
|
||||
|
@ -141,7 +141,7 @@ extern void computeraytable(float vx, float vy);
|
|||
extern int isoccluded(float vx, float vy, float cx, float cy, float csize);
|
||||
|
||||
// main
|
||||
extern void fatal(OFString *s, OFString *o = @"");
|
||||
extern void fatal(OFConstantString *s, ...);
|
||||
|
||||
// rendertext
|
||||
extern void draw_text(OFString *string, int left, int top, int gl_num);
|
||||
|
@ -160,7 +160,7 @@ extern void edittypexy(int type, const block *sel);
|
|||
extern void edittexxy(int type, int t, const block *sel);
|
||||
extern void editheightxy(bool isfloor, int amount, const block *sel);
|
||||
extern bool noteditmode();
|
||||
extern void pruneundos(int maxremain = 0);
|
||||
extern void pruneundos(int maxremain);
|
||||
|
||||
// renderextras
|
||||
extern void line(int x1, int y1, float z1, int x2, int y2, float z2);
|
||||
|
@ -188,7 +188,7 @@ extern void load_world(OFString *mname);
|
|||
extern void writemap(OFString *mname, int msize, uchar *mdata);
|
||||
extern OFData *readmap(OFString *mname);
|
||||
extern void loadgamerest();
|
||||
extern void incomingdemodata(uchar *buf, int len, bool extras = false);
|
||||
extern void incomingdemodata(uchar *buf, int len, bool extras);
|
||||
extern void demoplaybackstep();
|
||||
extern void stop();
|
||||
extern void stopifrecording();
|
||||
|
@ -203,7 +203,7 @@ extern void setentphysics(int mml, int mmr);
|
|||
extern void physicsframe();
|
||||
|
||||
// sound
|
||||
extern void playsound(int n, const OFVector3D *loc = NULL);
|
||||
extern void playsound(int n, const OFVector3D *loc);
|
||||
extern void playsoundc(int n);
|
||||
extern void initsound();
|
||||
extern void cleansound();
|
||||
|
@ -211,7 +211,7 @@ extern void cleansound();
|
|||
// rendermd2
|
||||
extern void rendermodel(OFString *mdl, int frame, int range, int tex, float rad,
|
||||
OFVector3D position, float yaw, float pitch, bool teammate, float scale,
|
||||
float speed, int snap = 0, int basetime = 0);
|
||||
float speed, int snap, int basetime);
|
||||
@class MapModelInfo;
|
||||
extern MapModelInfo *getmminfo(int i);
|
||||
|
||||
|
@ -237,10 +237,10 @@ extern void sendmaps(int n, OFString *mapname, int mapsize, uchar *mapdata);
|
|||
extern ENetPacket *recvmap(int n);
|
||||
|
||||
// weapon
|
||||
extern void selectgun(int a = -1, int b = -1, int c = -1);
|
||||
extern void selectgun(int a, int b, int c);
|
||||
extern void shoot(DynamicEntity *d, const OFVector3D *to);
|
||||
extern void shootv(int gun, const OFVector3D *from, const OFVector3D *to,
|
||||
DynamicEntity *d = 0, bool local = false);
|
||||
DynamicEntity *d, bool local);
|
||||
extern void createrays(const OFVector3D *from, const OFVector3D *to);
|
||||
extern void moveprojectiles(float time);
|
||||
extern void projreset();
|
||||
|
|
|
@ -23,7 +23,7 @@ delayedload(MD2 *m)
|
|||
|
||||
OFIRI *IRI1 = [baseIRI IRIByAppendingPathComponent:@"tris.md2"];
|
||||
if (![m loadWithIRI:IRI1])
|
||||
fatal(@"loadmodel: ", IRI1.string);
|
||||
fatal(@"loadmodel: %@", IRI1.string);
|
||||
|
||||
OFIRI *IRI2 = [baseIRI IRIByAppendingPathComponent:@"skin.jpg"];
|
||||
int xs, ys;
|
||||
|
|
|
@ -351,7 +351,7 @@ stopreset()
|
|||
conoutf(@"demo stopped (%d msec elapsed)", lastmillis - starttime);
|
||||
stop();
|
||||
[players removeAllObjects];
|
||||
disconnect(0, 0);
|
||||
disconnect(false, false);
|
||||
}
|
||||
|
||||
VAR(demoplaybackspeed, 10, 100, 1000);
|
||||
|
|
|
@ -273,7 +273,7 @@ updatefrommaster()
|
|||
conoutf(@"master server not replying");
|
||||
else {
|
||||
[servers removeAllObjects];
|
||||
execute(@((char *)reply));
|
||||
execute(@((char *)reply), true);
|
||||
}
|
||||
servermenu();
|
||||
}
|
||||
|
|
|
@ -140,10 +140,17 @@ localservertoclient(uchar *buf, int len)
|
|||
}
|
||||
|
||||
void
|
||||
fatal(OFString *s, OFString *o)
|
||||
fatal(OFConstantString *s, ...)
|
||||
{
|
||||
cleanupserver();
|
||||
[OFStdOut writeFormat:@"servererror: %@\n", s];
|
||||
|
||||
va_list args;
|
||||
va_start(args, s);
|
||||
OFString *msg = [[OFString alloc] initWithFormat:s arguments:args];
|
||||
va_end(args);
|
||||
|
||||
[OFStdOut writeFormat:@"servererror: %@\n", msg];
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ void
|
|||
playsoundc(int n)
|
||||
{
|
||||
addmsg(0, 2, SV_SOUND, n);
|
||||
playsound(n);
|
||||
playsound(n, NULL);
|
||||
}
|
||||
|
||||
int soundsatonce = 0, lastsoundmillis = 0;
|
||||
|
|
10
src/world.mm
10
src/world.mm
|
@ -42,7 +42,7 @@ settag(int tag, int type)
|
|||
}
|
||||
block b = { minx, miny, maxx - minx + 1, maxy - miny + 1 };
|
||||
if (maxx)
|
||||
remip(&b); // remip minimal area of changed geometry
|
||||
remip(&b, 0); // remip minimal area of changed geometry
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -70,13 +70,13 @@ trigger(int tag, int type, bool savegame)
|
|||
settag(tag, type);
|
||||
|
||||
if (!savegame && type != 3)
|
||||
playsound(S_RUMBLE);
|
||||
playsound(S_RUMBLE, NULL);
|
||||
|
||||
OFString *aliasname =
|
||||
[OFString stringWithFormat:@"level_trigger_%d", tag];
|
||||
|
||||
if (identexists(aliasname))
|
||||
execute(aliasname);
|
||||
execute(aliasname, true);
|
||||
|
||||
if (type == 2)
|
||||
endsp(false);
|
||||
|
@ -457,7 +457,7 @@ empty_world(int factor, bool force)
|
|||
if (!force && noteditmode())
|
||||
return;
|
||||
cleardlights();
|
||||
pruneundos();
|
||||
pruneundos(0);
|
||||
sqr *oldworld = world;
|
||||
bool copy = false;
|
||||
if (oldworld && factor < 0) {
|
||||
|
@ -516,7 +516,7 @@ empty_world(int factor, bool force)
|
|||
if (oldworld) {
|
||||
OFFreeMemory(oldworld);
|
||||
toggleedit();
|
||||
execute(@"fullbright 1");
|
||||
execute(@"fullbright 1", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ load_world(OFString *mname) // still supports all map formats that have existed
|
|||
{
|
||||
stopifrecording();
|
||||
cleardlights();
|
||||
pruneundos();
|
||||
pruneundos(0);
|
||||
setnames(mname);
|
||||
gzFile f =
|
||||
gzopen([cgzname cStringWithEncoding:OFLocale.encoding], "rb9");
|
||||
|
@ -350,13 +350,10 @@ load_world(OFString *mname) // still supports all map formats that have existed
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
if (type < 0 || type >= MAXTYPE) {
|
||||
OFString *t = [OFString
|
||||
stringWithFormat:@"%d @ %d", type, k];
|
||||
fatal(@"while reading map: type out of "
|
||||
@"range: ",
|
||||
t);
|
||||
}
|
||||
if (type < 0 || type >= MAXTYPE)
|
||||
fatal(@"while reading map: type out of range: "
|
||||
@"%d @ %d",
|
||||
type, k);
|
||||
s->type = type;
|
||||
s->floor = gzgetc(f);
|
||||
s->ceil = gzgetc(f);
|
||||
|
|
|
@ -165,7 +165,7 @@ postlightarea(block &a) // median filter, smooths out random noise in light and
|
|||
median(b);
|
||||
}
|
||||
|
||||
remip(&a);
|
||||
remip(&a, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -268,5 +268,5 @@ blockpaste(const block *b)
|
|||
for (int x = b->x; x < b->xs + b->x; x++)
|
||||
for (int y = b->y; y < b->ys + b->y; y++)
|
||||
*S(x, y) = *q++;
|
||||
remipmore(b);
|
||||
remipmore(b, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue