Comment: | Clean up DynamicEntity |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b787ad5a04fc238a69b9e48b3bdfccde |
User & Date: | js on 2025-03-22 23:10:13 |
Other Links: | manifest | tags |
2025-03-23
| ||
02:03 | Convert monster into a class check-in: e8f80b0482 user: js tags: trunk | |
2025-03-22
| ||
23:10 | Clean up DynamicEntity check-in: b787ad5a04 user: js tags: trunk | |
21:29 | Use OFColor instead of abusing OFVector3D check-in: e258bfb559 user: js tags: trunk | |
Modified src/Cube.m from [6edead03c0] to [5126c37a7e].
︙ | |||
228 229 230 231 232 233 234 | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | - + | if (!demoplayback) serverslice((int)time(NULL), 0); static float fps = 30.0f; fps = (1000.0f / curtime + fps * 50) / 51; |
︙ |
Modified src/DynamicEntity.h from [0a25294c06] to [52cd3f4f7c].
1 2 3 4 5 6 | 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 | - - + - + - - - + + + - + - - + + - + - - - + + + - - - + + + - + - + + + + + | #import <ObjFW/ObjFW.h> // players & monsters @interface DynamicEntity: OFObject <OFCopying> @property (class, readonly, nonatomic) size_t serializedSize; |
Modified src/DynamicEntity.m from [ace0df653e] to [1744394702].
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 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 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 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 | - + - - - - + + + + - - - - + + + + - - - + + + - - + + - + - + + + + + + + + + + + + + + + + + - - + + - - - - - + + + + + - + - - - - + + + + - + - - - - - - - + + + + + + + - - + + - + - + - - + + - - - - - + + + + + - + - - - - + + + + - + - - - - - - - + + + + + + + - - - + + + - + - - + + - - - - - + + + + + - + - - - - + + + + - + - - - - - - - + + + + + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #import "DynamicEntity.h" #include "cube.h" struct dynent { |
Modified src/clientextras.m from [ff738c9cd3] to [ab4fb7df43].
︙ | |||
17 18 19 20 21 22 23 | 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 | - + - - + + - + - + - + - + - + - + - - + + | void renderclient( DynamicEntity *d, bool team, OFString *mdlname, bool hellpig, float scale) { int n = 3; float speed = 100.0f; |
︙ | |||
103 104 105 106 107 108 109 | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - + | } static OFMutableArray<OFString *> *scoreLines; void renderscore(DynamicEntity *d) { |
︙ |
Modified src/clientgame.m from [ca9306999a] to [f7cff8c331].
︙ | |||
20 21 22 23 24 25 26 | 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 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | DynamicEntity *player1; // our client OFMutableArray *players; // other clients void initPlayers() { |
︙ | |||
199 200 201 202 203 204 205 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | - + | void otherplayers() { [players enumerateObjectsUsingBlock:^(id player, size_t i, bool *stop) { if (player == [OFNull null]) return; |
︙ | |||
267 268 269 270 271 272 273 | 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 | - + - + - - + + - + - - + + - + + - + - + - + | // when our player moves gets2c(); } otherplayers(); if (!demoplayback) { monsterthink(); if (player1.state == CS_DEAD) { |
︙ | |||
354 355 356 357 358 359 360 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + | else if ((player1.attacking = on)) respawn(); } void jumpn(bool on) { |
︙ | |||
402 403 404 405 406 407 408 | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | - + | selfdamage(int damage, int actor, DynamicEntity *act) { if (player1.state != CS_ALIVE || editmode || intermission) return; damageblend(damage); demoblend(damage); // let armour absorb when possible |
︙ | |||
436 437 438 439 440 441 442 | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | - + - - + + | else conoutf( @"you got fragged by %@", a.name); } } showscores(true); addmsg(1, 2, SV_DIED, actor); |
︙ | |||
469 470 471 472 473 474 475 476 477 | 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 | + - - + + + + + + + + | DynamicEntity * getclient(int cn) // ensure valid entity { if (cn < 0 || cn >= MAXCLIENTS) { neterr(@"clientnum"); return nil; } while (cn >= players.count) [players addObject:[OFNull null]]; |
︙ |
Modified src/clients.m from [edb3579f73] to [90d8557e37].
︙ | |||
138 139 140 141 142 143 144 | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - + | conoutf(@"disconnected"); clienthost = NULL; connecting = 0; connattempts = 0; disconnecting = 0; clientnum = -1; c2sinit = false; |
︙ | |||
296 297 298 299 300 301 302 | 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 | - - - + + + - - - - + + + + - + | toservermap = @""; putint(&p, nextmode); } else { putint(&p, SV_POS); putint(&p, clientnum); // quantize coordinates to 1/16th of a cube, between 1 and 3 // bytes |
︙ | |||
335 336 337 338 339 340 341 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | - + | // tell other clients who I am if (!c2sinit) { packet->flags = ENET_PACKET_FLAG_RELIABLE; c2sinit = true; putint(&p, SV_INITC2S); sendstring(player1.name, &p); sendstring(player1.team, &p); |
︙ |
Modified src/clients2c.m from [e43832fc31] to [8bc911d5e6].
︙ | |||
34 35 36 37 38 39 40 | 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 | - - - - + + + + + - - + + + - - + + - - + - - + + | // don't care if he's in the scenery or other players, // just don't overlap with our client void updatepos(DynamicEntity *d) { const float r = player1.radius + d.radius; |
︙ | |||
114 115 116 117 118 119 120 | 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 | - + - + - + - + - + | d = getclient(cn); if (d == nil) return; OFVector3D tmp; tmp.x = getint(&p) / DMF; tmp.y = getint(&p) / DMF; tmp.z = getint(&p) / DMF; |
︙ | |||
193 194 195 196 197 198 199 | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | - + | // send new players my info again c2sinit = false; conoutf(@"connected: %s", text); } d.name = @(text); sgetstr(); d.team = @(text); |
︙ | |||
226 227 228 229 230 231 232 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | - + - + | } case SV_DAMAGE: { int target = getint(&p); int damage = getint(&p); int ls = getint(&p); if (target == clientnum) { |
︙ | |||
263 264 265 266 267 268 269 | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + - + | @"teammate (%@)", a.name, d.name); else conoutf(@"%@ fragged %@", a.name, d.name); } } |
︙ |
Modified src/cube.h from [3a60f1d5c8] to [d202a9fdbd].
︙ | |||
277 278 279 280 281 282 283 | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - + - - - - - - - + - - - - - - - + - - - - - - + - - - - - | #define PIXELTAB (VIRTW / 12) #define PI (3.1415927f) #define PI2 (2 * PI) // simplistic vector ops #define dotprod(u, v) ((u).x * (v).x + (u).y * (v).y + (u).z * (v).z) |
︙ |
Modified src/editing.m from [72ec7780d9] to [d8eb643406].
︙ | |||
165 166 167 168 169 170 171 | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - - + + + | if (OUTBORD(cx, cy)) return; struct sqr *s = S(cx, cy); // selected wall if (fabs(sheight(s, s, z) - z) > 1) { |
︙ | |||
618 619 620 621 622 623 624 | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | - + | loopselxy(s->tag = tag); } void newent(OFString *what, OFString *a1, OFString *a2, OFString *a3, OFString *a4) { EDITSEL; |
︙ |
Modified src/entities.m from [415631efe6] to [a819c302d8].
︙ | |||
167 168 169 170 171 172 173 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | - + - + - + | break; case I_BOOST: d.health = radditem(n, d.health); break; case I_GREENARMOUR: d.armour = radditem(n, d.armour); |
︙ | |||
210 211 212 213 214 215 216 | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | + - + - + | if (e == beenhere || e < 0) { conoutf(@"no teleport destination for tag %d", tag); return; } if (beenhere < 0) beenhere = e; if (ents[e].attr2 == tag) { d.origin = |
︙ | |||
253 254 255 256 257 258 259 | 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 | - + - + | break; case I_BOOST: additem(n, d.health, 60); break; case I_GREENARMOUR: // (100h/100g only absorbs 166 damage) |
︙ | |||
289 290 291 292 293 294 295 | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | + - - + + | case JUMPPAD: { static int lastjumppad = 0; if (lastmillis - lastjumppad < 300) break; lastjumppad = lastmillis; OFVector3D v = OFMakeVector3D((int)(char)ents[n].attr3 / 10.0f, (int)(char)ents[n].attr2 / 10.0f, ents[n].attr1 / 10.0f); player1.velocity = |
︙ | |||
314 315 316 317 318 319 320 | 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 | - - + + - - + + | if (!e.spawned && e.type != TELEPORT && e.type != JUMPPAD) return; if (OUTBORD(e.x, e.y)) return; OFVector3D v = OFMakeVector3D( |
︙ |
Modified src/menus.m from [bd623c6a87] to [9e1b20764c].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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 | + + - + | // menus.cpp: ingame menu system (also used for scores and serverlist) #include "cube.h" #import "Menu.h" #import "DynamicEntity.h" #import "MenuItem.h" static OFMutableArray<OFNumber *> *menuStack; static OFMutableArray<Menu *> *menus; static int vmenu = -1; void menuset(int menu) { if ((vmenu = menu) >= 1) |
︙ |
Modified src/monster.m from [c3b07dd60c] to [8b5a6bb4d3].
︙ | |||
58 59 60 61 62 63 64 | 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 | - - - - + + + + - - - + + + - + - - + + | DynamicEntity * basicmonster(int type, int yaw, int state, int trigger, int move) { if (type >= NUMMONSTERTYPES) { conoutf(@"warning: unknown monster in spawn: %d", type); type = 0; } |
︙ | |||
125 126 127 128 129 130 131 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | - + | for (Entity *e in ents) { if (e.type != MONSTER) continue; DynamicEntity *m = basicmonster(e.attr2, e.attr1, M_SLEEP, 100, 0); |
︙ | |||
172 173 174 175 176 177 178 | 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 | - - - + + + - + | } return i >= steps; } bool enemylos(DynamicEntity *m, OFVector3D *v) { |
︙ | |||
211 212 213 214 215 216 217 | 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 | - + - + - - + + - - + + - - + + - - + + - + - + - - + + + - + - - + + - + - + - - + + - + - + - + + - + + - + + - - + + - + - + - - + + - - + + | void monsteraction(DynamicEntity *m) { if (m.enemy.state == CS_DEAD) { m.enemy = player1; m.anger = 0; } |
︙ | |||
389 390 391 392 393 394 395 | 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 | - + - - - + + + - - + + + | if (OUTBORD(e.x, e.y)) return; OFVector3D v = OFMakeVector3D(e.x, e.y, (float)S(e.x, e.y)->floor); for (DynamicEntity *monster in monsters) { if (monster.state == CS_DEAD) { |
Modified src/physics.m from [25a7c9cd46] to [bb6edf173a].
︙ | |||
13 14 15 16 17 18 19 20 | 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 | + - - - - - - + + + + + + + - + - + + - + + | // collide with player or monster static bool plcollide( DynamicEntity *d, DynamicEntity *o, float *headspace, float *hi, float *lo) { if (o.state != CS_ALIVE) return true; const float r = o.radius + d.radius; |
︙ | |||
65 66 67 68 69 70 71 | 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 | - + - + - - - - + + + + - - + + - + | continue; MapModelInfo *mmi = getmminfo(e.attr2); if (mmi == nil || !mmi.h) continue; const float r = mmi.rad + d.radius; |
︙ | |||
156 157 158 159 160 161 162 | 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 | - - + + + + + - + + + - - + + - + - - + + - - + + + - - + + - + - + + + - + - + + | if (ceil < hi) hi = ceil; if (floor > lo) lo = floor; if (floor < minfloor) return false; } |
︙ | |||
247 248 249 250 251 252 253 | 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 382 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 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | - + - + - + - - - - + + + + - - - - + + + + + - - - + + + - - + + - - + + + - - + + - + - - + + + - + - + - + - + - - + + + + - + + - - + + + + - + - + + + - - + + + - - - - + + + + + + - - + + - - - + + + - + | // main physics routine, moves a player/monster for a curtime step // moveres indicated the physics precision (which is lower for monsters and // multiplayer prediction) local is false for multiplayer prediction static void moveplayer4(DynamicEntity *pl, int moveres, bool local, int curtime) { |
Modified src/protos.h from [b7d19818d1] to [1cd5f32081].
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | - - | extern void mousemove(int dx, int dy); extern void updateworld(int millis); extern void startmap(OFString *name); extern void changemap(OFString *name); extern void initclient(); extern void spawnplayer(DynamicEntity *d); extern void selfdamage(int damage, int actor, DynamicEntity *act); |
︙ |
Modified src/renderextras.m from [5de4da4840] to [81b3ccc9f0].
︙ | |||
331 332 333 334 335 336 337 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - + | void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater) { readmatrices(); if (editmode) { if (cursordepth == 1.0f) |
︙ | |||
381 382 383 384 385 386 387 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | - + | renderscores(); if (!rendermenu()) { glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, 1); glBegin(GL_QUADS); glColor3ub(255, 255, 255); if (crosshairfx) { |
︙ | |||
424 425 426 427 428 429 430 | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | - + - - + + | if (player1.state == CS_ALIVE) { glPushMatrix(); glOrtho(0, VIRTW / 2, VIRTH / 2, 0, -1, 1); draw_textf(@"%d", 90, 827, 2, player1.health); if (player1.armour) draw_textf(@"%d", 390, 827, 2, player1.armour); |
︙ |
Modified src/rendergl.m from [2d15d16f3c] to [09aa28380f].
︙ | |||
346 347 348 349 350 351 352 | 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 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 458 459 460 461 | - - - - + + + + - - + + + - + - - - - + + + + - + - + - - + + | { glLoadIdentity(); glRotated(player1.roll, 0.0, 0.0, 1.0); glRotated(player1.pitch, -1.0, 0.0, 0.0); glRotated(player1.yaw, 0.0, 1.0, 0.0); |
︙ |
Modified src/rendermd2.m from [820ea372aa] to [3f3cf16cef].
︙ | |||
89 90 91 92 93 94 95 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + | 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, int basetime) { MD2 *m = loadmodel(mdl); |
︙ |
Modified src/renderparticles.m from [f527e01774] to [63da7f6939].
︙ | |||
53 54 55 56 57 58 59 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - + | up = *u; } void render_particles(int time) { if (demoplayback && demotracking) { |
︙ |
Modified src/savegamedemo.m from [e77568d32b] to [3f6725d365].
︙ | |||
220 221 222 223 224 225 226 | 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 | - + - + - + | restoreserverstate(ents); OFMutableData *data = [OFMutableData dataWithCapacity:DynamicEntity.serializedSize]; [data increaseCountBy:DynamicEntity.serializedSize]; gzread(f, data.mutableItems, data.count); [player1 setFromSerializedData:data]; |
︙ | |||
309 310 311 312 313 314 315 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | - - - - + + + + - + | if (!demorecording) return; gzputi(lastmillis - starttime); gzputi(len); gzwrite(f, buf, len); gzput(extras); if (extras) { |
︙ | |||
436 437 438 439 440 441 442 | 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 519 520 521 522 | - - - - + + + + - + - + - + - + - + - - + + - + - - + + | DynamicEntity *target = players[democlientnum]; assert(target); int extras; // read additional client side state not present in normal // network stream if ((extras = gzget())) { |
︙ |
Modified src/sound.m from [fab11a9b01] to [8879a01acd].
︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + | VAR(stereo, 0, 1, 1); static void updatechanvol(int chan, const OFVector3D *loc) { int vol = soundvol, pan = 255 / 2; if (loc) { |
︙ |
Modified src/weapon.m from [81ddf6dcb5] to [af10bcd44b].
︙ | |||
28 29 30 31 32 33 34 | 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 | - + - + - + | void selectgun(int a, int b, int c) { if (a < -1 || b < -1 || c < -1 || a >= NUMGUNS || b >= NUMGUNS || c >= NUMGUNS) return; |
︙ | |||
85 86 87 88 89 90 91 | 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 | - + - - - + + + + - + | } } // if lineseg hits entity bounding box static bool intersect(DynamicEntity *d, const OFVector3D *from, const OFVector3D *to) { |
︙ | |||
165 166 167 168 169 170 171 | 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 | - + - + - + - + - + | return; } } void hit(int target, int damage, DynamicEntity *d, DynamicEntity *at) { |
︙ | |||
261 262 263 264 265 266 267 | 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 | - - + + - + | { for (size_t i = 0; i < MAXPROJ; i++) { Projectile *p = projs[i]; if (!p.inuse) continue; |
︙ | |||
308 309 310 311 312 313 314 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - + | } // create visual effect from a shot void shootv(int gun, const OFVector3D *from, const OFVector3D *to, DynamicEntity *d, bool local) { |
︙ | |||
330 331 332 333 334 335 336 | 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 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 | - + - + - - + + - + - + - - + + - + - - - + + + - - + + - - - + + + - - + + - + - + - + - + - - - + + + - + - + - + | break; case GUN_RL: case GUN_FIREBALL: case GUN_ICEBALL: case GUN_SLIMEBALL: pspeed = guns[gun].projspeed; |
Modified src/world.m from [16c30b946f] to [023ca9b6df].
︙ | |||
266 267 268 269 270 271 272 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + | __block int best; __block float bdist = 99999; [ents enumerateObjectsUsingBlock:^(Entity *e, size_t i, bool *stop) { if (e.type == NOTUSED) return; OFVector3D v = OFMakeVector3D(e.x, e.y, e.z); |
︙ |
Modified src/worldlight.m from [feb6b04e94] to [d596ebb5c3].
︙ | |||
201 202 203 204 205 206 207 | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - + | void dodynlight(const OFVector3D *vold, const OFVector3D *v, int reach, int strength, DynamicEntity *owner) { if (!reach) reach = dynlight; |
︙ |
Modified src/worldrender.m from [6775552eda] to [37acc1d08b].
︙ | |||
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | - + | int ry = vyy + lodbot; float fsize = (float)(1 << mip); for (int ox = x; ox < xs; ox++) { // first collect occlusion information for this block for (int oy = y; oy < ys; oy++) { SWS(w, ox, oy, sz)->occluded = |
︙ |