Comment: | Clean up console output functions |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
003b06901f169b5d97cbbaa313ad31a2 |
User & Date: | js on 2025-03-05 21:55:28 |
Other Links: | manifest | tags |
2025-03-05
| ||
22:24 | Clean up key mapping check-in: 31ef5be209 user: js tags: trunk | |
21:55 | Clean up console output functions check-in: 003b06901f user: js tags: trunk | |
21:29 | Clean up file handling check-in: 3d55e077f7 user: js tags: trunk | |
Modified src/Cube.mm from [ee205df0bd] to [398e5608de].
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - - + + | bool dedicated, windowed; int par = 0, uprate = 0, maxcl = 4; OFString *__autoreleasing sdesc, *__autoreleasing ip; OFString *__autoreleasing master, *__autoreleasing passwd; processInitQueue(); |
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - + - + - + - + - + - + - + | ip = @""; if (passwd == nil) passwd = @""; if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | par) < 0) fatal(@"Unable to initialize SDL"); |
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - + - + - + - + | !installtex(1, [_userDataIRI IRIByAppendingPathComponent:@"data/crosshair.png"], &xs, &ys, false)) fatal(@"could not find core textures (hint: run cube from the " @"parent of the bin directory)"); |
Modified src/client.mm from [74876b82b8] to [733d35b36f].
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - - - + + - - + + + - + - - + + + - - - - - - - - + + + + + + + + - | { fprintf(f, "name \"%s\"\nteam \"%s\"\n", player1->name, player1->team); } void connects(OFString *servername) { |
Modified src/clientextras.mm from [8bec7c55fe] to [0dee11d744].
176 177 178 179 180 181 182 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | - - + - + - - + + | NULL, MAXTRANS + mapsize, ENET_PACKET_FLAG_RELIABLE); uchar *start = packet->data; uchar *p = start + 2; putint(p, SV_SENDMAP); sendstring(mapname.UTF8String, p); putint(p, mapsize); if (65535 - (p - start) < mapdata.count) { |
Modified src/clientgame.mm from [48319d1ae1] to [810509b4e7].
156 157 158 159 160 161 162 | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | - + | arenarespawn() { if (arenarespawnwait) { if (arenarespawnwait < lastmillis) { arenarespawnwait = 0; conoutf(@"new round starting... fight!"); respawnself(); |
298 299 300 301 302 303 304 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | - + | float dy = (rnd(21) - 10) / 10.0f * i; d->o.x += dx; d->o.y += dy; if (collide(d, true, 0, 0)) return; d->o.x -= dx; d->o.y -= dy; |
473 474 475 476 477 478 479 | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | - + - + | } } dynent * getclient(int cn) // ensure valid entity { if (cn < 0 || cn >= MAXCLIENTS) { |
Modified src/clients2c.mm from [4923c509fd] to [8a230870d2].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | - + - + | // client processing of the incoming network stream #include "cube.h" extern int clientnum; extern bool c2sinit, senditemstoserver; extern OFString *toservermap; extern string clientpassword; void |
55 56 57 58 59 60 61 | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + | }; void localservertoclient( uchar *buf, int len) // processes any updates from the server { if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len) |
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | - + - - + + - | int prot = getint(p); if (prot != PROTOCOL_VERSION) { conoutf(@"you are using a different game " @"protocol (you: %d, server: %d)", PROTOCOL_VERSION, prot); disconnect(); return; |
168 169 170 171 172 173 174 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - + - + + - + - - + | break; } case SV_INITC2S: // another client either connected or changed // name/team { sgetstr(); |
381 382 383 384 385 386 387 | 380 381 382 383 384 385 386 387 388 389 390 | - + | { for (int n = getint(p); n; n--) getint(p); break; } default: |
Modified src/command.mm from [9583e64f42] to [931e4eb08f].
50 51 52 53 54 55 56 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | + - + - | b.persist = true; idents[b.name] = b; } else { if (b.type == ID_ALIAS) b.action = action; else conoutf( |
573 574 575 576 577 578 579 | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | - + | } void exec(OFString *cfgfile) { if (!execfile(cfgfile)) { @autoreleasepool { |
Modified src/console.mm from [d534e6476d] to [ea51019800].
23 24 25 26 27 28 29 | 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | - - + + - + - + - + - + - - - - - - - - - - - + + + + + + + + + + + + + + + - + + | { conskip += n; if (conskip < 0) conskip = 0; } COMMANDN(conskip, setconskip, ARG_1INT) |
Modified src/editing.mm from [78d08b56c5] to [c8df421539].
91 92 93 94 95 96 97 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + - + | bool noteditmode() { correctsel(); if (!editmode) conoutf(@"this function is only allowed in edit mode"); return !editmode; |
262 263 264 265 266 267 268 | 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 | - + - + - + - + - + | void editundo() { EDITMP; if (undos.empty()) { conoutf(@"nothing more to undo"); return; |
443 444 445 446 447 448 449 | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | - + - + | { EDITSEL; 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"); return; |
Modified src/entities.mm from [1ac9739b65] to [fa2e7605f2].
213 214 215 216 217 218 219 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - + | { int e = -1, tag = ents[n].attr1, beenhere = -1; for (;;) { e = findentity(TELEDEST, e + 1); if (e == beenhere || e < 0) { conoutf(@"no teleport destination for tag %d", tag); return; |
Modified src/monster.mm from [a11e61394d] to [34205145ec].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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 | + - + - + | // monster.cpp: implements AI for single player monsters, currently client only #include "cube.h" dvector monsters; int nextmonster, spawnremain, numkilled, monstertotal, mtimestart; VARF(skill, 1, 3, 10, conoutf(@"skill is now %d", skill)); dvector & getmonsters() { return monsters; } |
341 342 343 344 345 346 347 | 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 | - + - + | player1->frags = numkilled; playsound(monstertypes[m->mtype].diesound, &m->o); int remain = monstertotal - numkilled; if (remain > 0 && remain <= 5) conoutf(@"only %d monster(s) remaining", remain); } else { playsound(monstertypes[m->mtype].painsound, &m->o); |
397 398 399 400 401 402 403 | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | - + | if (dist < 4) teleport((int)(&e - &ents[0]), monsters[i]); }; }; loopv(monsters) if (monsters[i]->state == CS_ALIVE) monsteraction(monsters[i]); |
Modified src/protos.h from [8b1e3ca44e] to [c2d6bbe699].
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + | extern void alias(OFString *name, OFString *action); extern OFString *getalias(OFString *name); extern void writecfg(); // console extern void keypress(int code, bool isdown, int cooked); extern void renderconsole(); |
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - + | extern void toserver(char *text); extern void addmsg(int rel, int num, int type, ...); extern bool multiplayer(); extern bool allowedittoggle(); extern void sendpackettoserv(void *packet); extern void gets2c(); extern void c2sinfo(dynent *d); |
Modified src/rendergl.mm from [86ca5a8f24] to [7db200290d].
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | - - + - - + + - - + + | bool installtex(int tnum, OFIRI *IRI, int *xs, int *ys, bool clamp) { @autoreleasepool { SDL_Surface *s = IMG_Load(IRI.fileSystemRepresentation.UTF8String); if (s == NULL) { |
131 132 133 134 135 136 137 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - + - - + | *xs /= 2; *ys /= 2; } void *scaledimg = s->pixels; if (*xs != s->w) { |
Modified src/savegamedemo.mm from [ba5f21d861] to [01f038147b].
91 92 93 94 95 96 97 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - + | savestate(char *fn) { stop(); f = gzopen(fn, "wb9"); if (!f) { conoutf(@"could not write %s", fn); return; |
182 183 184 185 186 187 188 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - + | void loadgameout() { stop(); conoutf(@"loadgame incomplete: savegame from a different version of " @"this map"); |
233 234 235 236 237 238 239 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | - + | }; conoutf(@"savegame restored"); if (demoloading) startdemo(); else stop(); |
Modified src/sound.mm from [b06342c3fd] to [320b4f8793].
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | + - + | FSOUND_Stream_Play(FSOUND_FREE, stream); if (chan >= 0) { FSOUND_SetVolume( chan, (musicvol * MAXVOL) / 255); FSOUND_SetPaused(chan, false); } } else { conoutf( |
Modified src/weapon.mm from [32ce1b4cac] to [efed2ffe54].
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + | else if (s != GUN_RIFLE && player1->ammo[GUN_RIFLE]) s = GUN_RIFLE; else s = GUN_FIST; if (s != player1->gunselect) playsoundc(S_WEAPLOAD); player1->gunselect = s; |
Modified src/world.mm from [061f7f026c] to [dc3bab95c0].
302 303 304 305 306 307 308 | 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 | - + - + - + | void delent() { int e = closestent(); if (e < 0) { conoutf(@"no more entities"); return; |