Comment: | More style cleanup |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
753ff34122c906fdba43b8c382ac52cc |
User & Date: | js on 2025-03-08 03:05:16 |
Other Links: | manifest | tags |
2025-03-08
| ||
03:26 | Use ObjFW functions for memory management check-in: 71ebb79f8f user: js tags: trunk | |
03:05 | More style cleanup check-in: 753ff34122 user: js tags: trunk | |
02:38 | Improve clang-format check-in: 6f5dd50626 user: js tags: trunk | |
Modified src/.clang-format from [2a796d79cc] to [0d630f9489].
︙ | |||
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 | 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 | + + + | AfterExternBlock: false BeforeCatch: false BeforeElse: false AlwaysBreakAfterReturnType: AllDefinitions AlignAfterOpenBracket: DontAlign AlignEscapedNewlines: Left AlignOperands: DontAlign Cpp11BracedListStyle: false SpaceBeforeCpp11BracedList: true ObjCBlockIndentWidth: 8 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true ObjCPropertyAttributeOrder: [ class, direct, readonly, readwrite, nullable, nonnull, null_resettable, null_unspecified, assign, retain, strong, copy, weak, unsafe_unretained, atomic, nonatomic, getter, setter ] SpaceBeforeInheritanceColon: false QualifierAlignment: Left MaxEmptyLinesToKeep: 1 #RemoveEmptyLinesInUnwrappedLines: true RemoveSemicolon: true CompactNamespaces: true SortIncludes: CaseSensitive IndentPPDirectives: AfterHash PPIndentWidth: 1 |
Modified src/Cube.mm from [00b4da043c] to [b4e9c293d7].
︙ | |||
25 26 27 28 29 30 31 | 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 | - - - - - - - - - + + + + + + + + + + + + | OFString *__autoreleasing master, *__autoreleasing passwd; processInitQueue(); #define log(s) conoutf(@"init: %@", s) log(@"sdl"); |
︙ |
Modified src/client.mm from [89ff04e5c2] to [cdd53f348e].
︙ | |||
86 87 88 89 90 91 92 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + | void connects(OFString *servername) { disconnect(1); // reset state addserver(servername); conoutf(@"attempting to connect to %@", servername); |
︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - + - + - + | disconnect(int onlyclean, int async) { if (clienthost) { if (!connecting && !disconnecting) { enet_peer_disconnect(clienthost->peers); enet_host_flush(clienthost); disconnecting = lastmillis; |
︙ | |||
381 382 383 384 385 386 387 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | - - + + | conoutf(@"attempting to connect..."); connecting = lastmillis; ++connattempts; if (connattempts > 3) { conoutf(@"could not connect to server"); disconnect(); return; |
︙ |
Modified src/clientextras.mm from [0e321e84f3] to [ccc9d61fe8].
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 21 | - - - + + + + | // clientextras.cpp: stuff that didn't fit in client.cpp or clientgame.cpp :) #include "cube.h" // render players & monsters // very messy ad-hoc handling of animation frames, should be made more // configurable // D D D D' D D D D' A A' P P' I I' // R, R' E L J J' |
︙ | |||
33 34 35 36 37 38 39 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - - + + | if (t < 0 || t > 20000) return; if (t > (r - 1) * 100) { n += 4; if (t > (r + 10) * 100) { t -= (r + 10) * 100; mz -= t * t / 10000000000.0f * t; |
︙ |
Modified src/clientgame.mm from [6689f47248] to [1adcd0a4ff].
︙ | |||
66 67 68 69 70 71 72 | 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 | - + - - + + - + - + - + | if (m_noitemsrail) { d->health = 1; d->ammo[GUN_RIFLE] = 100; } else { if (gamemode == 12) { d->gunselect = GUN_FIST; return; |
︙ | |||
140 141 142 143 144 145 146 | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - + | if (d->state != CS_DEAD) { alive++; if (lastteam && strcmp(lastteam, d->team)) oneteam = false; lastteam = d->team; } else { dead++; |
︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | - - + + | conoutf( @"team %s is last man standing", lastteam); else conoutf(@"everyone died!"); arenarespawnwait = lastmillis + 5000; arenadetectwait = lastmillis + 10000; player1->roll = 0; |
︙ | |||
197 198 199 200 201 202 203 | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | - + | { loopv(players) if (players[i]) { const int lagtime = lastmillis - players[i]->lastupdate; if (lagtime > 1000 && players[i]->state == CS_ALIVE) { players[i]->state = CS_LAGGED; continue; |
︙ | |||
269 270 271 272 273 274 275 | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | - + | moveplayer(player1, 10, false); } else if (!m_arena && !m_sp && lastmillis - player1->lastaction > 10000) respawn(); } else if (!intermission) { moveplayer(player1, 20, true); checkitems(); |
︙ | |||
315 316 317 318 319 320 321 | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | - + | d->o.z = ents[spawncycle].z; d->yaw = ents[spawncycle].attr1; d->pitch = 0; d->roll = 0; } else { d->o.x = d->o.y = (float)ssize / 2; d->o.z = 4; |
︙ |
Modified src/clients2c.mm from [15295b6bce] to [e5e63c92dd].
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + - + | const float fx = (float)fabs(dx), fy = (float)fabs(dy), fz = (float)fabs(dz); if (fx < r && fy < r && fz < rz && d->state != CS_DEAD) { if (fx < fy) d->o.y += dy < 0 ? r - fy : -(r - fy); // push aside else d->o.x += dx < 0 ? r - fx : -(r - fx); |
︙ | |||
297 298 299 300 301 302 303 | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | - + | case SV_EDITD: case SV_EDITE: { int x = getint(p); int y = getint(p); int xs = getint(p); int ys = getint(p); int v = getint(p); |
︙ |
Modified src/editing.mm from [f5920b6aeb] to [46292a408f].
︙ | |||
10 11 12 13 14 15 16 | 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 | - - - - - + + + + + - + | // the edge of the map block sel; OF_CONSTRUCTOR() { enqueueInit(^{ |
︙ | |||
114 115 116 117 118 119 120 | 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 | - + - - + + | #define EDITMP \ if (noteditmode() || multiplayer()) \ return; void selectpos(int x, int y, int xs, int ys) { |
︙ | |||
160 161 162 163 164 165 166 | 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 | + - + - - + - + - + - + + - + - + - + | cx = (int)x; cy = (int)y; if (OUTBORD(cx, cy)) return; sqr *s = S(cx, cy); // selected wall |
︙ | |||
312 313 314 315 316 317 318 | 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 | - + - + | if (c >= 0) { uchar *p = hdr.texlists[i]; int t = p[c]; for (int a = c - 1; a >= 0; a--) p[a + 1] = p[a]; p[0] = t; curedittex[i] = -1; |
︙ | |||
386 387 388 389 390 391 392 | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | - + | { EDITSEL; if (type < 0 || type > 3) return; if (type != lasttype) { tofronttex(); lasttype = type; |
︙ | |||
420 421 422 423 424 425 426 | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | - - - + + + | if (s->ctex == rtex.ctex) s->ctex = lasttex; break; case 3: if (s->utex == rtex.utex) s->utex = lasttex; break; |
︙ | |||
522 523 524 525 526 527 528 | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | - + | void archvertex(int span, int vert, int delta) { if (!archvinit) { archvinit = true; loop(s, MAXARCHVERT) loop(v, MAXARCHVERT) archverts[s][v] = 0; |
︙ | |||
583 584 585 586 587 588 589 | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | - + | } VARF( fullbright, 0, 0, 1, if (fullbright) { if (noteditmode()) return; loopi(mipsize) world[i].r = world[i].g = world[i].b = 176; |
︙ |
Modified src/entities.mm from [6e39a8fac1] to [f745b5a428].
1 2 3 4 5 6 7 8 9 | 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 | - - - - - - - - - - + + + + + + + + + + | // entities.cpp: map entity related functions (pickup etc.) #include "cube.h" #import "MapModelInfo.h" vector<entity> ents; static OFString *entmdlnames[] = { |
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | - + | if (e.type < I_SHELLS || e.type > TELEPORT) continue; renderent(e, entmdlnames[e.type - I_SHELLS], (float)(1 + sin(lastmillis / 100.0 + e.x + e.y) / 20), lastmillis / 10.0f); |
︙ | |||
95 96 97 98 99 100 101 | 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 | - - + + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + | (float)e.attr3 * 90, (!e.spawned && !triggertime) ? 30 : 0, (e.spawned || !triggertime) ? 1 : 30, triggertime, 35.0f); break; |
︙ | |||
229 230 231 232 233 234 235 | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - - + + | d->o.z = ents[e].z; d->yaw = ents[e].attr1; d->pitch = 0; d->vel.x = d->vel.y = d->vel.z = 0; entinmap(d); playsoundc(S_TELEPORT); break; |
︙ | |||
290 291 292 293 294 295 296 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - + | case TELEPORT: { static int lastteleport = 0; if (lastmillis - lastteleport < 500) break; lastteleport = lastmillis; teleport(n, d); break; |
︙ |
Modified src/monster.mm from [9d16bae907] to [3ac13a2932].
︙ | |||
27 28 29 30 31 32 33 | 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 | - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + | short gun, speed, health, freq, lag, rate, pain, loyalty, mscale, bscale; short painsound, diesound; OFConstantString *name, *mdlname; } monstertypes[NUMMONSTERTYPES] = { |
︙ | |||
86 87 88 89 90 91 92 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - + - + + | return m; } void spawnmonster() // spawn a random monster according to freq distribution in DMSP { int n = rnd(TOTMFREQ), type; |
︙ | |||
118 119 120 121 122 123 124 | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | - + | ents[i].attr2, ents[i].attr1, M_SLEEP, 100, 0); m->o.x = ents[i].x; m->o.y = ents[i].y; m->o.z = ents[i].z; entinmap(m); monstertotal++; } |
︙ | |||
154 155 156 157 158 159 160 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | - + | break; v.x = x; v.y = y; v.z = rz; x += dx / (float)steps; y += dy / (float)steps; i++; |
︙ | |||
199 200 201 202 203 204 205 | 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 | - + - + - + - + - - - + - + + - - + + - - - + + - - - - + + | void monsteraction( dynent *m) // main AI thinking routine, called every frame for every monster { if (m->enemy->state == CS_DEAD) { m->enemy = player1; m->anger = 0; |
︙ | |||
262 263 264 265 266 267 268 | 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 | - + - + - + | if (disttoenemy < 8 // the better the angle to the player, the // further the monster can see/hear || (disttoenemy < 16 && angle < 135) || (disttoenemy < 32 && angle < 90) || (disttoenemy < 64 && angle < 45) || angle < 10) { transition(m, M_HOME, 1, 500, 200); playsound(S_GRUNT1 + rnd(2), &m->o); |
︙ | |||
301 302 303 304 305 306 307 | 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 | - - - + + + - + + - + - - + - - - + + + - - - + + + + + - - - + + + - - + - | m->attacktarget = target; transition(m, M_AIMING, 0, monstertypes[m->mtype].lag, 10); } else // track player some more { transition(m, M_HOME, 1, monstertypes[m->mtype].rate, 0); |
︙ | |||
364 365 366 367 368 369 370 | 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 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | - + - + + - - - + + + + - - - + + - - - - - - + + + + + + + | monsterthink() { if (m_dmsp && spawnremain && lastmillis > nextmonster) { if (spawnremain-- == monstertotal) conoutf(@"The invasion has begun!"); nextmonster = lastmillis + 1000; spawnmonster(); |
︙ |
Modified src/physics.mm from [5d3f7bf679] to [cbd2b108e1].
︙ | |||
25 26 27 28 29 30 31 | 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 | - + - + | if (fabs(o->o.z - d->o.z) < o->aboveeye + d->eyeheight) return false; if (d->monsterstate) return false; // hack headspace = d->o.z - o->o.z - o->aboveeye - d->eyeheight; if (headspace < 0) headspace = 10; |
︙ | |||
128 129 130 131 132 133 134 | 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 | - + - + - + | 0, x, y, -1, 1, bx, by, bs) && fx1 - bx <= fy2 - by || x == x2 && y == y2 && cornertest(0, x, y, 1, 1, bx, by, bs) && fx2 - bx + fy2 - by >= bs) return false; break; |
︙ | |||
190 191 192 193 194 195 196 | 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 | - + - - + + - + | d->o.z = lo + d->eyeheight; // stick on step else if (space > -1.26f) d->o.z += rise; // rise thru stair else return false; } else { d->o.z -= min(min(drop, space), headspace); // gravity |
︙ | |||
225 226 227 228 229 230 231 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | - + | { if (curtime >= MINFRAMETIME) { int faketime = curtime + physicsfraction; physicsrepeat = faketime / MINFRAMETIME; physicsfraction = faketime - physicsrepeat * MINFRAMETIME; } else { physicsrepeat = 1; |
︙ | |||
248 249 250 251 252 253 254 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | - + | d.y = (float)(pl->move * sin(rad(pl->yaw - 90))); d.z = 0; if (floating || water) { d.x *= (float)cos(rad(pl->pitch)); d.y *= (float)cos(rad(pl->pitch)); d.z = (float)(pl->move * sin(rad(pl->pitch))); |
︙ | |||
283 284 285 286 287 288 289 290 291 292 | 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 382 383 384 385 386 387 388 389 390 391 392 | + + - - + - - - + + + - - + - + + - + - + - + - + - + - + - + - + - + | } } else // apply velocity with collision { if (pl->onfloor || water) { if (pl->jumpnext) { pl->jumpnext = false; pl->vel.z = 1.7f; // physics impulse upwards // dampen velocity change even harder, gives // correct water feel if (water) { pl->vel.x /= 8; pl->vel.y /= 8; |
︙ |
Modified src/rendercubes.mm from [e0804e2cb2] to [50158effb9].
︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + | v.x = v1; \ v.y = v2; \ v.z = v3; \ v.r = ls->r; \ v.g = ls->g; \ v.b = ls->b; \ v.a = 255; \ |
︙ | |||
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 107 108 109 110 | - + - + - + | } #define stripend() \ { \ if (floorstrip || deltastrip) { \ addstrip(ogltex, firstindex, curvert - firstindex); \ floorstrip = deltastrip = false; \ |
︙ | |||
124 125 126 127 128 129 130 | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | - + | floorstrip = true; if (isceil) { vert(x + size, h, y, l2, xo + xs, yo); vert(x, h, y, l1, xo, yo); } else { vert(x, h, y, l1, xo, yo); vert(x + size, h, y, l2, xo + xs, yo); |
︙ | |||
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 188 189 190 191 | - - + + - + - + | ol3r = p3[0]; ol3g = p3[1]; ol3b = p3[2]; uchar *p4 = (uchar *)(&verts[curvert - 2].r); ol4r = p4[0]; ol4g = p4[1]; ol4b = p4[2]; |
︙ | |||
203 204 205 206 207 208 209 | 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 | - + - + - + | deltastrip = true; if (isceil) { vertf((float)x + size, h2, (float)y, l2, xo + xs, yo); vertf((float)x, h1, (float)y, l1, xo, yo); } else { vertf((float)x, h1, (float)y, l1, xo, yo); vertf((float)x + size, h2, (float)y, l2, xo + xs, yo); |
︙ | |||
272 273 274 275 276 277 278 | 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 | - + - + - + | } else { if (h1) render_2tris( h1, s, x, y, x + size, y, x, y + size, s, t, u); if (h2) render_2tris(h2, s, x + size, y, x + size, y + size, x, y + size, t, u, v); |
︙ | |||
371 372 373 374 375 376 377 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | - + - + - + | for (int yy = wy1; yy < wy2; yy += watersubdiv) { float xo = xf * (xx + t2); float yo = yf * (yy + t2); if (yy == wy1) { vertw(xx, hf, yy, &dl, dx(xo), dy(yo), t1); vertw(xx + watersubdiv, hf, yy, &dl, dx(xo + xs), dy(yo), t1); |
︙ | |||
408 409 410 411 412 413 414 | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | - + | wx1 = x; if (y < wy1) wy1 = y; if (x2 > wx2) wx2 = x2; if (y2 > wy2) wy2 = y2; |
Modified src/renderextras.mm from [0c686b4d39] to [f6d88ed878].
︙ | |||
94 95 96 97 98 99 100 | 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 | - + - + | if (!sinit) { loopi(MAXSPHERES) { spheres[i].next = sempty; sempty = &spheres[i]; } sinit = true; |
︙ | |||
135 136 137 138 139 140 141 | 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 | - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + | if (p->size > p->max) { *pp = p->next; p->next = sempty; sempty = p; } else { p->size += time / 100.0f; pp = &p->next; |
︙ | |||
206 207 208 209 210 211 212 | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - - + + | { @autoreleasepool { static OFString *lastsky = @""; if ([lastsky isEqual:basename]) return; |
︙ | |||
332 333 334 335 336 337 338 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | - + | readmatrices(); if (editmode) { if (cursordepth == 1.0f) worldpos = player1->o; glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); cursorupdate(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); |
︙ | |||
438 439 440 441 442 443 444 | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | - + | drawicon( (float)(player1->armourtype * 64), 0, 620, 1650); int g = player1->gunselect; int r = 64; if (g > 2) { g -= 3; r = 128; |
Modified src/rendergl.mm from [5b95ce281e] to [9007a349cc].
︙ | |||
106 107 108 109 110 111 112 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | + + + - - + + + + | SDL_FreeSurface(s); s = converted; } @finally { SDL_FreeFormat(format); } } #if 0 loopi(s->w * s->h * 3) { |
︙ | |||
260 261 262 263 264 265 266 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | - + | if (hasoverbright) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE); glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT); |
︙ | |||
346 347 348 349 350 351 352 | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - - + + | int xtraverts; VAR(fog, 64, 180, 1024); VAR(fogcolour, 0, 0x8099B3, 0xFFFFFF); VARP(hudgun, 0, 1, 1); |
︙ | |||
378 379 380 381 382 383 384 | 383 384 385 386 387 388 389 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 | - + - - - + + + - + | int rtime = reloadtime(player1->gunselect); if (player1->lastaction && player1->lastattackgun == player1->gunselect && lastmillis - player1->lastaction < rtime) { drawhudmodel(7, 18, rtime / 18.0f, player1->lastaction); } else { drawhudmodel(6, 1, 100, 0); |
︙ |
Modified src/renderparticles.mm from [9f00935137] to [b42cd85412].
︙ | |||
21 22 23 24 25 26 27 | 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 | - + - + | if (!parinit) { loopi(MAXPARTICLES) { particles[i].next = parempty; parempty = &particles[i]; } parinit = true; |
︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - - - - - - - - - + + + + + + + + + + | glDisable(GL_FOG); struct parttype { float r, g, b; int gr, tex; float sz; } parttypes[] = { |
︙ |
Modified src/rendertext.mm from [c20068be3f] to [d117eaf6b5].
1 2 3 4 5 | 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 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 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | // rendertext.cpp: based on Don's gl_text.cpp #include "cube.h" short char_coords[96][4] = { |
︙ |
Modified src/rndmap.mm from [db18b3b402] to [3e8d55fcae].
︙ | |||
69 70 71 72 73 74 75 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - + - + + | void perlinarea(block &b, int scale, int seed, int psize) { srand(seed); seed = rnd(10000); if (!scale) scale = 10; |
Modified src/savegamedemo.mm from [d7af13e4bd] to [518f13ae58].
︙ | |||
67 68 69 70 71 72 73 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + | void stop() { if (f) { if (demorecording) gzputi(-1); gzclose(f); |
︙ |
Modified src/server.mm from [2b7d5c9bfe] to [8f47418a23].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - + - + | }; vector<client> clients; int maxclients = 8; static OFString *smapname; |
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | - + - + | if (!packet) return; switch (clients[n].type) { case ST_TCPIP: { enet_peer_send(clients[n].peer, 0, packet); bsend += packet->dataLength; break; |
︙ | |||
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | - + | { if (i >= (uint)sents.length()) return; if (sents[i].spawned) { sents[i].spawned = false; sents[i].spawnsecs = sec; send2(true, sender, SV_ITEMACC, i); |
︙ | |||
186 187 188 189 190 191 192 | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | - + | void process(ENetPacket *packet, int sender) // sender may be -1 { if (ENET_NET_TO_HOST_16(*(ushort *)packet->data) != packet->dataLength) { disconnect_client(sender, "packet length"); return; |
︙ | |||
231 232 233 234 235 236 237 | 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 | - + - + - + | break; } case SV_ITEMLIST: { int n; while ((n = getint(p)) != -1) if (notgotitems) { |
︙ | |||
282 283 284 285 286 287 288 | 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 | - + - + - - + + - + | case SV_EXT: // allows for new features that require no server // updates { for (int n = getint(p); n; n--) getint(p); break; |
︙ | |||
361 362 363 364 365 366 367 | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | - + | void checkintermission() { if (!minremain) { interm = lastsec + 10; mapend = lastsec + 1000; |
︙ | |||
402 403 404 405 406 407 408 | 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 | - + - + | loopv(sents) // spawn entities when timer reached { if (sents[i].spawnsecs && (sents[i].spawnsecs -= seconds - lastsec) <= 0) { sents[i].spawnsecs = 0; sents[i].spawned = true; send2(true, -1, SV_ITEMSPAWN, i); |
︙ | |||
444 445 446 447 448 449 450 | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | - + | laststatus = seconds; if (nonlocalclients || bsend || brec) printf("status: %d remote clients, %.1f send, %.1f rec " "(K/sec)\n", nonlocalclients, bsend / 60.0f / 1024, brec / 60.0f / 1024); bsend = brec = 0; |
︙ | |||
480 481 482 483 484 485 486 | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | - - - + + + - - + | break; printf("disconnected client (%s)\n", clients[(intptr_t)event.peer->data].hostname); clients[(intptr_t)event.peer->data].type = ST_EMPTY; send2(true, -1, SV_CDIS, (intptr_t)event.peer->data); event.peer->data = (void *)-1; break; |
︙ | |||
524 525 526 527 528 529 530 | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | - + - + - + - - + + | { serverpassword = passwd; maxclients = maxcl; servermsinit(master ? master : @"wouter.fov120.com/cube/masterserver/", sdesc, dedicated); if (isdedicated = dedicated) { |
Modified src/serverbrowser.mm from [4bf1a6646d] to [7dc044a533].
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - + - + | if (resolverqueries.empty()) { SDL_UnlockMutex(resolvermutex); continue; } rt->query = resolverqueries.pop(); rt->starttime = lastmillis; SDL_UnlockMutex(resolvermutex); |
︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - - + + | resolverthread &rt = resolverthreads[i]; if (rt.query) { if (lastmillis - rt.starttime > resolverlimit) { resolverstop(rt, true); *name = rt.query; SDL_UnlockMutex(resolvermutex); return true; |
︙ | |||
195 196 197 198 199 200 201 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | - + | lastinfo = lastmillis; } void checkresolver() { char *name = NULL; |
︙ | |||
301 302 303 304 305 306 307 | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | - + | void servermenu() { if (pingsock == ENET_SOCKET_NULL) { pingsock = enet_socket_create(ENET_SOCKET_TYPE_DATAGRAM, NULL); resolverinit(1, 1000); |
︙ |
Modified src/serverms.mm from [21c02ed323] to [1d1c1a8ddd].
︙ | |||
42 43 44 45 46 47 48 | 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 | - + - + - + - - + - + - + | enet_uint32 events = ENET_SOCKET_WAIT_RECEIVE; if (enet_socket_wait(mssock, &events, 0) >= 0 && events) { int len = enet_socket_receive(mssock, NULL, &buf, 1); if (len <= 0) { enet_socket_destroy(mssock); mssock = ENET_SOCKET_NULL; return; |
︙ | |||
155 156 157 158 159 160 161 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | - - + + | if (!mid) mid = master; strcpy_s(masterpath, mid); strn0cpy(masterbase, master, mid - master + 1); serverdesc = sdesc; if (listen) { |
Modified src/serverutil.mm from [9a3fdd3f13] to [34361918f4].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + | *p++ = n >> 8; } else { *p++ = 0x81; *p++ = n; *p++ = n >> 8; *p++ = n >> 16; *p++ = n >> 24; |
︙ | |||
50 51 52 53 54 55 56 | 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 | - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + - - - - - - - - + + + + + + + + | while (*t) putint(p, *t++); putint(p, 0); } } static const OFString *modenames[] = { |
︙ | |||
183 184 185 186 187 188 189 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | - - + + | passwd = a; break; case 'c': maxcl = atoi(a); break; default: printf("WARNING: unknown commandline option\n"); |
Modified src/sound.mm from [af1eb7e101] to [7dfddc04de].
︙ | |||
41 42 43 44 45 46 47 | 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 | - + - + - + | #ifdef USE_MIXER Mix_HaltMusic(); Mix_FreeMusic(mod); #else FMUSIC_FreeSong(mod); #endif mod = NULL; |
︙ | |||
178 179 180 181 182 183 184 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - - + + | float yaw = -atan2(v.x, v.y) - player1->yaw * (PI / 180.0f); // relative angle of // sound along X-Y axis pan = int(255.9f * (0.5 * sin(yaw) + 0.5f)); // range is from 0 (left) // to 255 (right) |
︙ |
Modified src/weapon.mm from [93de7b2cbf] to [a095df6286].
︙ | |||
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 | - - - - - - - - - + + + + + + + + + | static const int MONSTERDAMAGEFACTOR = 4; static const int SGRAYS = 20; static const float SGSPREAD = 2; static OFVector3D sg[SGRAYS]; static const guninfo guns[NUMGUNS] = { |
︙ | |||
169 170 171 172 173 174 175 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | - + | if (d == player1) selfdamage(damage, at == player1 ? -1 : -2, at); else if (d->monsterstate) monsterpain(d, damage, at); else { addmsg(1, 4, SV_DAMAGE, target, damage, d->lifesequence); playsound(S_PAIN1 + rnd(5), &d->o); |
︙ |
Modified src/world.mm from [50f4e28f8c] to [e205b06d1f].
︙ | |||
21 22 23 24 25 26 27 | 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 | - + - - - + + + | if (tag) { if (tag == s->tag) s->type = SPACE; else continue; } else { s->type = type ? SOLID : SPACE; |
︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | - + - + | sqr *v = wmip[level + 1]; int ws = ssize >> level; int vs = ssize >> (level + 1); block s = b; if (s.x & 1) { s.x--; s.xs++; |
︙ | |||
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 158 159 160 161 162 163 164 165 166 167 | - + - + | ch += o[i]->vdelta / 4 + 2; // FIXME: needs // to somehow // take into // account middle // vertices on // higher mips |
︙ | |||
214 215 216 217 218 219 220 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | - - + + - - + + - + | SWS(w, x + 2, y + 1, ws) ->vdelta || o[1]->vdelta - o[2]->vdelta != o[2]->vdelta - SWS(w, x + 1, y + 2, ws) ->vdelta) goto c; |
︙ | |||
263 264 265 266 267 268 269 | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - + | if (e.type == NOTUSED) continue; OFVector3D v = OFMakeVector3D(e.x, e.y, e.z); vdist(dist, t, player1->o, v); if (dist < bdist) { best = i; bdist = dist; |
︙ | |||
287 288 289 290 291 292 293 | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | - + | break; case 2: ents[e].attr3 += amount; break; case 3: ents[e].attr4 += amount; break; |
︙ | |||
322 323 324 325 326 327 328 | 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 | - - + + - + | } } entity * newentity(int x, int y, int z, OFString *what, int v1, int v2, int v3, int v4) { int type = findtype(what); |
︙ | |||
395 396 397 398 399 400 401 | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | - + | e.attr1 = 2; if (e.attr1 > 32) e.attr1 = 32; if (intens) { scalecomp(e.attr2, intens); scalecomp(e.attr3, intens); scalecomp(e.attr4, intens); |
︙ | |||
441 442 443 444 445 446 447 | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | - + | cleardlights(); pruneundos(); sqr *oldworld = world; bool copy = false; if (oldworld && factor < 0) { factor = sfactor + 1; copy = true; |
︙ | |||
484 485 486 487 488 489 490 | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | - + | } } else { strn0cpy(hdr.maptitle, "Untitled Map by Unknown", 128); hdr.waterlevel = -100000; loopi(15) hdr.reserved[i] = 0; loopk(3) loopi(256) hdr.texlists[k][i] = i; ents.setsize(0); |
︙ |
Modified src/worldlight.mm from [3bb65afc34] to [2af1475366].
︙ | |||
95 96 97 98 99 100 101 | 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 | - + - + - + - + | if (SOLID(s)) return; x += stepx; y += stepy; l -= stepl; stepl -= 25; } |
︙ | |||
176 177 178 179 180 181 182 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | - + | loopv(ents) { entity &e = ents[i]; if (e.type == LIGHT) calclightsource(e); } |
︙ | |||
209 210 211 212 213 214 215 | 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 | - - + + - - + + | reach = reach / 2; if (!reach) return; if (v.x < 0 || v.y < 0 || v.x > ssize || v.y > ssize) return; int creach = reach + 16; // dependant on lightray random offsets! |
︙ |
Modified src/worldocull.mm from [7b61604ca1] to [fabee6f557].
︙ | |||
53 54 55 56 57 58 59 | 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 | - + - - - - + + - + - - - + + + - | dy = -(ray - 4); } else if (ray >= 5 && ray < 7) { dx = ray - 6; dy = -1; } else { dx = 1; dy = ray > 4 ? ray - 8 : ray; |
︙ | |||
148 149 150 151 152 153 154 | 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 | - - + + - - + - + - + - + - + - - - + + + - + | 4; l = ma(-(cx + csize - vx), -(cy - vy)) + 4; } // D } else { h = ca(cy + csize - vy, -(cx + csize - vx)) + 2; l = ca(cy - vy, -(cx - vx)) + 2; |
Modified src/worldrender.mm from [5690f47554] to [b1342f3226].
︙ | |||
10 11 12 13 14 15 16 | 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 | - + - + - + - + - + | { if (SOLID(o) || o->type == SEMISOLID) { float c1 = s->floor; float c2 = s->floor; if (s->type == FHF) { c1 -= d1->vdelta / 4.0f; c2 -= d2->vdelta / 4.0f; |
︙ | |||
90 91 92 93 94 95 96 | 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 | - + - + | if (issemi(mip, x + x1, y + y1, x1, y1, x2, y2)) return true; case CORNER: case SOLID: break; default: return true; |
︙ | |||
127 128 129 130 131 132 133 | 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 | - + - - + - + - + + - + | vxx - lodleft; // these mark the rect inside the current rest that // we want to render using a lower mip level int ly = vyy - lodtop; int rx = vxx + lodright; int ry = vyy + lodbot; float fsize = (float)(1 << mip); |
︙ | |||
191 192 193 194 195 196 197 | 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 | - - + - - + | render_flat(s->ctex, xx << mip, yy << mip, 1 << mip, s->ceil, s, t, u, v, true); if (s->type == CHF) // if(s->ceil>=vh) render_flatdelta(s->ctex, xx << mip, yy << mip, 1 << mip, dc(s), dc(t), dc(u), dc(v), s, t, u, v, true); } } |
︙ | |||
234 235 236 237 238 239 240 | 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 | - + - + - + - - - + + + | if (SOLID(w)) { render_wall(w, h2 = s, xx + 1, yy, xx, yy + 1, mip, t, v, false); topleft = false; } else if (SOLID(v)) { render_wall(v, h2 = s, xx, yy, xx + 1, yy + 1, mip, s, u, false); |
︙ | |||
290 291 292 293 294 295 296 | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | - - - + | (!SOLID(s) || w->type != CORNER) && (w->type != SEMISOLID || issemi(mip, xx, yy - 1, 0, 1, 1, 1))) render_wall(s, w, xx, yy, xx + 1, yy, mip, s, t, false); if (yy <= vyy && inner && !SOLID(v) && (!SOLID(s) || v->type != CORNER) && (v->type != SEMISOLID || issemi(mip, xx, yy + 1, 0, 0, 1, 0))) render_wall(s, v, xx, yy + 1, xx + 1, yy + 1, mip, v, u, true); |
︙ | |||
321 322 323 324 325 326 327 | 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 | - + - - + + + - - + - - + - + | float vx, float vy, float vh, int yaw, int pitch, float fov, int w, int h) { loopi(LARGEST_FACTOR) stats[i] = 0; min_lod = MIN_LOD + abs(pitch) / 12; yaw = 360 - yaw; float widef = fov / 75.0f; int cdist = abs(yaw % 90 - 45); |