Comment: | Convert to ObjC++ |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7c2704b3d77d6e63d960e315bfb601fd |
User & Date: | js on 2024-07-21 12:02:07 |
Other Links: | manifest | tags |
2024-08-02
| ||
11:09 | Fix crash when compiled with Clang check-in: 5e7a0895eb user: js tags: trunk | |
2024-07-21
| ||
12:02 | Convert to ObjC++ check-in: 7c2704b3d7 user: js tags: trunk | |
2024-07-20
| ||
21:49 | Fix needing -fpermissive check-in: bd82b5a5b1 user: js tags: trunk | |
Modified configure.ac from [05470e5b2e] to [e3f3f558bf].
︙ | ︙ | |||
9 10 11 12 13 14 15 | ]) done BUILDSYS_INIT AC_PROG_CC AC_PROG_CPP | | | | > > > > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ]) done BUILDSYS_INIT AC_PROG_CC AC_PROG_CPP AC_PROG_OBJCXX(clang++ g++) AC_PROG_OBJCXXCPP AC_CHECK_TOOL(OBJFW_CONFIG, objfw-config) AS_IF([test x"$OBJFW_CONFIG" = x""], [ AC_MSG_ERROR(You need ObjFW and objfw-config installed!) ]) OBJCXXFLAGS="$OBJCXXFLAGS $($OBJFW_CONFIG --cppflags --objcflags)" LDFLAGS="$($OBJFW_CONFIG --ldflags --rpath)" LIBS="$($OBJFW_CONFIG --libs) $LIBS" AC_PATH_TOOL(AR, ar) AC_PATH_TOOL(RANLIB, ranlib) PKG_CHECK_MODULES(SDL, [ sdl12_compat >= 1.2 SDL_image >= 1.2 |
︙ | ︙ |
Modified src/Makefile from [0d0753c570] to [0d9a0e0a60].
1 2 | PROG = client | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | PROG = client SRCS = client.mm \ clientextras.mm \ clientgame.mm \ clients2c.mm \ command.mm \ console.mm \ editing.mm \ entities.mm \ main.mm \ menus.mm \ monster.mm \ physics.mm \ rendercubes.mm \ renderextras.mm \ rendergl.mm \ rendermd2.mm \ renderparticles.mm \ rendertext.mm \ rndmap.mm \ savegamedemo.mm \ server.mm \ serverbrowser.mm \ serverms.mm \ serverutil.mm \ sound.mm \ tools.mm \ weapon.mm \ world.mm \ worldio.mm \ worldlight.mm \ worldocull.mm \ worldrender.mm include ../buildsys.mk include ../extra.mk CPPFLAGS += -I../enet/include \ ${SDL_CFLAGS} \ ${GL_CFLAGS} \ ${GLU_CFLAGS} \ ${X11_CFLAGS} \ ${ZLIB_CFLAGS} LIBS += -L../enet -lenet \ ${SDL_LIBS} \ ${GL_LIBS} \ ${GLU_LIBS} \ ${X11_LIBS} \ ${ZLIB_LIBS} \ -lm LD = ${OBJCXX} |
Name change from src/client.cxx to src/client.mm.
Name change from src/clientextras.cxx to src/clientextras.mm.
Name change from src/clientgame.cxx to src/clientgame.mm.
Name change from src/clients2c.cxx to src/clients2c.mm.
Renamed and modified src/command.cxx [4e6af6f959] to src/command.mm [e3c08f18b8].
︙ | ︙ | |||
151 152 153 154 155 156 157 | return NULL; return newstring(word, p - word); }; char * lookup(char *n) // find value of ident referenced with $ in exp { | | | | | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | return NULL; return newstring(word, p - word); }; char * lookup(char *n) // find value of ident referenced with $ in exp { ident *ID = idents->access(n + 1); if (ID) switch (ID->type) { case ID_VAR: string t; itoa(t, *(ID->storage)); return exchangestr(n, t); case ID_ALIAS: return exchangestr(n, ID->action); }; conoutf("unknown alias lookup: %s", n + 1); return n; }; int execute(char *p, bool isdown) // all evaluation happens here, recursively |
︙ | ︙ | |||
198 199 200 201 202 203 204 | 0; // more statements if this isn't the end of the string char *c = w[0]; if (*c == '/') c++; // strip irc-style command prefix if (!*c) continue; // empty statement | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | 0; // more statements if this isn't the end of the string char *c = w[0]; if (*c == '/') c++; // strip irc-style command prefix if (!*c) continue; // empty statement ident *ID = idents->access(c); if (!ID) { val = ATOI(c); if (!val && *c != '0') conoutf("unknown command: %s", c); } else switch (ID->type) { case ID_COMMAND: // game defined commands switch (ID->narg) // use very ad-hoc function // signature, and just call it { case ARG_1INT: if (isdown) ((void(__cdecl *)(int))ID->fun)( ATOI(w[1])); break; case ARG_2INT: if (isdown) ((void(__cdecl *)( int, int))ID->fun)( ATOI(w[1]), ATOI(w[2])); break; case ARG_3INT: if (isdown) ((void(__cdecl *)(int, int, int))ID->fun)(ATOI(w[1]), ATOI(w[2]), ATOI(w[3])); break; case ARG_4INT: if (isdown) ((void(__cdecl *)(int, int, int, int))ID->fun)(ATOI(w[1]), ATOI(w[2]), ATOI(w[3]), ATOI(w[4])); break; case ARG_NONE: if (isdown) ((void(__cdecl *)())ID->fun)(); break; case ARG_1STR: if (isdown) ((void(__cdecl *)( char *))ID->fun)(w[1]); break; case ARG_2STR: if (isdown) ((void(__cdecl *)( char *, char *))ID->fun)( w[1], w[2]); break; case ARG_3STR: if (isdown) ((void(__cdecl *)(char *, char *, char *))ID->fun)( w[1], w[2], w[3]); break; case ARG_5STR: if (isdown) ((void(__cdecl *)(char *, char *, char *, char *, char *))ID->fun)(w[1], w[2], w[3], w[4], w[5]); break; case ARG_DOWN: ((void(__cdecl *)(bool))ID->fun)( isdown); break; case ARG_DWN1: ((void(__cdecl *)(bool, char *))ID->fun)(isdown, w[1]); break; case ARG_1EXP: if (isdown) val = ((int(__cdecl *)( int))ID->fun)( execute(w[1])); break; case ARG_2EXP: if (isdown) val = ((int(__cdecl *)(int, int))ID->fun)(execute(w[1]), execute(w[2])); break; case ARG_1EST: if (isdown) val = ((int(__cdecl *)( char *))ID->fun)(w[1]); break; case ARG_2EST: if (isdown) val = ((int(__cdecl *)( char *, char *))ID->fun)( w[1], w[2]); break; case ARG_VARI: if (isdown) { string r; // limit, remove r[0] = 0; for (int i = 1; i < numargs; i++) { strcat_s(r, w[i]); // make // string-list // out of all // arguments if (i == numargs - 1) break; strcat_s(r, " "); }; ((void(__cdecl *)( char *))ID->fun)(r); break; } }; break; case ID_VAR: // game defined variabled if (isdown) { if (!w[1][0]) conoutf("%s = %d", c, *ID->storage); // var with // no value // just // prints its // current // value else { if (ID->min > ID->max) { conoutf("variable is " "read-only"); } else { int i1 = ATOI(w[1]); if (i1 < ID->min || i1 > ID->max) { i1 = i1 < ID->min ? ID->min : ID->max; // clamp to valid range conoutf( "valid " "range for " "%s is " "%d..%d", c, ID->min, ID->max); } *ID->storage = i1; }; if (ID->fun) ((void(__cdecl *)())ID ->fun)(); // call // trigger // function // if // available }; }; break; case ID_ALIAS: // alias, also used as functions and // (global) variables for (int i = 1; i < numargs; i++) { sprintf_sd(t)("arg%d", i); // set any arguments as (global) // arg values so functions can // access them alias(t, w[i]); }; char *action = newstring( ID->action); // create new string here // because alias could rebind // itself val = execute(action, isdown); gp()->deallocstr(action); break; }; loopj(numargs) gp()->deallocstr(w[j]); |
︙ | ︙ | |||
450 451 452 453 454 455 456 | fprintf(f, "// automatically written on exit, do not modify\n// delete " "this file to have defaults.cfg overwrite these " "settings\n// modify settings in game, or put settings in " "autoexec.cfg to override anything\n\n"); writeclientinfo(f); fprintf(f, "\n"); enumerate( | | | | | | | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | fprintf(f, "// automatically written on exit, do not modify\n// delete " "this file to have defaults.cfg overwrite these " "settings\n// modify settings in game, or put settings in " "autoexec.cfg to override anything\n\n"); writeclientinfo(f); fprintf(f, "\n"); enumerate( idents, ident *, ID, if (ID->type == ID_VAR && ID->persist) { fprintf(f, "%s %d\n", ID->name, *ID->storage); };); fprintf(f, "\n"); writebinds(f); fprintf(f, "\n"); enumerate( idents, ident *, ID, if (ID->type == ID_ALIAS && !strstr(ID->name, "nextmap_")) { fprintf(f, "alias \"%s\" [%s]\n", ID->name, ID->action); };); fclose(f); }; COMMAND(writecfg, ARG_NONE); // below the commands that implement a small imperative language. thanks to the |
︙ | ︙ |
Name change from src/console.cxx to src/console.mm.
Name change from src/editing.cxx to src/editing.mm.
Name change from src/entities.cxx to src/entities.mm.
Name change from src/main.cxx to src/main.mm.
Name change from src/menus.cxx to src/menus.mm.
Name change from src/monster.cxx to src/monster.mm.
Name change from src/physics.cxx to src/physics.mm.
Name change from src/rendercubes.cxx to src/rendercubes.mm.
Name change from src/renderextras.cxx to src/renderextras.mm.
Name change from src/rendergl.cxx to src/rendergl.mm.
Name change from src/rendermd2.cxx to src/rendermd2.mm.
Name change from src/renderparticles.cxx to src/renderparticles.mm.
Name change from src/rendertext.cxx to src/rendertext.mm.
Name change from src/rndmap.cxx to src/rndmap.mm.
Name change from src/savegamedemo.cxx to src/savegamedemo.mm.
Name change from src/server.cxx to src/server.mm.
Name change from src/serverbrowser.cxx to src/serverbrowser.mm.
Name change from src/serverms.cxx to src/serverms.mm.
Name change from src/serverutil.cxx to src/serverutil.mm.
Name change from src/sound.cxx to src/sound.mm.
Name change from src/tools.cxx to src/tools.mm.
Name change from src/weapon.cxx to src/weapon.mm.
Name change from src/world.cxx to src/world.mm.
Name change from src/worldio.cxx to src/worldio.mm.
Name change from src/worldlight.cxx to src/worldlight.mm.
Name change from src/worldocull.cxx to src/worldocull.mm.
Name change from src/worldrender.cxx to src/worldrender.mm.