Comment: | Make conoutf take an OFString |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f8f97851f3ec3f0920a95912e7bfe589 |
User & Date: | js on 2024-08-03 17:02:33 |
Other Links: | manifest | tags |
2024-08-03
| ||
17:11 | Improve clang-format file check-in: 2bc02cf470 user: js tags: trunk | |
17:02 | Make conoutf take an OFString check-in: f8f97851f3 user: js tags: trunk | |
15:12 | Start migrating commands / variables to ObjC++ check-in: f4c57c1df0 user: js tags: trunk | |
Modified src/client.mm from [217fc4ecf8] to [65bd73d8a9].
︙ | |||
9 10 11 12 13 14 15 | 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 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 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 | - + - + + - + + - + + - + - + + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - - + + - + - + + - + - + - + | int clientnum = -1; // our client id in the game bool c2sinit = false; // whether we need to tell the other clients our stats int getclientnum() { return clientnum; |
︙ | |||
182 183 184 185 186 187 188 | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | - + - + - + - + | return; if (num != msgsizelookup(type)) { sprintf_sd(s)("inconsistant msg size for %d (%d != %d)", type, num, msgsizelookup(type)); fatal(s); }; if (messages.length() == 100) { |
︙ | |||
341 342 343 344 345 346 347 | 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 | - + - + - + - + | void gets2c() // get updates from the server { ENetEvent event; if (!clienthost) return; if (connecting && lastmillis / 3000 > connecting / 3000) { |
︙ |
Modified src/clientextras.mm from [1f60f5711b] to [3d0c884313].
︙ | |||
175 176 177 178 179 180 181 | 175 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 203 204 205 206 207 208 209 210 211 212 213 214 | - + - + - + | NULL, MAXTRANS + mapsize, ENET_PACKET_FLAG_RELIABLE); uchar *start = packet->data; uchar *p = start + 2; putint(p, SV_SENDMAP); sendstring(mapname, p); putint(p, mapsize); if (65535 - (p - start) < mapsize) { |
Modified src/clientgame.mm from [f88f2d9175] to [8334b2a352].
︙ | |||
154 155 156 157 158 159 160 | 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 | - + - + - + - + | void arenarespawn() { if (arenarespawnwait) { if (arenarespawnwait < lastmillis) { arenarespawnwait = 0; |
︙ | |||
214 215 216 217 218 219 220 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - + | void respawn() { if (player1->state == CS_DEAD) { player1->attacking = false; if (m_arena) { |
︙ | |||
295 296 297 298 299 300 301 | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | - - + + | d->o.x += dx; d->o.y += dy; if (collide(d, true, 0, 0)) return; d->o.x -= dx; d->o.y -= dy; }; |
︙ | |||
418 419 420 421 422 423 424 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | - + - + - - + + - + - - - + + + - - + + - - + + - + - - + + - + - + - + - + | : (player1->roll < 0 ? -droll : (rnd(2) ? droll : -droll)); // give player a kick depending // on amount of damage if ((player1->health -= damage) <= 0) { if (actor == -2) { |
Modified src/clients2c.mm from [eb9667cf69] to [e92e9ee6ab].
1 2 3 4 5 6 7 8 9 10 11 12 | 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 string toservermap; extern string clientpassword; void neterr(char *s) { |
︙ | |||
72 73 74 75 76 77 78 | 72 73 74 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 | - - + + - - + + - + | while (p < end) switch (type = getint(p)) { case SV_INITS2C: // welcome messsage from the server { cn = getint(p); int prot = getint(p); if (prot != PROTOCOL_VERSION) { |
︙ | |||
132 133 134 135 136 137 138 | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 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 188 189 190 191 192 193 194 195 196 197 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 | - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - - + + + - + - + | case SV_SOUND: playsound(getint(p), &d->o); break; case SV_TEXT: sgetstr(); |
︙ | |||
308 309 310 311 312 313 314 | 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 | - + - + - + | break; case SV_EDITD: setvdeltaxy(v, b); break; case SV_EDITE: editequalisexy(v != 0, b); break; |
︙ | |||
357 358 359 360 361 362 363 | 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 382 383 384 385 386 387 388 389 390 | - + - + - + - + - - + + | case SV_TIMEUP: timeupdate(getint(p)); break; case SV_RECVMAP: { sgetstr(); |
Modified src/command.mm from [ccec6a17e5] to [61c1fa172a].
︙ | |||
50 51 52 53 54 55 56 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - + | idents[@(name)] = b; } else { if (b.type == ID_ALIAS) b.action = exchangestr(b.action, action); else conoutf( |
︙ | |||
148 149 150 151 152 153 154 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | - + | *(p - 1) = ' '; // hack if (c == left) brak++; else if (c == right) brak--; else if (!c) { p--; |
︙ | |||
207 208 209 210 211 212 213 | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - + | return exchangestr(n, t); case ID_ALIAS: return exchangestr(n, ID.action); } } } |
︙ | |||
250 251 252 253 254 255 256 | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | - + | @autoreleasepool { Ident *ID = idents[@(c)]; if (ID == nil) { val = ATOI(c); if (!val && *c != '0') |
︙ | |||
391 392 393 394 395 396 397 | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | - + - - - - + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + | // game defined variables case ID_VAR: if (isdown) { if (!w[1][0]) // var with no value // just prints its // current value |
︙ | |||
529 530 531 532 533 534 535 | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | - + | return true; } void exec(char *cfgfile) { if (!execfile(cfgfile)) |
︙ |
Modified src/console.mm from [ee8378b098] to [1df29be187].
︙ | |||
46 47 48 49 50 51 52 | 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 | - + - - + + - + | puts(cl.cref); #ifndef _WIN32 fflush(stdout); #endif }; void |
︙ | |||
110 111 112 113 114 115 116 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | - + | for (char *x = key; *x; x++) *x = toupper(*x); loopi(numkm) if (strcmp(keyms[i].name, key) == 0) { strcpy_s(keyms[i].action, action); return; }; |
︙ |
Modified src/cube.h from [ac53062292] to [9271127084].
︙ | |||
390 391 392 393 394 395 396 | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | - + - + - + - + - + | }; // nasty macros for registering script functions, abuses globals to avoid // excessive infrastructure #define COMMANDN(name, fun, nargs) \ OF_CONSTRUCTOR() \ { \ |
︙ |
Modified src/editing.mm from [df7a7d4fb4] to [35e47e0fb8].
︙ | |||
83 84 85 86 87 88 89 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - + - + | }; bool noteditmode() { correctsel(); if (!editmode) |
︙ | |||
254 255 256 257 258 259 260 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - + | }; void editundo() { EDITMP; if (undos.empty()) { |
︙ | |||
278 279 280 281 282 283 284 | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | - + - + | }; void paste() { EDITMP; if (!copybuf) { |
︙ | |||
436 437 438 439 440 441 442 | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | - + | void edittype(int type) { 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)) { |
︙ |
Modified src/entities.mm from [a95a1806cd] to [2a578e1163].
︙ | |||
180 181 182 183 184 185 186 | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - + - - + + - - + + - + | case I_YELLOWARMOUR: radditem(n, d->armour); d->armourtype = A_YELLOW; break; case I_QUAD: radditem(n, d->quadmillis); |
︙ | |||
328 329 330 331 332 333 334 | 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 | - + - - + + - - + + | void checkquad(int time) { if (player1->quadmillis && (player1->quadmillis -= time) < 0) { player1->quadmillis = 0; playsoundc(S_PUPOUT); |
Modified src/main.mm from [65508559f3] to [6994beff69].
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | - + | bool dedicated = false; int fs = SDL_FULLSCREEN, par = 0, uprate = 0, maxcl = 4; char *sdesc = "", *ip = "", *master = NULL, *passwd = ""; islittleendian = *((char *)&islittleendian); processInitQueue(); |
︙ | |||
140 141 142 143 144 145 146 | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | - + - + | case 'p': passwd = a; break; case 'c': maxcl = atoi(a); break; default: |
︙ |
Modified src/monster.mm from [c901f05b50] to [1a6c1928af].
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | - + | // monster.cpp: implements AI for single player monsters, currently client only #include "cube.h" dvector monsters; int nextmonster, spawnremain, numkilled, monstertotal, mtimestart; |
︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + | "a goblin", "monster/goblin"}, }; dynent * basicmonster(int type, int yaw, int state, int trigger, int move) { if (type >= NUMMONSTERTYPES) { |
︙ | |||
336 337 338 339 340 341 342 | 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 | - + - - - + + + - + | m->state = CS_DEAD; m->lastaction = lastmillis; numkilled++; player1->frags = numkilled; playsound(monstertypes[m->mtype].diesound, &m->o); int remain = monstertotal - numkilled; if (remain > 0 && remain <= 5) |
︙ |
Modified src/protos.h from [135758e2d7] to [93475710ee].
︙ | |||
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(char *name, char *action); extern char *getalias(char *name); extern void writecfg(); // console extern void keypress(int code, bool isdown, int cooked); extern void renderconsole(); |
︙ |
Modified src/rendercubes.mm from [53768c91a1] to [93318b77b9].
︙ | |||
67 68 69 70 71 72 73 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + | { showm = !showm; }; void mipstats(int a, int b, int c) { if (showm) |
︙ |
Modified src/renderextras.mm from [6c33874cb2] to [93b4bffbbf].
︙ | |||
206 207 208 209 210 211 212 | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | - + | char *side[] = {"ft", "bk", "lf", "rt", "dn", "up"}; int texnum = 14; loopi(6) { sprintf_sd(name)("packages/%s_%s.jpg", basename, side[i]); int xs, ys; if (!installtex(texnum + i, path(name), xs, ys, true)) |
︙ |
Modified src/rendergl.mm from [b149b97fcf] to [155f47c457].
︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | - - + + | glEnable(GL_CULL_FACE); char *exts = (char *)glGetString(GL_EXTENSIONS); if (strstr(exts, "GL_EXT_texture_env_combine")) hasoverbright = true; else |
︙ | |||
73 74 75 76 77 78 79 | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - + - + | }; bool installtex(int tnum, char *texname, int &xs, int &ys, bool clamp) { SDL_Surface *s = IMG_Load(texname); if (!s) { |
︙ | |||
99 100 101 102 103 104 105 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + | ys = s->h; while (xs > glmaxtexsize || ys > glmaxtexsize) { xs /= 2; ys /= 2; }; void *scaledimg = s->pixels; if (xs != s->w) { |
︙ | |||
270 271 272 273 274 275 276 | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | - - + + | s.num = n; }; VARFP(gamma, 30, 100, 300, { float f = gamma / 100.0f; if (SDL_SetGamma(f, f, f) == -1) { conoutf( |
︙ |
Modified src/savegamedemo.mm from [c33c84c43c] to [5f329655d6].
︙ | |||
80 81 82 83 84 85 86 | 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | - + - - + + - + - + - + - + - + - + - - + + - + - + - - + + | void savestate(char *fn) { stop(); f = gzopen(fn, "wb9"); if (!f) { |
︙ | |||
208 209 210 211 212 213 214 | 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 | - + - + - + | loopi(nplayers) if (!gzget()) { dynent *d = getclient(i); assert(d); gzread(f, d, sizeof(dynent)); }; |
︙ | |||
278 279 280 281 282 283 284 | 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 | - + - - + + - + - + - + - + - + - + - + - + | gzput(player1->state); gzputi(bdamage); bdamage = 0; gzputi(ddamage); if (ddamage) { gzputv(dorig); ddamage = 0; |
︙ | |||
374 375 376 377 378 379 380 | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | - + | void demoplaybackstep() { while (demoplayback && lastmillis >= playbacktime) { int len = gzgeti(); if (len < 1 || len > MAXTRANS) { conoutf( |
︙ | |||
479 480 481 482 483 484 485 | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | - + | void stopn() { if (demoplayback) stopreset(); else stop(); |
Modified src/serverbrowser.mm from [01d1ff60c2] to [164c8571dd].
︙ | |||
302 303 304 305 306 307 308 | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | - + | updatefrommaster() { const int MAXUPD = 32000; uchar buf[MAXUPD]; uchar *reply = retrieveservers(buf, MAXUPD); if (!*reply || strstr((char *)reply, "<html>") || strstr((char *)reply, "<HTML>")) |
︙ |
Modified src/sound.mm from [ebc1ddf348] to [da17c5965d].
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | - + - + | void initsound() { memset(soundlocs, 0, sizeof(soundloc) * MAXCHAN); #ifdef USE_MIXER if (Mix_OpenAudio(SOUNDFREQ, MIX_DEFAULT_FORMAT, 2, soundbufferlen) < 0) { |
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | - + | int chan = FSOUND_Stream_Play(FSOUND_FREE, stream); if (chan >= 0) { FSOUND_SetVolume( chan, (musicvol * MAXVOL) / 255); FSOUND_SetPaused(chan, false); }; } else { |
︙ | |||
224 225 226 227 228 229 230 | 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 | - + - + | else soundsatonce = 1; lastsoundmillis = lastmillis; if (soundsatonce > 5) return; // avoid bursts of sounds with heavy packetloss and in // sp if (n < 0 || n >= samples.length()) { |
︙ |
Modified src/weapon.mm from [ce8dd423e7] to [2770740083].
︙ | |||
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 [cb52ab13f9] to [0157413baa].
︙ | |||
289 290 291 292 293 294 295 | 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 | - + - + - + | }; void delent() { int e = closestent(); if (e < 0) { |
︙ |
Modified src/worldio.mm from [4ce3f10da1] to [e1e98ece3c].
︙ | |||
124 125 126 127 128 129 130 | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - + - + - + | void writemap(char *mname, int msize, uchar *mdata) { setnames(mname); backup(cgzname, bakname); FILE *f = fopen(cgzname, "wb"); if (!f) { |
︙ | |||
161 162 163 164 165 166 167 | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | - + | toptimize(); if (!*mname) mname = getclientmap(); setnames(mname); backup(cgzname, bakname); gzFile f = gzopen(cgzname, "wb9"); if (!f) { |
︙ | |||
233 234 235 236 237 238 239 | 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 | - + - + | gzputc(f, s->tag); }; }; t = s; }; spurge; gzclose(f); |
︙ | |||
353 354 355 356 357 358 359 | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | - + - + | texuse[s->utex] = texuse[s->ftex] = texuse[s->ctex] = 1; }; gzclose(f); calclight(); settagareas(); int xs, ys; loopi(256) if (texuse) lookuptexture(i, xs, ys); |
︙ |