Overview
Comment: | Implement the "chain" instruction |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
83764e9bf8d152c8ff740a5b4a989484 |
User & Date: | user on 2021-03-11 07:38:47 |
Other Links: | manifest | tags |
Context
2021-03-18
| ||
21:20 | For key dispatch, return the Arg2 value if no block is found. check-in: decc02f01b user: user tags: trunk | |
2021-03-11
| ||
07:38 | Implement the "chain" instruction check-in: 83764e9bf8 user: user tags: trunk | |
05:38 | Implement importing levels check-in: 04cceae6dc user: user tags: trunk | |
Changes
Modified class.doc from [10812d8f88] to [115e6950b7].
︙ | |||
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | + + + + + + + + + | bxor ( in1 in2 -- out ) Bitwise XOR. c? ( any -- bool ) True if the value is a class, or false if it is any other type. Error if it is a sound. chain ( any -- bool ) If given an object of the same class as the current object, selects that object as the current object and continues executing the code with that object instead. This new current object is not saved if you return from a function or a subroutine call. If it successfully chained, then the result is false. If given an object of a different class, an object that doesn't exist, or anything other than an object, then it does nothing and the result is true. Create ( class x y image dir -- obj ) ** Creates a new object at the specified location, and returns it. The result is zero if the class is zero, the coordinates are out of range, the object cannot be created due to the CollisionLayers, or if the new object is destroyed before its CREATE message returns. cz? ( any -- bool ) |
︙ |
Modified exec.c from [7f9f58fd2f] to [c94459c1c8].
︙ | |||
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 | + + + + + + + + | Value v; while(vstackptr-- && vstack[vstackptr].t!=TY_MARK); if(!vstackptr) Throw("No mark"); v=Pop(); while(--p>vstackptr) if(v_equal(v,vstack[p])) return 1; return 0; } static Uint32 v_chain(Value v,Uint16 c) { if(v.t==TY_SOUND || v.t==TY_USOUND) Throw("Cannot convert sound to object"); if(v.t<=TY_MAXTYPE) return VOIDLINK; if(v.u>=nobjects || !objects[v.u] || objects[v.u]->generation!=v.t) return VOIDLINK; if(objects[v.u]->class!=c) return VOIDLINK; return v.u; } // Here is where the execution of a Free Hero Mesh bytecode subroutine is executed. #define NoIgnore() do{ changed=1; }while(0) #define GetVariableOf(a,b) (i=v_object(Pop()),i==VOIDLINK?NVALUE(0):b(objects[i]->a)) #define GetVariableOrAttributeOf(a,b) (t2=Pop(),t2.t==TY_CLASS?NVALUE(classes[t2.u]->a):(i=v_object(t2),i==VOIDLINK?NVALUE(0):b(objects[i]->a))) #define Numeric(a) do{ if((a).t!=TY_NUMBER) Throw("Type mismatch"); }while(0) #define DivideBy(a) do{ Numeric(a); if(!(a).u) Throw("Division by zero"); }while(0) |
︙ | |||
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 | + | case OP_BROADCASTSUMEX: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,t5,1)); break; case OP_BUSY: StackReq(0,1); if(o->oflags&OF_BUSY) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_BUSY_C: StackReq(1,1); GetFlagOf(OF_BUSY); break; case OP_BUSY_E: NoIgnore(); StackReq(1,0); if(v_bool(Pop())) o->oflags|=OF_BUSY; else o->oflags&=~OF_BUSY; break; case OP_BUSY_EC: NoIgnore(); StackReq(2,0); SetFlagOf(OF_BUSY); break; case OP_BXOR: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u^t2.u)); break; case OP_CALLSUB: execute_program(code,code[ptr++],obj); break; case OP_CHAIN: StackReq(1,1); t1=Pop(); i=v_chain(t1,o->class); if(i==VOIDLINK) { Push(NVALUE(1)); } else { o=objects[obj=i]; Push(NVALUE(0)); } break; case OP_CLASS: StackReq(0,1); Push(CVALUE(o->class)); break; case OP_CLASS_C: StackReq(1,1); Push(GetVariableOf(class,CVALUE)); break; case OP_CLIMB: StackReq(0,1); Push(NVALUE(o->climb)); break; case OP_CLIMB_C: StackReq(1,1); Push(GetVariableOrAttributeOf(climb,NVALUE)); break; case OP_CLIMB_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->climb=t1.u; break; case OP_CLIMB_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->climb=t1.u&0xFFFF; break; case OP_CLIMB_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) o->climb=t1.u; break; |
︙ |
Modified instruc from [6d40f85d50] to [e8dca82c5d].
︙ | |||
203 204 205 206 207 208 209 210 211 212 213 214 215 216 | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | + | Animate ,Assassinate ; destroy without sending any messages .Broadcast *BroadcastClass ; for (Broadcast [class]) .BroadcastEx ; broadcast with three arguments BroadcastSum ; Broadcast, but result is sum of return values BroadcastSumEx chain .Create DelInventory Delta .,Destroy FlushClass ,FlushObj GetInventory |
︙ |
Modified instruc.h from [15ac771ea5] to [6daa55039f].
︙ | |||
286 287 288 289 290 291 292 | 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 | + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | #define OP_BROADCAST 32901 #define OP_BROADCAST_D 41093 #define OP_BROADCASTCLASS 32902 #define OP_BROADCASTEX 32903 #define OP_BROADCASTEX_D 41095 #define OP_BROADCASTSUM 32904 #define OP_BROADCASTSUMEX 32905 #define OP_CHAIN 32906 |
︙ | |||
424 425 426 427 428 429 430 | 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 519 520 521 522 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 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | - + - - + + - + - - + + - - + + - + - + - + - + - + - - - + + + - + - - + + - + - - - + + + - - - - - - - + + + + + + + - - + + - - - - + + + + - + - + - + - + - - - + + + - + - + | {"COLLIDEBY",8389141}, {"CREATE",8389121}, {"CREATED",8389137}, {"Class",8486966}, {"Climb",9142346}, {"CollisionLayers",8487024}, {"Compatible",8487023}, |
︙ | |||
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | + - + - + - + - + - + | {"bit7",8388736}, {"bit8",8423400}, {"bit9",8423401}, {"bnot",8421410}, {"bor",8421408}, {"bxor",8421409}, {"c?",8421424}, {"chain",8421514}, {"cz?",8421425}, {"dup",8421377}, {"el",8683532}, {"else",8683530}, {"eq",8421416}, {"for",8683538}, {"ge",8486956}, {"gt",8486954}, {"if",8683529}, |